mirror of https://github.com/wolfSSL/wolfssh.git
refactor sshd test case script
parent
c2fefec0eb
commit
c476e8846e
|
@ -106,3 +106,20 @@ jobs:
|
||||||
touch sshd_config.txt
|
touch sshd_config.txt
|
||||||
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" --enable-static --disable-shared && make
|
./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" --enable-static --disable-shared && make
|
||||||
sudo timeout --preserve-status -s 2 5 valgrind --error-exitcode=1 --leak-check=full ./apps/wolfsshd/wolfsshd -D -f sshd_config -h ./keys/server-key.pem -d -p 22222
|
sudo timeout --preserve-status -s 2 5 valgrind --error-exitcode=1 --leak-check=full ./apps/wolfsshd/wolfsshd -D -f sshd_config -h ./keys/server-key.pem -d -p 22222
|
||||||
|
|
||||||
|
- name: configure with debug
|
||||||
|
working-directory: ./wolfssh/
|
||||||
|
run : |
|
||||||
|
./configure --enable-all --enable-debug LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120"
|
||||||
|
|
||||||
|
- name: make
|
||||||
|
working-directory: ./wolfssh/
|
||||||
|
run: make
|
||||||
|
|
||||||
|
# ssh_kex_algos.sh requires debug output otherwise it is skipped
|
||||||
|
- name: Run wolfSSHd tests with debug
|
||||||
|
working-directory: ./wolfssh/apps/wolfsshd/test
|
||||||
|
run: |
|
||||||
|
git log -3
|
||||||
|
sudo ./run_all_sshd_tests.sh --match ssh_kex_algos.sh
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,60 @@
|
||||||
|
|
||||||
echo "Running all wolfSSHd tests"
|
echo "Running all wolfSSHd tests"
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
# Define an array of test cases
|
||||||
USER=$USER
|
test_cases=(
|
||||||
else
|
"sshd_exec_test.sh"
|
||||||
USER=$1
|
"sshd_term_size_test.sh"
|
||||||
fi
|
"sshd_large_sftp_test.sh"
|
||||||
|
"sshd_bad_sftp_test.sh"
|
||||||
|
"sshd_term_close_test.sh"
|
||||||
|
"ssh_kex_algos.sh"
|
||||||
|
)
|
||||||
|
|
||||||
TEST_HOST=$2
|
# Set defaults
|
||||||
TEST_PORT=$3
|
USER=$USER
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
MATCH=""
|
||||||
|
EXCLUDE=""
|
||||||
|
while [[ "$#" -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--match)
|
||||||
|
MATCH="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
|
--exclude)
|
||||||
|
EXCLUDE="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
|
--user)
|
||||||
|
USER="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
|
--host)
|
||||||
|
TEST_HOST="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
|
--port)
|
||||||
|
TEST_PORT="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1"
|
||||||
|
echo "Expecting --host <host> | --port <port> | --user <user> | --match <test case> | --exclude <test case>"
|
||||||
|
echo "All test cases:"
|
||||||
|
for test in "${test_cases[@]}"; do
|
||||||
|
echo " $test"
|
||||||
|
done
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
TOTAL=0
|
TOTAL=0
|
||||||
SKIPPED=0
|
SKIPPED=0
|
||||||
|
@ -57,43 +103,62 @@ run_test() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test "sshd_exec_test.sh"
|
# Run the tests
|
||||||
run_test "sshd_term_size_test.sh"
|
if [[ -n "$MATCH" ]]; then
|
||||||
run_test "sshd_large_sftp_test.sh"
|
if [[ " ${test_cases[*]} " =~ " $MATCH " ]]; then
|
||||||
run_test "sshd_bad_sftp_test.sh"
|
echo "Running test: $MATCH"
|
||||||
run_test "sshd_term_close_test.sh"
|
run_test "$MATCH"
|
||||||
|
else
|
||||||
|
echo "Error: Test '$MATCH' not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
run_test "ssh_kex_algos.sh"
|
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
||||||
|
printf "Shutting down test wolfSSHd\n"
|
||||||
#Github actions needs resolved for these test cases
|
stop_wolfsshd
|
||||||
#run_test "error_return.sh"
|
fi
|
||||||
#run_test "sshd_login_grace_test.sh"
|
|
||||||
|
|
||||||
# add aditional tests here, check on var USING_LOCAL_HOST if can make sshd
|
|
||||||
# server start/restart with changes
|
|
||||||
|
|
||||||
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
|
||||||
printf "Shutting down test wolfSSHd\n"
|
|
||||||
stop_wolfsshd
|
|
||||||
fi
|
|
||||||
|
|
||||||
# these tests require setting up an sshd
|
|
||||||
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
|
||||||
run_test "sshd_forcedcmd_test.sh"
|
|
||||||
run_test "sshd_window_full_test.sh"
|
|
||||||
else
|
else
|
||||||
printf "Skipping tests that need to setup local SSHD\n"
|
echo "Running all tests..."
|
||||||
SKIPPED=$((SKIPPED+2))
|
for test in "${test_cases[@]}"; do
|
||||||
fi
|
if [[ "$test" != "$EXCLUDE" ]]; then
|
||||||
|
echo "Running test: $test"
|
||||||
|
run_test "$test"
|
||||||
|
else
|
||||||
|
echo "Test '$test' is excluded. Skipping."
|
||||||
|
SKIPPED=$((SKIPPED+1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# these tests run with X509 sshd-config loaded
|
#Github actions needs resolved for these test cases
|
||||||
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
#run_test "error_return.sh"
|
||||||
start_wolfsshd "sshd_config_test_x509"
|
#run_test "sshd_login_grace_test.sh"
|
||||||
fi
|
|
||||||
run_test "sshd_x509_test.sh"
|
# add aditional tests here, check on var USING_LOCAL_HOST if can make sshd
|
||||||
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
# server start/restart with changes
|
||||||
printf "Shutting down test wolfSSHd\n"
|
|
||||||
stop_wolfsshd
|
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
||||||
|
printf "Shutting down test wolfSSHd\n"
|
||||||
|
stop_wolfsshd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# these tests require setting up an sshd
|
||||||
|
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
||||||
|
run_test "sshd_forcedcmd_test.sh"
|
||||||
|
run_test "sshd_window_full_test.sh"
|
||||||
|
else
|
||||||
|
printf "Skipping tests that need to setup local SSHD\n"
|
||||||
|
SKIPPED=$((SKIPPED+2))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# these tests run with X509 sshd-config loaded
|
||||||
|
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
||||||
|
start_wolfsshd "sshd_config_test_x509"
|
||||||
|
fi
|
||||||
|
run_test "sshd_x509_test.sh"
|
||||||
|
if [ "$USING_LOCAL_HOST" == 1 ]; then
|
||||||
|
printf "Shutting down test wolfSSHd\n"
|
||||||
|
stop_wolfsshd
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "All tests ran, $TOTAL passed, $SKIPPED skipped\n"
|
printf "All tests ran, $TOTAL passed, $SKIPPED skipped\n"
|
||||||
|
|
Loading…
Reference in New Issue