Skip to content

Commit 009201e

Browse files
ananglkartben
authored andcommitted
tests: driver: nrf_clock_control: Verify that clocks are ready
Ensure that a given clock controller is ready before making requests to it. Otherwise, if for some reason the clock controller fails to initialize (for example, when BICR turns out to be not populated with required values), the test may end up with an enigmatic bus fault. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
1 parent 355a552 commit 009201e

File tree

1 file changed

+9
-1
lines changed
  • tests/drivers/clock_control/nrf_clock_control/src

1 file changed

+9
-1
lines changed

tests/drivers/clock_control/nrf_clock_control/src/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex
199199
clk_dev = clk_context->clk_dev;
200200
clk_spec = &clk_context->clk_specs[u];
201201

202+
zassert_true(device_is_ready(clk_dev),
203+
"%s is not ready", clk_dev->name);
204+
202205
TC_PRINT("Applying clock (%s) spec: frequency %d, accuracy %d, precision "
203206
"%d\n",
204207
clk_dev->name, clk_spec->frequency, clk_spec->accuracy,
@@ -211,7 +214,6 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex
211214
#if CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP
212215
ZTEST(nrf2_clock_control, test_cpuapp_hsfll_control)
213216
{
214-
215217
TC_PRINT("APPLICATION DOMAIN HSFLL test\n");
216218
/* Wait for the DVFS init to complete */
217219
k_msleep(3000);
@@ -245,6 +247,9 @@ ZTEST(nrf2_clock_control, test_invalid_fll16m_clock_spec_response)
245247
clk_dev = clk_context->clk_dev;
246248
clk_spec = &clk_context->clk_specs[u];
247249

250+
zassert_true(device_is_ready(clk_dev),
251+
"%s is not ready", clk_dev->name);
252+
248253
TC_PRINT("Applying clock (%s) spec: frequency %d, accuracy %d, precision "
249254
"%d\n",
250255
clk_dev->name, clk_spec->frequency, clk_spec->accuracy,
@@ -290,6 +295,9 @@ ZTEST(nrf2_clock_control, test_safe_request_cancellation)
290295
const struct device *clk_dev = clk_context->clk_dev;
291296
const struct nrf_clock_spec *clk_spec = &test_clk_specs_lfclk[0];
292297

298+
zassert_true(device_is_ready(clk_dev),
299+
"%s is not ready", clk_dev->name);
300+
293301
TC_PRINT("Safe clock request cancellation\n");
294302
TC_PRINT("Clock under test: %s\n", clk_dev->name);
295303
sys_notify_init_spinwait(&cli.notify);

0 commit comments

Comments
 (0)