Testsuite Update

1. Break out the echoserver test into its own function, like the SFTP
   tests, called by the testsuite.
2. whitespace
pull/873/head
John Safranek 2026-01-26 16:40:18 -08:00
parent e8e5d372e3
commit 023b7d777e
1 changed files with 38 additions and 30 deletions

View File

@ -69,6 +69,8 @@ char* myoptarg = NULL;
#if !defined(NO_WOLFSSH_SERVER) && !defined(NO_WOLFSSH_CLIENT) && \
!defined(SINGLE_THREADED) && !defined(WOLFSSH_TEST_BLOCK)
#ifdef WOLFSSH_SHELL
static int tsClientUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
{
static char password[] = "upthehill";
@ -91,7 +93,7 @@ static int tsClientUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
#define NUMARGS 5
#define ARGLEN 32
int wolfSSH_TestsuiteTest(int argc, char** argv)
static void wolfSSH_EchoTest(void)
{
tcp_ready ready;
THREAD_TYPE serverThread;
@ -106,30 +108,6 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
int serverArgc = 0;
int clientArgc = 0;
(void)argc;
(void)argv;
WSTARTTCP();
#if defined(DEBUG_WOLFSSH)
wolfSSH_Debugging_ON();
#endif
wolfSSH_Init();
#if defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,2)
{
int i;
for (i = 0; i < FIPS_CAST_COUNT; i++) {
wc_RunCast_fips(i);
}
}
#endif /* HAVE_FIPS */
#if !defined(WOLFSSL_TIRTOS)
ChangeToWolfSshRoot();
#endif
InitTcpReady(&ready);
WSTRNCPY(serverArgv[serverArgc++], "echoserver", ARGLEN);
@ -163,9 +141,6 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
clientArgs.user_auth = tsClientUserAuth;
client_test(&clientArgs);
if (clientArgs.return_code != 0) {
return clientArgs.return_code;
}
#ifdef WOLFSSH_ZEPHYR
/* Weird deadlock without this sleep */
@ -173,8 +148,42 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
#endif
ThreadJoin(serverThread);
wolfSSH_Cleanup();
FreeTcpReady(&ready);
}
#endif /* WOLFSSH_SHELL */
int wolfSSH_TestsuiteTest(int argc, char** argv)
{
(void)argc;
(void)argv;
WSTARTTCP();
#if defined(DEBUG_WOLFSSH)
wolfSSH_Debugging_ON();
#endif
wolfSSH_Init();
#if defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,2)
{
int i;
for (i = 0; i < FIPS_CAST_COUNT; i++) {
wc_RunCast_fips(i);
}
}
#endif /* HAVE_FIPS */
#if !defined(WOLFSSL_TIRTOS)
ChangeToWolfSshRoot();
#endif
#ifdef WOLFSSH_SHELL
wolfSSH_EchoTest();
#endif
wolfSSH_Cleanup();
#ifdef WOLFSSH_SFTP
printf("testing SFTP blocking\n");
@ -184,7 +193,6 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
wolfSSH_SftpTest(1);
#endif
#endif
return EXIT_SUCCESS;
}