tests: use /bin/echo to provide '-e' and elimination of some bashisms

This commit is contained in:
Nikos Mavrogiannopoulos
2015-05-22 06:53:50 +02:00
parent 95ae123a57
commit 96cf2ca674
4 changed files with 11 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ fi
. ./common.sh . ./common.sh
ECHO_E="/bin/echo -e"
if test -x /usr/bin/lockfile-create;then if test -x /usr/bin/lockfile-create;then
LOCKFILE="lockfile-create docker" LOCKFILE="lockfile-create docker"
UNLOCKFILE="lockfile-remove docker" UNLOCKFILE="lockfile-remove docker"
@@ -73,7 +74,7 @@ retrieve_user_info() {
grep "$MATCH" out$TMP grep "$MATCH" out$TMP
fi fi
ret=$? ret=$?
if test $ret == 0;then if test $ret = 0;then
break break
fi fi
counter=`expr $counter + 1` counter=`expr $counter + 1`

View File

@@ -54,14 +54,14 @@ if test ! -z "$QUIT_ON_INIT";then
exit 0 exit 0
fi 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 $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
if test $? = 0;then if test $? = 0;then
echo "Authentication with wrong password succeeded!" echo "Authentication with wrong password succeeded!"
stop stop
fi 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 $OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
if test $? = 0;then if test $? = 0;then
echo "Authentication with wrong username succeeded!" echo "Authentication with wrong username succeeded!"
@@ -70,14 +70,14 @@ fi
echo "" echo ""
echo "Connecting with correct username" 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 & $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-full$TMP &
PID=$! PID=$!
rm -f pass-full$TMP
#wait for openconnect #wait for openconnect
sleep 5 sleep 5
rm -f pass-full$TMP
# The client IP depends on the username so it shouldn't change. # The client IP depends on the username so it shouldn't change.
ping -w 5 192.168.1.1 ping -w 5 192.168.1.1

View File

@@ -56,14 +56,14 @@ if test ! -z "$QUIT_ON_INIT";then
exit 0 exit 0
fi 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 $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
if test $? = 0;then if test $? = 0;then
echo "Authentication with wrong password succeeded!" echo "Authentication with wrong password succeeded!"
stop stop
fi 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 $OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
if test $? = 0;then if test $? = 0;then
echo "Authentication with wrong username succeeded!" echo "Authentication with wrong username succeeded!"
@@ -71,7 +71,7 @@ if test $? = 0;then
fi fi
echo "Trying with correct password" 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 & $OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-radius$TMP &
PID=$! PID=$!

View File

@@ -53,14 +53,14 @@ if test ! -z "$QUIT_ON_INIT";then
exit 0 exit 0
fi 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 & $OPENCONNECT $IP:6551 -u test --passwd-on-stdin --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass$TMP &
PID=$! PID=$!
rm -f pass$TMP
#wait for openconnect #wait for openconnect
sleep 5 sleep 5
rm -f pass$TMP
# The client IP depends on the username so it shouldn't change. # The client IP depends on the username so it shouldn't change.
ping -w 5 192.168.99.1 ping -w 5 192.168.99.1