Skip to content

Commit

Permalink
tests: subsys: edac: move ibecc to new ztest API
Browse files Browse the repository at this point in the history
move ibecc to new ztest API.

Signed-off-by: Yinfang Wang <[email protected]>
  • Loading branch information
yinfangw authored and fabiobaltieri committed Jul 21, 2022
1 parent 6087bac commit 8a5bf76
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions tests/subsys/edac/ibecc/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ CONFIG_ZTEST=y
CONFIG_EDAC=y
CONFIG_EDAC_IBECC=y
CONFIG_LOG=y
CONFIG_ZTEST_NEW_API=y
2 changes: 1 addition & 1 deletion tests/subsys/edac/ibecc/src/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEVICE_DEFINE(dummy_edac, "dummy_edac", edac_dummy_init, NULL,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&edac_dummy_api);

void test_edac_dummy_api(void)
ZTEST(ibecc, test_edac_dummy_api)
{
const struct device *dev = device_get_binding("dummy_edac");
uint64_t value;
Expand Down
24 changes: 11 additions & 13 deletions tests/subsys/edac/ibecc/src/ibecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define DURATION 100
#endif

static void test_ibecc_initialized(void)
ZTEST(ibecc, test_ibecc_initialized)
{
const struct device *dev;

Expand Down Expand Up @@ -310,9 +310,7 @@ static void test_ibecc_error_inject_test_uc(void)
}
#endif

void test_edac_dummy_api(void);

void test_main(void)
void ibecc_before(void *data)
{
#if defined(CONFIG_USERSPACE)
int ret = k_mem_domain_add_partition(&k_mem_domain_default,
Expand All @@ -322,14 +320,14 @@ void test_main(void)
k_oops();
}
#endif
}

ztest_test_suite(ibecc,
ztest_unit_test(test_ibecc_initialized),
ztest_unit_test(test_ibecc_api),
ztest_unit_test(test_edac_dummy_api),
ztest_unit_test(test_ibecc_error_inject_api),
ztest_unit_test(test_ibecc_error_inject_test_cor),
ztest_unit_test(test_ibecc_error_inject_test_uc)
);
ztest_run_test_suite(ibecc);
ZTEST(ibecc, ibecc_injection)
{
test_ibecc_api();
test_ibecc_error_inject_api();
test_ibecc_error_inject_test_cor();
test_ibecc_error_inject_test_uc();
}

ZTEST_SUITE(ibecc, NULL, NULL, ibecc_before, NULL, NULL);

0 comments on commit 8a5bf76

Please sign in to comment.