Skip to content

Commit

Permalink
tests: nrf_lf_clock_start: move to new ztest API
Browse files Browse the repository at this point in the history
test cases in tests/drivers/clock_control/nrf_lf_clock_start are
move to new ztest API

Signed-off-by: Meng xianglin <[email protected]>
  • Loading branch information
mengxianglinx authored and fabiobaltieri committed Sep 5, 2022
1 parent dae9bb4 commit 13d22e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/drivers/clock_control/nrf_lf_clock_start/prj.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y

# Disable boot banner to reduce time between clock start and test execution
CONFIG_BOOT_BANNER=n
14 changes: 5 additions & 9 deletions tests/drivers/clock_control/nrf_lf_clock_start/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void synth_check(bool on, nrf_clock_lfclk_t type)
}
}

void test_clock_check(void)
ZTEST(nrf_lf_clock_start, test_clock_check)
{
bool xtal;

Expand All @@ -66,7 +66,7 @@ void test_clock_check(void)
}
}

void test_wait_in_thread(void)
ZTEST(nrf_lf_clock_start, test_wait_in_thread)
{
nrf_clock_lfclk_t t;
bool o;
Expand All @@ -87,7 +87,7 @@ void test_wait_in_thread(void)
zassert_true((t == NRF_CLOCK_LFCLK_Xtal) && o, NULL);
}

void test_main(void)
void *test_init(void)
{
/* Do clock state read as early as possible. When RC is already running
* and XTAL has been started then LFSRCSTAT register content might be
Expand All @@ -111,10 +111,6 @@ void test_main(void)
TC_PRINT("SYSTEM_CLOCK_WAIT_FOR_STABILITY=%c\n",
IS_ENABLED(CONFIG_SYSTEM_CLOCK_WAIT_FOR_STABILITY) ?
'y' : 'n');

ztest_test_suite(test_nrf_lf_clock_start,
ztest_unit_test(test_clock_check),
ztest_unit_test(test_wait_in_thread)
);
ztest_run_test_suite(test_nrf_lf_clock_start);
return NULL;
}
ZTEST_SUITE(nrf_lf_clock_start, NULL, test_init, NULL, NULL, NULL);

0 comments on commit 13d22e0

Please sign in to comment.