tests: clock_control: nrf_onoff_and_bt: Add clearing of test_end

This flag needs to be cleared at the beginning of each test. Otherwise,
when the flag remains set after the previous test, the timer handler is
not rescheduled so executing of the current test is actually pointless.

This was in fact the case with `test_bt_interrupted` before switching
the test suite to the new ZTEST API. When this test was executed as
the second one, the timer handler was called only once and the test
could pass (giving false confirmation that the related routines of
the clock_control_nrf driver work properly). After the API switching,
the order of test execution was changed and that test started failing.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2022-11-21 15:09:00 +01:00 committed by Carles Cufí
commit a4f063ec49

View file

@ -103,6 +103,7 @@ ZTEST(nrf_onoff_and_bt, test_onoff_interrupted)
int backoff;
iteration = 0;
test_end = false;
k_timer_start(&timer1, K_MSEC(1), K_NO_WAIT);
@ -190,6 +191,7 @@ ZTEST(nrf_onoff_and_bt, test_bt_interrupted)
int backoff;
iteration = 0;
test_end = false;
k_timer_start(&timer2, K_MSEC(1), K_NO_WAIT);