From 67e39a442968ae8a815ae53600d90b80d436e676 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Tue, 26 Nov 2024 10:38:38 -0700 Subject: [PATCH] add test ssh connection command and pause before check --- apps/wolfsshd/test/sshd_term_close_test.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/wolfsshd/test/sshd_term_close_test.sh b/apps/wolfsshd/test/sshd_term_close_test.sh index 395f343b..d0e464f5 100755 --- a/apps/wolfsshd/test/sshd_term_close_test.sh +++ b/apps/wolfsshd/test/sshd_term_close_test.sh @@ -19,9 +19,16 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openssl-1.1.1/lib # get the current wolfsshd pid count to compare with WOLFSSHD_PID_COUNT=$(pgrep wolfsshd | wc -l) -COMMAND="timeout 2 $TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"sleep 10\"" +COMMAND="$TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"echo test\"" echo "$COMMAND" +set -e +$COMMAND +set +e + +COMMAND="timeout 3 $TEST_CLIENT -p $2 -i $PRIVATE_KEY $3@$1 \"sleep 10\"" +echo "$COMMAND &" $COMMAND & +sleep 1 WOLFSSHD_PID_COUNT_AFTER=$(pgrep wolfsshd | wc -l) if [ "$WOLFSSHD_PID_COUNT" = "$WOLFSSHD_PID_COUNT_AFTER" ]; then echo "Expecting another wolfSSHd pid after connection" @@ -29,6 +36,7 @@ if [ "$WOLFSSHD_PID_COUNT" = "$WOLFSSHD_PID_COUNT_AFTER" ]; then echo "PID count after = $WOLFSSHD_PID_COUNT_AFTER" exit 1 fi + netstat -nt | grep ESTABLISHED RESULT=$? if [ "$RESULT" != "0" ]; then