From 74faf3c4008f6f19faf95e33286fae64522394ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 13 Mar 2014 18:47:44 +0100 Subject: [PATCH] Fix usage of environment variables for commands --- tests/compat.sh | 22 +++++++++++++--------- tests/ssl-opt.sh | 10 +++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/compat.sh b/tests/compat.sh index b0ced93bc..d06adb8d2 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -13,7 +13,9 @@ let "srvmem = 0" # default values, can be overriden by the environment : ${P_SRV:=../programs/ssl/ssl_server2} : ${P_CLI:=../programs/ssl/ssl_client2} -: ${OPENSSL:=openssl} +: ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system +: ${GNUTLS_CLI:=gnutls-cli} +: ${GNUTLS_SERV:=gnutls-serv} MODES="ssl3 tls1 tls1_1 tls1_2" VERIFIES="NO YES" @@ -607,10 +609,10 @@ has_mem_err() { start_server() { case $1 in [Oo]pen*) - SERVER_CMD="$OPENSSL s_server $O_SERVER_ARGS" + SERVER_CMD="$OPENSSL_CMD s_server $O_SERVER_ARGS" ;; [Gg]nu*) - SERVER_CMD="gnutls-serv $G_SERVER_ARGS --priority $G_SERVER_PRIO" + SERVER_CMD="$GNUTLS_SERV $G_SERVER_ARGS --priority $G_SERVER_PRIO" ;; [Pp]olar*) SERVER_CMD="$P_SRV $P_SERVER_ARGS" @@ -687,7 +689,7 @@ run_client() { # run the command and interpret result case $1 in [Oo]pen*) - CLIENT_CMD="$OPENSSL s_client $O_CLIENT_ARGS -cipher $2" + CLIENT_CMD="$OPENSSL_CMD s_client $O_CLIENT_ARGS -cipher $2" log "$CLIENT_CMD" echo "$CLIENT_CMD" > cli_out ( echo -e 'GET HTTP/1.0'; echo; ) | $CLIENT_CMD >> cli_out 2>&1 @@ -705,7 +707,7 @@ run_client() { ;; [Gg]nu*) - CLIENT_CMD="gnutls-cli $G_CLIENT_ARGS --priority $G_PRIO_MODE:$2 localhost" + CLIENT_CMD="$GNUTLS_CLI $G_CLIENT_ARGS --priority $G_PRIO_MODE:$2 localhost" log "$CLIENT_CMD" echo "$CLIENT_CMD" > cli_out ( echo -e 'GET HTTP/1.0'; echo; ) | $CLIENT_CMD >> cli_out 2>&1 @@ -792,10 +794,12 @@ if [ ! -x "$P_CLI" ]; then echo "Command '$P_CLI' is not an executable file" exit 1 fi -if which $OPENSSL >/dev/null 2>&1; then :; else - echo "Command '$OPENSSL' not found" - exit 1 -fi +for CMD in $OPENSSL_CMD $GNUTLS_CLI $GNUTLS_SERV; do + if which "$CMD" >/dev/null 2>&1; then :; else + echo "Command '$CMD' not found" + exit 1 + fi +done get_options "$@" diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index ec5f0543c..a5932fb05 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -13,10 +13,10 @@ set -u # default values, can be overriden by the environment : ${P_SRV:=../programs/ssl/ssl_server2} : ${P_CLI:=../programs/ssl/ssl_client2} -: ${OPENSSL:=openssl} +: ${OPENSSL_CMD:=openssl} # OPENSSL would conflict with the build system -O_SRV="$OPENSSL s_server -www -cert data_files/server5.crt -key data_files/server5.key" -O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL s_client" +O_SRV="$OPENSSL_CMD s_server -www -cert data_files/server5.crt -key data_files/server5.key" +O_CLI="echo 'GET / HTTP/1.0' | $OPENSSL_CMD s_client" TESTS=0 FAILS=0 @@ -237,8 +237,8 @@ if [ ! -x "$P_CLI" ]; then echo "Command '$P_CLI' is not an executable file" exit 1 fi -if which $OPENSSL >/dev/null 2>&1; then :; else - echo "Command '$OPENSSL' not found" +if which $OPENSSL_CMD >/dev/null 2>&1; then :; else + echo "Command '$OPENSSL_CMD' not found" exit 1 fi