diff --git a/test/wh_test_common.h b/test/wh_test_common.h index e9d836616..42989c0cc 100644 --- a/test/wh_test_common.h +++ b/test/wh_test_common.h @@ -71,15 +71,16 @@ * Helper macro for test error propagation * Evaluates the "call" argument, and if not equal to zero, displays the * stringified call argument along with caller source file info and - * causes the calling function to return the value of "call" + * causes the calling function to return the value of "call". + * Use a specific variable name to not overlap with local vars (rc or ret). */ -#define WH_TEST_RETURN_ON_FAIL(call) \ - do { \ - int ret = (call); \ - if (ret != WH_TEST_SUCCESS && ret != WH_TEST_SKIP) { \ - WH_ERROR_PRINT(#call ": ret=%d\n", ret); \ - return ret; \ - } \ +#define WH_TEST_RETURN_ON_FAIL(call) \ + do { \ + int _whTestRet = (call); \ + if (_whTestRet != WH_TEST_SUCCESS && _whTestRet != WH_TEST_SKIP) { \ + WH_ERROR_PRINT(#call ": ret=%d\n", _whTestRet); \ + return _whTestRet; \ + } \ } while (0) /* Number of cryptoCb dispatch modes the test suites exercise on the client diff --git a/test/wh_test_keywrap.c b/test/wh_test_keywrap.c index fdbbed684..f75e08610 100644 --- a/test/wh_test_keywrap.c +++ b/test/wh_test_keywrap.c @@ -430,11 +430,11 @@ int whTest_KeyWrapClientConfig(whClientConfig* clientCfg) } #ifdef WOLFHSM_CFG_ENABLE_AUTHENTICATION - /* Log in as an admin user for the rest of the tests */ + /* Attempt log in as an admin user for the rest of the tests. The server + * may not support auth, so do not require the login itself to succeed. */ WH_TEST_RETURN_ON_FAIL(wh_Client_AuthLogin( client, WH_AUTH_METHOD_PIN, TEST_ADMIN_USERNAME, TEST_ADMIN_PIN, strlen(TEST_ADMIN_PIN), &ret, NULL)); - WH_TEST_ASSERT_RETURN(ret == 0); #endif /* WOLFHSM_CFG_ENABLE_AUTHENTICATION */ ret = whTest_Client_KeyWrap(client);