EXIT_TEST macro added for cleaner implementation and maintenance

This commit is contained in:
kaleb-himes
2016-12-09 19:39:36 -07:00
parent 1748045d52
commit 6c7e1785aa
4 changed files with 12 additions and 25 deletions

View File

@ -210,11 +210,7 @@ int testsuite_test(int argc, char** argv)
#endif /* HAVE_WNR */ #endif /* HAVE_WNR */
printf("\nAll tests passed!\n"); printf("\nAll tests passed!\n");
#ifdef WOLFSSL_RIOT_OS EXIT_TEST(EXIT_SUCCESS);
exit(0);
#else
return EXIT_SUCCESS;
#endif
} }
void simple_test(func_args* args) void simple_test(func_args* args)
@ -415,11 +411,8 @@ int main(int argc, char** argv)
if (server_args.return_code != 0) return server_args.return_code; if (server_args.return_code != 0) return server_args.return_code;
printf("\nAll tests passed!\n"); printf("\nAll tests passed!\n");
#ifdef WOLFSSL_RIOT_OS
exit(0); EXIT_TEST(EXIT_SUCCESS);
#else
return EXIT_SUCCESS;
#endif
} }

View File

@ -483,11 +483,7 @@ int benchmark_test(void *args)
ShowMemoryTracker(); ShowMemoryTracker();
#endif #endif
#ifdef WOLFSSL_RIOT_OS EXIT_TEST(0);
exit (0);
#else
return 0;
#endif
} }

View File

@ -262,11 +262,8 @@ static int err_sys(const char* msg, int es)
{ {
printf("%s error = %d\n", msg, es); printf("%s error = %d\n", msg, es);
#ifdef WOLFSSL_RIOT_OS
exit(-1); EXIT_TEST(-1);
#else
return -1; /* error state */
#endif
} }
/* func_args from test.h, so don't have to pull in other junk */ /* func_args from test.h, so don't have to pull in other junk */
@ -733,11 +730,7 @@ int wolfcrypt_test(void* args)
err_sys("Failed to free netRandom context", -1238); err_sys("Failed to free netRandom context", -1238);
#endif /* HAVE_WNR */ #endif /* HAVE_WNR */
#ifdef WOLFSSL_RIOT_OS EXIT_TEST(args.return_code);
exit(0);
#else
return args.return_code;
#endif
} }
#endif /* NO_MAIN_DRIVER */ #endif /* NO_MAIN_DRIVER */

View File

@ -407,6 +407,11 @@
#endif #endif
#endif /* WOLFSSL_AESNI or WOLFSSL_ARMASM */ #endif /* WOLFSSL_AESNI or WOLFSSL_ARMASM */
#ifdef WOLFSSL_RIOT_OS
#define EXIT_TEST(ret) exit(ret)
#else
#define EXIT_TEST(ret) return ret
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */