Skip to content

Commit

Permalink
add error return test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Dec 8, 2023
1 parent a65a324 commit 7a3df8f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions apps/wolfsshd/test/error_return.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

# sshd local test

PWD=`pwd`
cd ../../..

TEST_CLIENT="./examples/client/client"
USER=`whoami`
PRIVATE_KEY="./keys/hansel-key-ecc.der"
PUBLIC_KEY="./keys/hansel-key-ecc.pub"

if [ -z "$1" ] || [ -z "$2" ]; then
echo "expecting host and port as arguments"
echo "./error_return.sh 127.0.0.1 22222"
exit -1
fi

echo "$TEST_CLIENT -c 'ls error' -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h \"$1\" -p \"$2\""
$TEST_CLIENT -c 'ls error' -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -h "$1" -p "$2"
if [ $? != 2 ]; then
echo "Expecting error return value of 2 for failed ls command"
cd $PWD
exit 1
fi

cd $PWD
exit 0


1 change: 1 addition & 0 deletions apps/wolfsshd/test/run_all_sshd_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ run_test() {

run_test "sshd_exec_test.sh"
run_test "sshd_term_size_test.sh"
run_test "error_return.sh"

# add aditional tests here, check on var USING_LOCAL_HOST if can make sshd
# server start/restart with changes
Expand Down

0 comments on commit 7a3df8f

Please sign in to comment.