From 4fe04c6bed74ff312a31e5c7faf1e5036d055652 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 7 May 2015 12:50:27 -0700 Subject: [PATCH] detect build cases where external script test case doesn't make sense --- examples/client/client.c | 30 +++++++++++++++++++++++++++++- scripts/external.test | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/examples/client/client.c b/examples/client/client.c index afdbc2d86..ee5dae9ca 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -148,6 +148,7 @@ static void Usage(void) #endif printf("-f Fewer packets/group messages\n"); printf("-x Disable client cert/key loading\n"); + printf("-X Driven by eXternal test case\n"); #ifdef SHOW_SIZES printf("-z Print structure sizes\n"); #endif @@ -213,6 +214,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) int resumeSession = 0; int wc_shutdown = 0; int disableCRL = 0; + int externalTest = 0; int ret; int scr = 0; /* allow secure renegotiation */ int forceScr = 0; /* force client initiaed scr */ @@ -271,7 +273,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) StackTrap(); while ((ch = mygetopt(argc, argv, - "?gdDusmNrwRitfxUPCh:p:v:l:A:c:k:b:zS:L:ToO:a")) != -1) { + "?gdDusmNrwRitfxXUPCh:p:v:l:A:c:k:b:zS:L:ToO:a")) + != -1) { switch (ch) { case '?' : Usage(); @@ -315,6 +318,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) useClientCert = 0; break; + case 'X' : + externalTest = 1; + break; + case 'f' : fewerPackets = 1; break; @@ -457,6 +464,27 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) myoptind = 0; /* reset for test cases */ + if (externalTest) { + /* detect build cases that wouldn't allow test against wolfssl.com */ + int done = 0; + (void)done; + + #ifdef NO_RSA + done = 1; + #endif + + #ifndef NO_PSK + done = 1; + #endif + + if (done) { + printf("external test can't be run in this mode"); + + ((func_args*)args)->return_code = 0; + exit(EXIT_SUCCESS); + } + } + /* sort out DTLS versus TLS versions */ if (version == CLIENT_INVALID_VERSION) { if (doDTLS) diff --git a/scripts/external.test b/scripts/external.test index 9b2668d80..1d6cb7e12 100755 --- a/scripts/external.test +++ b/scripts/external.test @@ -13,7 +13,7 @@ RESULT=$? [ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 0 # client test against the server -./examples/client/client -C -h $server -p 443 -g -A $ca +./examples/client/client -X -C -h $server -p 443 -g -A $ca RESULT=$? [ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1