Skip to content

Commit

Permalink
add large sftp file transfer test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Feb 15, 2024
1 parent 1e982a7 commit cd3130f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/sshd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: autogen
run: ./autogen.sh
- name: configure
run: ./configure --enable-all CPPFLAGS=-DWOLFSSH_NO_FPKI
run: ./configure --enable-all CPPFLAGS="-DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000"
- name: make
run: make
- name: make check
Expand Down
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 @@ -59,6 +59,7 @@ run_test() {

run_test "sshd_exec_test.sh"
run_test "sshd_term_size_test.sh"
run_test "sshd_large_sftp_test.sh"

#Github actions needs resolved for these test cases
#run_test "error_return.sh"
Expand Down
40 changes: 40 additions & 0 deletions apps/wolfsshd/test/sshd_large_sftp_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh

# sshd local test

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

TEST_SFTP_CLIENT="./examples/sftpclient/wolfsftp"
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 "./sshd_exec_test.sh 127.0.0.1 22222"
exit 1
fi


# create a large file with random data (larger than word32 max value)
head -c 4400000010 < /dev/random > large-random.txt

set -e
echo "$TEST_SFTP_CLIENT -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -g -l large-random.txt -r `pwd`/large-random-2.txt -h \"$1\" -p \"$2\""
$TEST_SFTP_CLIENT -u $USER -i $PRIVATE_KEY -j $PUBLIC_KEY -g -l large-random.txt -r `pwd`/large-random-2.txt -h "$1" -p "$2"

cmp large-random.txt large-random-2.txt
RESULT=$?
if [ "$RESULT" != "0" ]; then
echo "files did not match when compared"
exit 1
fi
rm -f large-random.txt
rm -f large-random-2.txt

set +e

cd $PWD
exit 0

0 comments on commit cd3130f

Please sign in to comment.