Skip to content

Commit 023b7d7

Browse files
committed
Testsuite Update
1. Break out the echoserver test into its own function, like the SFTP tests, called by the testsuite. 2. whitespace
1 parent e8e5d37 commit 023b7d7

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

tests/testsuite.c

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ char* myoptarg = NULL;
6969
#if !defined(NO_WOLFSSH_SERVER) && !defined(NO_WOLFSSH_CLIENT) && \
7070
!defined(SINGLE_THREADED) && !defined(WOLFSSH_TEST_BLOCK)
7171

72+
#ifdef WOLFSSH_SHELL
73+
7274
static int tsClientUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
7375
{
7476
static char password[] = "upthehill";
@@ -91,7 +93,7 @@ static int tsClientUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
9193
#define NUMARGS 5
9294
#define ARGLEN 32
9395

94-
int wolfSSH_TestsuiteTest(int argc, char** argv)
96+
static void wolfSSH_EchoTest(void)
9597
{
9698
tcp_ready ready;
9799
THREAD_TYPE serverThread;
@@ -106,30 +108,6 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
106108
int serverArgc = 0;
107109
int clientArgc = 0;
108110

109-
(void)argc;
110-
(void)argv;
111-
112-
WSTARTTCP();
113-
114-
#if defined(DEBUG_WOLFSSH)
115-
wolfSSH_Debugging_ON();
116-
#endif
117-
118-
wolfSSH_Init();
119-
120-
#if defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,2)
121-
{
122-
int i;
123-
for (i = 0; i < FIPS_CAST_COUNT; i++) {
124-
wc_RunCast_fips(i);
125-
}
126-
}
127-
#endif /* HAVE_FIPS */
128-
129-
#if !defined(WOLFSSL_TIRTOS)
130-
ChangeToWolfSshRoot();
131-
#endif
132-
133111
InitTcpReady(&ready);
134112

135113
WSTRNCPY(serverArgv[serverArgc++], "echoserver", ARGLEN);
@@ -163,18 +141,49 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
163141
clientArgs.user_auth = tsClientUserAuth;
164142

165143
client_test(&clientArgs);
166-
if (clientArgs.return_code != 0) {
167-
return clientArgs.return_code;
168-
}
169144

170145
#ifdef WOLFSSH_ZEPHYR
171146
/* Weird deadlock without this sleep */
172147
k_sleep(Z_TIMEOUT_TICKS(100));
173148
#endif
174149
ThreadJoin(serverThread);
175150

176-
wolfSSH_Cleanup();
177151
FreeTcpReady(&ready);
152+
}
153+
#endif /* WOLFSSH_SHELL */
154+
155+
156+
int wolfSSH_TestsuiteTest(int argc, char** argv)
157+
{
158+
(void)argc;
159+
(void)argv;
160+
161+
WSTARTTCP();
162+
163+
#if defined(DEBUG_WOLFSSH)
164+
wolfSSH_Debugging_ON();
165+
#endif
166+
167+
wolfSSH_Init();
168+
169+
#if defined(FIPS_VERSION_GE) && FIPS_VERSION_GE(5,2)
170+
{
171+
int i;
172+
for (i = 0; i < FIPS_CAST_COUNT; i++) {
173+
wc_RunCast_fips(i);
174+
}
175+
}
176+
#endif /* HAVE_FIPS */
177+
178+
#if !defined(WOLFSSL_TIRTOS)
179+
ChangeToWolfSshRoot();
180+
#endif
181+
182+
#ifdef WOLFSSH_SHELL
183+
wolfSSH_EchoTest();
184+
#endif
185+
186+
wolfSSH_Cleanup();
178187

179188
#ifdef WOLFSSH_SFTP
180189
printf("testing SFTP blocking\n");
@@ -184,7 +193,6 @@ int wolfSSH_TestsuiteTest(int argc, char** argv)
184193
wolfSSH_SftpTest(1);
185194
#endif
186195
#endif
187-
188196
return EXIT_SUCCESS;
189197
}
190198

0 commit comments

Comments
 (0)