Skip to content

Commit 94a4536

Browse files
committed
test: generalize whTest_NvmFlashCfg
1 parent 6c29f75 commit 94a4536

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/wh_test_nvm_flash.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static void _ShowList(const whNvmCb* cb, void* context)
153153

154154

155155
static int addObjectWithReadBackCheck(const whNvmCb* cb,
156-
whNvmFlashContext* context,
156+
void* context,
157157
whNvmMetadata* meta, whNvmSize data_len,
158158
const uint8_t* data)
159159

@@ -313,10 +313,8 @@ int whTest_Flash(const whFlashCb* fcb, void* fctx, const void* cfg)
313313
return 0;
314314
}
315315

316-
int whTest_NvmFlashCfg(whNvmFlashConfig* cfg)
316+
int whTest_NvmFlashCfg(void* cfg, void* context, const whNvmCb *cb)
317317
{
318-
const whNvmCb cb[1] = {WH_NVM_FLASH_CB};
319-
whNvmFlashContext context[1] = {0};
320318
int ret = 0;
321319

322320
WH_TEST_RETURN_ON_FAIL(cb->Init(context, cfg));
@@ -492,9 +490,10 @@ int whTest_NvmFlash_RamSim(void)
492490
.context = myHalFlashCtx,
493491
.config = myHalFlashCfg,
494492
};
493+
whNvmFlashContext nvmFlashCtx[1] = {0};
494+
const whNvmCb nvmFlashCb[1] = {WH_NVM_FLASH_CB};
495495

496-
497-
return whTest_NvmFlashCfg(&myNvmCfg);
496+
return whTest_NvmFlashCfg(&myNvmCfg, nvmFlashCtx, nvmFlashCb);
498497
}
499498

500499

@@ -520,8 +519,10 @@ int whTest_NvmFlash_PosixFileSim(void)
520519
.context = myHalFlashContext,
521520
.config = myHalFlashConfig,
522521
};
522+
whNvmFlashContext nvmFlashCtx[1] = {0};
523+
const whNvmCb nvmFlashCb[1] = {WH_NVM_FLASH_CB};
523524

524-
WH_TEST_ASSERT(0 == whTest_NvmFlashCfg(&myNvmCfg));
525+
WH_TEST_ASSERT(0 == whTest_NvmFlashCfg(&myNvmCfg, nvmFlashCtx, nvmFlashCb));
525526

526527
/* Remove the configured file on success*/
527528
unlink(myHalFlashConfig[0].filename);

0 commit comments

Comments
 (0)