From 96cf2ca6745faa84c0a394e607d7878cb3b07926 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Fri, 22 May 2015 06:53:50 +0200 Subject: [PATCH] tests: use /bin/echo to provide '-e' and elimination of some bashisms --- tests/docker-common.sh | 3 ++- tests/full-test | 8 ++++---- tests/radius-test | 6 +++--- tests/unix-test | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/docker-common.sh b/tests/docker-common.sh index c449218a..cc4815e5 100755 --- a/tests/docker-common.sh +++ b/tests/docker-common.sh @@ -6,6 +6,7 @@ fi . ./common.sh +ECHO_E="/bin/echo -e" if test -x /usr/bin/lockfile-create;then LOCKFILE="lockfile-create docker" UNLOCKFILE="lockfile-remove docker" @@ -73,7 +74,7 @@ retrieve_user_info() { grep "$MATCH" out$TMP fi ret=$? - if test $ret == 0;then + if test $ret = 0;then break fi counter=`expr $counter + 1` diff --git a/tests/full-test b/tests/full-test index 0950672d..8f7d3586 100755 --- a/tests/full-test +++ b/tests/full-test @@ -54,14 +54,14 @@ if test ! -z "$QUIT_ON_INIT";then exit 0 fi -echo -e "testuser" >pass-full$TMP +$ECHO_E "testuser" >pass-full$TMP $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP if test $? = 0;then echo "Authentication with wrong password succeeded!" stop fi -echo -e "test" >pass-full$TMP +$ECHO_E "test" >pass-full$TMP $OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP if test $? = 0;then echo "Authentication with wrong username succeeded!" @@ -70,14 +70,14 @@ fi echo "" echo "Connecting with correct username" -echo -e "test" >pass-full$TMP +$ECHO_E "test" >pass-full$TMP $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-full$TMP & PID=$! -rm -f pass-full$TMP #wait for openconnect sleep 5 +rm -f pass-full$TMP # The client IP depends on the username so it shouldn't change. ping -w 5 192.168.1.1 diff --git a/tests/radius-test b/tests/radius-test index ca76e0b1..ad65457a 100755 --- a/tests/radius-test +++ b/tests/radius-test @@ -56,14 +56,14 @@ if test ! -z "$QUIT_ON_INIT";then exit 0 fi -echo -e "testuser" >pass-radius$TMP +$ECHO_E "testuser" >pass-radius$TMP $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP if test $? = 0;then echo "Authentication with wrong password succeeded!" stop fi -echo -e "test" >pass-radius$TMP +$ECHO_E "test" >pass-radius$TMP $OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP if test $? = 0;then echo "Authentication with wrong username succeeded!" @@ -71,7 +71,7 @@ if test $? = 0;then fi echo "Trying with correct password" -echo -e "test" >pass-radius$TMP +$ECHO_E "test" >pass-radius$TMP $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-radius$TMP & PID=$! diff --git a/tests/unix-test b/tests/unix-test index 3dc3ceda..e21eb2b5 100755 --- a/tests/unix-test +++ b/tests/unix-test @@ -53,14 +53,14 @@ if test ! -z "$QUIT_ON_INIT";then exit 0 fi -echo -e "test\ntest" >pass$TMP +$ECHO_E "test\ntest" >pass$TMP $OPENCONNECT $IP:6551 -u test --passwd-on-stdin --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass$TMP & PID=$! -rm -f pass$TMP #wait for openconnect sleep 5 +rm -f pass$TMP # The client IP depends on the username so it shouldn't change. ping -w 5 192.168.99.1