Skip to content

Commit adc604b

Browse files
committed
Fix: Changed test outputs from debug print macro to regular print macro
1 parent 23a0d05 commit adc604b

13 files changed

+137
-126
lines changed

test/wh_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#if defined(WOLFHSM_CFG_ENABLE_CLIENT) && defined(WOLFHSM_CFG_ENABLE_SERVER)
6262
int whTest_Unit(void)
6363
{
64-
WH_TEST_DEBUG_PRINT("Enter unit tests\n");
64+
WH_TEST_PRINT("Enter unit tests\n");
6565

6666
/* Component Tests */
6767
WH_TEST_ASSERT(0 == whTest_Flash_RamSim());

test/wh_test_cert.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ int whTest_CertClient(whClientContext* client)
221221
WH_TEST_ASSERT_RETURN(out_rc == WH_ERROR_CERT_VERIFY);
222222

223223
/* Test verify with cached leaf public key */
224-
WH_TEST_DEBUG_PRINT("Testing verify with cached leaf public key...\n");
224+
WH_TEST_PRINT("Testing verify with cached leaf public key...\n");
225225
WH_TEST_RETURN_ON_FAIL(wh_Client_CertVerifyAndCacheLeafPubKey(
226226
client, RAW_CERT_CHAIN_A, RAW_CERT_CHAIN_A_len, rootCertA_id,
227227
&out_keyId, &out_rc));
@@ -406,7 +406,7 @@ int whTest_CertClientDma_ClientServerTestInternal(whClientContext* client)
406406
WH_TEST_ASSERT_RETURN(out_rc == WH_ERROR_CERT_VERIFY);
407407

408408
/* Test verify with cached leaf public key */
409-
WH_TEST_DEBUG_PRINT("Testing verify with cached leaf public key using DMA...\n");
409+
WH_TEST_PRINT("Testing verify with cached leaf public key using DMA...\n");
410410
WH_TEST_RETURN_ON_FAIL(wh_Client_CertVerifyDmaAndCacheLeafPubKey(
411411
client, RAW_CERT_CHAIN_A, RAW_CERT_CHAIN_A_len, rootCertA_id,
412412
&out_keyId, &out_rc));
@@ -520,7 +520,7 @@ static int whTest_CertNonExportable(whClientContext* client)
520520
uint8_t cert_buffer[2048] = {0};
521521
uint32_t cert_len = sizeof(cert_buffer);
522522

523-
WH_TEST_DEBUG_PRINT("Testing non-exportable certificate functionality...\n");
523+
WH_TEST_PRINT("Testing non-exportable certificate functionality...\n");
524524

525525
/* Add exportable certificate */
526526
WH_TEST_DEBUG_PRINT("Adding exportable certificate...\n");
@@ -635,7 +635,7 @@ int whTest_CertRamSim(whTestNvmBackendType nvmType)
635635
#endif
636636
}};
637637

638-
WH_TEST_DEBUG_PRINT("Testing Server Certificate with RAM sim...\n");
638+
WH_TEST_PRINT("Testing Server Certificate with RAM sim...\n");
639639

640640
/* Initialize NVM */
641641
WH_TEST_RETURN_ON_FAIL(wh_Nvm_Init(nvm, n_conf));

test/wh_test_clientserver.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static int _testNonExportableNvmAccess(whClientContext* client)
502502
int32_t out_rc = 0;
503503
whNvmSize out_len = 0;
504504

505-
WH_TEST_DEBUG_PRINT("Testing non-exportable NVM object access protection...\n");
505+
WH_TEST_PRINT("Testing non-exportable NVM object access protection...\n");
506506

507507
/* Test 1: Regular NVM Read Protection */
508508
/* Create NVM object with non-exportable flag */
@@ -575,7 +575,7 @@ static int _testNonExportableNvmAccess(whClientContext* client)
575575

576576
#ifdef WOLFHSM_CFG_DMA
577577
/* Test 3: DMA NVM Read Protection */
578-
WH_TEST_DEBUG_PRINT("Testing DMA NVM read protection...\n");
578+
WH_TEST_PRINT("Testing DMA NVM read protection...\n");
579579

580580
/* Create NVM object with non-exportable flag */
581581
memcpy(nvmLabel, "NonExportDmaNvmObj", sizeof("NonExportDmaNvmObj"));
@@ -646,7 +646,7 @@ static int _testNonExportableNvmAccess(whClientContext* client)
646646
wh_Client_NvmDestroyObjects(client, 1, &nvmId, &out_rc);
647647
#endif /* WOLFHSM_CFG_DMA */
648648

649-
WH_TEST_DEBUG_PRINT("NON-EXPORTABLE NVM ACCESS TEST SUCCESS\n");
649+
WH_TEST_PRINT("NON-EXPORTABLE NVM ACCESS TEST SUCCESS\n");
650650
return 0;
651651
}
652652
#endif /* WOLFHSM_CFG_ENABLE_CLIENT */
@@ -1933,29 +1933,29 @@ static int wh_ClientServer_PosixMemMapThreadTest(whTestNvmBackendType nvmType)
19331933
#if defined(WOLFHSM_CFG_ENABLE_CLIENT) && defined(WOLFHSM_CFG_ENABLE_SERVER)
19341934
int whTest_ClientServer(void)
19351935
{
1936-
WH_TEST_DEBUG_PRINT("Testing client/server sequential: mem...\n");
1936+
WH_TEST_PRINT("Testing client/server sequential: mem...\n");
19371937
WH_TEST_ASSERT(0 == whTest_ClientServerSequential(WH_NVM_TEST_BACKEND_FLASH));
19381938

19391939
#if defined(WOLFHSM_CFG_SERVER_NVM_FLASH_LOG)
1940-
WH_TEST_DEBUG_PRINT("Testing client/server sequential: mem + flash log...\n");
1940+
WH_TEST_PRINT("Testing client/server sequential: mem + flash log...\n");
19411941
WH_TEST_ASSERT(0 ==
19421942
whTest_ClientServerSequential(WH_NVM_TEST_BACKEND_FLASH_LOG));
19431943
#endif /* defined(WOLFHSM_CFG_SERVER_NVM_FLASH_LOG) */
19441944

19451945
#if defined(WOLFHSM_CFG_TEST_POSIX)
1946-
WH_TEST_DEBUG_PRINT("Testing client/server: (pthread) mem...\n");
1946+
WH_TEST_PRINT("Testing client/server: (pthread) mem...\n");
19471947
WH_TEST_ASSERT(0 == wh_ClientServer_MemThreadTest(WH_NVM_TEST_BACKEND_FLASH));
19481948

1949-
WH_TEST_DEBUG_PRINT("Testing client/server: (pthread) POSIX shared memory ...\n");
1949+
WH_TEST_PRINT("Testing client/server: (pthread) POSIX shared memory ...\n");
19501950
WH_TEST_ASSERT(
19511951
0 == wh_ClientServer_PosixMemMapThreadTest(WH_NVM_TEST_BACKEND_FLASH));
19521952

19531953
#if defined(WOLFHSM_CFG_SERVER_NVM_FLASH_LOG)
1954-
WH_TEST_DEBUG_PRINT("Testing client/server: (pthread) mem + flash log...\n");
1954+
WH_TEST_PRINT("Testing client/server: (pthread) mem + flash log...\n");
19551955
WH_TEST_ASSERT(0 ==
19561956
wh_ClientServer_MemThreadTest(WH_NVM_TEST_BACKEND_FLASH_LOG));
19571957

1958-
WH_TEST_DEBUG_PRINT("Testing client/server: (pthread) POSIX shared memory + flash "
1958+
WH_TEST_PRINT("Testing client/server: (pthread) POSIX shared memory + flash "
19591959
"log...\n");
19601960
WH_TEST_ASSERT(
19611961
0 == wh_ClientServer_PosixMemMapThreadTest(WH_NVM_TEST_BACKEND_FLASH_LOG));

test/wh_test_comm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,17 +477,17 @@ void wh_CommClientServer_TcpThreadTest(void)
477477
#if defined(WOLFHSM_CFG_ENABLE_CLIENT) && defined(WOLFHSM_CFG_ENABLE_SERVER)
478478
int whTest_Comm(void)
479479
{
480-
WH_TEST_DEBUG_PRINT("Testing comms: mem...\n");
480+
WH_TEST_PRINT("Testing comms: mem...\n");
481481
WH_TEST_ASSERT(0 == whTest_CommMem());
482482

483483
#if defined(WOLFHSM_CFG_TEST_POSIX)
484-
WH_TEST_DEBUG_PRINT("Testing comms: (pthread) mem...\n");
484+
WH_TEST_PRINT("Testing comms: (pthread) mem...\n");
485485
wh_CommClientServer_MemThreadTest();
486486

487-
WH_TEST_DEBUG_PRINT("Testing comms: (pthread) tcp...\n");
487+
WH_TEST_PRINT("Testing comms: (pthread) tcp...\n");
488488
wh_CommClientServer_TcpThreadTest();
489489

490-
WH_TEST_DEBUG_PRINT("Testing comms: (pthread) posix mem...\n");
490+
WH_TEST_PRINT("Testing comms: (pthread) posix mem...\n");
491491
wh_CommClientServer_ShMemThreadTest();
492492
#endif /* defined(WOLFHSM_CFG_TEST_POSIX) */
493493

test/wh_test_common.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
#define WH_TEST_SUCCESS (0)
3636
#define WH_TEST_DEFAULT_CLIENT_ID (1)
3737

38+
/* Test-specific print macro that always prints (replacement for printf in tests)
39+
* This internally uses WOLFHSM_CFG_PRINTF for consistency */
40+
#if !defined(__CCRH__)
41+
#define WH_TEST_PRINT(fmt, ...) \
42+
WOLFHSM_CFG_PRINTF(fmt, ##__VA_ARGS__)
43+
#else
44+
#define WH_TEST_PRINT(...) WH_TEST_PRINT2(__VA_ARGS__, "")
45+
#define WH_TEST_PRINT2(fmt, ...) \
46+
WOLFHSM_CFG_PRINTF(fmt, ##__VA_ARGS__)
47+
#endif
48+
3849
/* Test-specific debug print with function and line info
3950
* This internally uses WOLFHSM_CFG_PRINTF for consistency */
4051
#ifdef WOLFHSM_CFG_TEST_VERBOSE

0 commit comments

Comments
 (0)