Skip to content

Commit e10a678

Browse files
committed
test: test nvm flash log backend
1 parent 94a4536 commit e10a678

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

test/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ else
123123
DEF += -DWOLFHSM_CFG_IS_TEST_SERVER
124124
endif
125125

126+
# Test NVM Flash Log implementation
127+
DEF += -DWOLFHSM_CFG_SERVER_NVM_FLASH_LOG
128+
126129
## Source files
127130
# Assembly source files
128131
SRC_ASM +=

test/wh_test_nvm_flash.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "wolfhsm/wh_error.h"
3232
#include "wolfhsm/wh_nvm.h"
3333
#include "wolfhsm/wh_nvm_flash.h"
34+
#include "wolfhsm/wh_nvm_flash_log.h"
3435
#include "wolfhsm/wh_flash_unit.h"
3536

3637
/* NVM simulator backends to use for testing NVM module */
@@ -493,7 +494,21 @@ int whTest_NvmFlash_RamSim(void)
493494
whNvmFlashContext nvmFlashCtx[1] = {0};
494495
const whNvmCb nvmFlashCb[1] = {WH_NVM_FLASH_CB};
495496

496-
return whTest_NvmFlashCfg(&myNvmCfg, nvmFlashCtx, nvmFlashCb);
497+
WH_TEST_RETURN_ON_FAIL(whTest_NvmFlashCfg(&myNvmCfg, nvmFlashCtx, nvmFlashCb));
498+
499+
#if defined(WOLFHSM_CFG_SERVER_NVM_FLASH_LOG)
500+
whNvmFlashLogConfig myLogCfg = {
501+
.flash_cb = myCb,
502+
.flash_ctx = myHalFlashCtx,
503+
.flash_cfg = myHalFlashCfg,
504+
};
505+
whNvmFlashLogContext nvmLogCtx[1] = {0};
506+
const whNvmCb nvmLogCb[1] = {WH_NVM_FLASH_LOG_CB};
507+
WH_TEST_RETURN_ON_FAIL(whTest_NvmFlashCfg(&myLogCfg, nvmLogCtx, nvmLogCb));
508+
#endif /* WOLFHSM_CFG_SERVER_NVM_FLASH_LOG */
509+
510+
return 0;
511+
497512
}
498513

499514

0 commit comments

Comments
 (0)