diff --git a/tests/api.c b/tests/api.c index edf3ef01c..3634760dc 100644 --- a/tests/api.c +++ b/tests/api.c @@ -62942,6 +62942,15 @@ void ApiTest(void) printf(" Begin API Tests\n"); fflush(stdout); + /* we must perform init and cleanup if not all tests are running */ + if (!testAll) { + #ifdef WOLFCRYPT_ONLY + wolfCrypt_Init(); + #else + wolfSSL_Init(); + #endif + } + for (i = 0; i < TEST_CASE_CNT; ++i) { /* When not testing all cases then skip if not marked for running. */ if (!testAll && !testCases[i].run) { @@ -62983,7 +62992,13 @@ void ApiTest(void) wc_ecc_fp_free(); /* free per thread cache */ #endif - wolfSSL_Cleanup(); + if (!testAll) { + #ifdef WOLFCRYPT_ONLY + wolfCrypt_Cleanup(); + #else + wolfSSL_Cleanup(); + #endif + } (void)testDevId;