add sftp test cases, fix build for C89, add flag print out to echoserver

pull/134/head
Jacob Barthelmeh 2019-01-23 12:02:35 -07:00
parent 6bac023986
commit df6955866d
3 changed files with 33 additions and 1 deletions

View File

@ -666,6 +666,9 @@ static void ShowUsage(void)
printf(" -e use ECC private key\n");
printf(" -p <num> port to connect on, default %d\n", wolfSshPort);
printf(" -N use non-blocking sockets\n");
#ifdef WOLFSSH_SFTP
printf(" -d <string> set the home directory for SFTP connections\n");
#endif
}

View File

@ -133,9 +133,9 @@ static void clean_path(char* path)
if (path != NULL) {
/* go through path until no cases are found */
do {
sz = (long)WSTRLEN(path);
int prIdx = 0; /* begin of cut */
int enIdx = 0; /* end of cut */
sz = (long)WSTRLEN(path);
found = 0;
for (i = 0; i < sz; i++) {

View File

@ -71,6 +71,35 @@ if [ $RESULT -ne 0 ]; then
exit 1
fi
# Test non blocking connection
./examples/echoserver/echoserver -N -1 -R $ready_file &
server_pid=$!
create_port
echo "ls\nexit" | ./examples/sftpclient/wolfsftp -N -u jill -P upthehill -p $port
RESULT=$?
remove_ready_file
# if fail here then is a settings issue so return 0
if [ $RESULT -ne 0 ]; then
echo -e "\n\nfailed to connect"
do_cleanup
exit 1
fi
# Test of setting directory
PWD=`pwd`
./examples/echoserver/echoserver -d $PWD/examples -1 -R $ready_file &
server_pid=$!
create_port
echo "ls\nexit" | ./examples/sftpclient/wolfsftp -N -u jill -P upthehill -p $port
RESULT=$?
remove_ready_file
# if fail here then is a settings issue so return 0
if [ $RESULT -ne 0 ]; then
echo -e "\n\nfailed to connect"
do_cleanup
exit 1
fi
echo -e "\nALL Tests Passed"
exit 0