diff options
author | Daiki Ueno <ueno@gnu.org> | 2020-10-03 16:42:07 +0000 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2020-10-03 16:42:07 +0000 |
commit | 6f034aa2e9f140626de2b9413715651dffe9e394 (patch) | |
tree | 0a594b8b65bddc9303e1fd6dcc80807e3a79e602 /tests/ocsp-tests/ocsp-tls-connection | |
parent | 12a3bb06a19c78607e9f2a0a59c2e71f43a22b8b (diff) | |
parent | 2c1d544c5d9ad12afec09cc6ede40aa8f4693fd2 (diff) | |
download | gnutls-6f034aa2e9f140626de2b9413715651dffe9e394.tar.gz |
Merge branch 'tmp-sh-tests' into 'master'
tests: simplify shell-script usage
See merge request gnutls/gnutls!1337
Diffstat (limited to 'tests/ocsp-tests/ocsp-tls-connection')
-rwxr-xr-x | tests/ocsp-tests/ocsp-tls-connection | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/ocsp-tests/ocsp-tls-connection b/tests/ocsp-tests/ocsp-tls-connection index fba9a6eb1c..84eda22b27 100755 --- a/tests/ocsp-tests/ocsp-tls-connection +++ b/tests/ocsp-tests/ocsp-tls-connection @@ -21,13 +21,12 @@ # along with GnuTLS; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -srcdir="${srcdir:-.}" -CERTTOOL="${CERTTOOL:-../src/certtool${EXEEXT}}" -OCSPTOOL="${OCSPTOOL:-../src/ocsptool${EXEEXT}}" -GNUTLS_SERV="${SERV:-../src/gnutls-serv${EXEEXT}}" -unset SERV -GNUTLS_CLI="${GNUTLS_CLI:-../src/gnutls-cli${EXEEXT}}" -DIFF="${DIFF:-diff}" +: ${srcdir=.} +: ${CERTTOOL=../src/certtool${EXEEXT}} +: ${OCSPTOOL=../src/ocsptool${EXEEXT}} +: ${SERV=../src/gnutls-serv${EXEEXT}} +: ${CLI=../src/gnutls-cli${EXEEXT}} +: ${DIFF=diff} TEMPLATE_FILE="out.$$.tmpl.tmp" SERVER_CERT_FILE="cert.$$.pem.tmp" @@ -39,11 +38,11 @@ if ! test -x "${OCSPTOOL}"; then exit 77 fi -if ! test -x "${GNUTLS_SERV}"; then +if ! test -x "${SERV}"; then exit 77 fi -if ! test -x "${GNUTLS_CLI}"; then +if ! test -x "${CLI}"; then exit 77 fi @@ -70,8 +69,8 @@ OCSP_PORT=$PORT SERVER_START_TIMEOUT=10 # Check for OpenSSL -OPENSSL=`which openssl` -if ! test -x "${OPENSSL}"; then +: ${OPENSSL=openssl} +if ! ("$OPENSSL" version) > /dev/null 2>&1; then echo "You need openssl to run this test." exit 77 fi @@ -112,7 +111,7 @@ echo "=== Bringing OCSP server up ===" # if started repeatedly in a short time, probably a lack of # SO_REUSEADDR usage. PORT=${OCSP_PORT} -launch_bare_server $$ \ +launch_bare_server \ datefudge "${TESTDATE}" \ "${OPENSSL}" ocsp -index "${srcdir}/ocsp-tests/certs/ocsp_index.txt" -text \ -port "${OCSP_PORT}" \ @@ -150,9 +149,9 @@ fi echo "=== Test 1: Server with valid certificate ===" PORT=${TLS_SERVER_PORT} -launch_bare_server $$ \ +launch_bare_server \ datefudge "${TESTDATE}" \ - "${GNUTLS_SERV}" --echo --disable-client-cert \ + "${SERV}" --echo --disable-client-cert \ --x509keyfile="${srcdir}/ocsp-tests/certs/server_good.key" \ --x509certfile="${SERVER_CERT_FILE}" \ --port="${TLS_SERVER_PORT}" @@ -163,7 +162,7 @@ wait_for_port "${TLS_SERVER_PORT}" echo "test 123456" | \ datefudge -s "${TESTDATE}" \ - "${GNUTLS_CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \ + "${CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \ --port="${TLS_SERVER_PORT}" localhost rc=$? @@ -195,9 +194,9 @@ echo "=== Test 2: Server with revoked certificate ===" eval "${GETPORT}" TLS_SERVER_PORT=$PORT -launch_bare_server $$ \ +launch_bare_server \ datefudge "${TESTDATE}" \ - "${GNUTLS_SERV}" --echo --disable-client-cert \ + "${SERV}" --echo --disable-client-cert \ --x509keyfile="${srcdir}/ocsp-tests/certs/server_bad.key" \ --x509certfile="${SERVER_CERT_FILE}" \ --port="${TLS_SERVER_PORT}" @@ -207,7 +206,7 @@ wait_for_port "${TLS_SERVER_PORT}" echo "test 123456" | \ datefudge -s "${TESTDATE}" \ - "${GNUTLS_CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \ + "${CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \ --port="${TLS_SERVER_PORT}" localhost rc=$? |