Skip to content

Commit 28bc338

Browse files
committed
[nrf fromlist] tests: drivers: clock_control: Move test configuration to Kconfig
Improve nrf_clock_control test suite. Instead of selecting tests based on CONFIG_SOC_xxx symbols, define Kconfigs. Added Kconfigs get value from SOC symbols (or can be set with board overlay). Add indication that test case was skipped. Upstream PR #: 109137 Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
1 parent f5ac77b commit 28bc338

2 files changed

Lines changed: 81 additions & 7 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2026 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config TEST_FLL16M
5+
bool "Run test on the FLL16M"
6+
default y if SOC_NRF54H20_CPUAPP
7+
help
8+
When set to 'y' tests of FLL16M are executed.
9+
10+
config TEST_HSFLL_APP
11+
bool "Run test on the HSFLL APP"
12+
default y if SOC_NRF54H20_CPUAPP
13+
help
14+
When set to 'y' tests of HSFLL APP are executed.
15+
16+
config TEST_HSFLL_RAD
17+
bool "Run test on the HSFLL RAD"
18+
default y if SOC_NRF54H20_CPURAD
19+
help
20+
When set to 'y' tests of HSFLL RAD are executed.
21+
22+
config TEST_DVFS_INIT
23+
bool "Check DVFS initialization"
24+
default y if SOC_NRF54H20_CPUAPP
25+
help
26+
When set to 'y' DVFS is initialised at the beginning of the test suite.
27+
28+
source "Kconfig.zephyr"

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

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const struct nrf_clock_spec test_clk_specs_hsfll[] = {
3838
};
3939
#endif
4040

41-
#if CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP
41+
#if defined(CONFIG_TEST_FLL16M)
4242
const struct nrf_clock_spec test_clk_specs_fll16m[] = {
4343
{
4444
.frequency = MHZ(16),
@@ -85,15 +85,19 @@ static const struct test_clk_context invalid_fll16m_test_clk_contexts[] = {
8585
.clk_specs_size = ARRAY_SIZE(invalid_test_clk_specs_fll16m),
8686
},
8787
};
88+
#endif
8889

90+
#if defined(CONFIG_TEST_HSFLL_APP)
8991
static const struct test_clk_context cpuapp_hsfll_test_clk_contexts[] = {
9092
{
9193
.clk_dev = DEVICE_DT_GET(DT_NODELABEL(cpuapp_hsfll)),
9294
.clk_specs = test_clk_specs_hsfll,
9395
.clk_specs_size = ARRAY_SIZE(test_clk_specs_hsfll),
9496
},
9597
};
96-
#elif defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD)
98+
#endif
99+
100+
#if defined(CONFIG_TEST_HSFLL_RAD)
97101
static const struct test_clk_context cpurad_hsfll_test_clk_contexts[] = {
98102
{
99103
.clk_dev = DEVICE_DT_GET(DT_NODELABEL(cpurad_hsfll)),
@@ -273,14 +277,21 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex
273277
}
274278
}
275279

276-
#if CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP
280+
#if defined(CONFIG_TEST_HSFLL_APP)
277281
ZTEST(nrf2_clock_control, test_cpuapp_hsfll_control)
278282
{
279283
TC_PRINT("APPLICATION DOMAIN HSFLL test\n");
280284
test_clock_control_request(cpuapp_hsfll_test_clk_contexts,
281285
ARRAY_SIZE(cpuapp_hsfll_test_clk_contexts));
282286
}
287+
#else
288+
ZTEST(nrf2_clock_control, test_cpuapp_hsfll_control)
289+
{
290+
ztest_test_skip();
291+
}
292+
#endif
283293

294+
#if defined(CONFIG_TEST_FLL16M)
284295
ZTEST(nrf2_clock_control, test_fll16m_control)
285296
{
286297
TC_PRINT("FLL16M test\n");
@@ -324,24 +335,44 @@ ZTEST(nrf2_clock_control, test_invalid_fll16m_clock_spec_response)
324335
}
325336
}
326337
}
327-
#elif defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPURAD)
338+
#else
339+
ZTEST(nrf2_clock_control, test_fll16m_control)
340+
{
341+
ztest_test_skip();
342+
}
343+
344+
ZTEST(nrf2_clock_control, test_invalid_fll16m_clock_spec_response)
345+
{
346+
ztest_test_skip();
347+
}
348+
#endif
349+
350+
#if defined(CONFIG_TEST_HSFLL_RAD)
328351
ZTEST(nrf2_clock_control, test_cpurad_hsfll_control)
329352
{
330353
TC_PRINT("RADIO DOMAIN HSFLL test\n");
331354
test_clock_control_request(cpurad_hsfll_test_clk_contexts,
332355
ARRAY_SIZE(cpurad_hsfll_test_clk_contexts));
333356
}
357+
#else
358+
ZTEST(nrf2_clock_control, test_cpurad_hsfll_control)
359+
{
360+
ztest_test_skip();
361+
}
334362
#endif
335363

336-
337-
338364
#if defined(CONFIG_CLOCK_CONTROL_NRF_HSFLL_GLOBAL)
339365
ZTEST(nrf2_clock_control, test_global_hsfll_control)
340366
{
341367
TC_PRINT("Global HSFLL test\n");
342368
test_clock_control_request(global_hsfll_test_clk_contexts,
343369
ARRAY_SIZE(global_hsfll_test_clk_contexts));
344370
}
371+
#else
372+
ZTEST(nrf2_clock_control, test_global_hsfll_control)
373+
{
374+
ztest_test_skip();
375+
}
345376
#endif
346377

347378
#if defined(CONFIG_CLOCK_CONTROL_NRF_LFCLK)
@@ -375,6 +406,16 @@ ZTEST(nrf2_clock_control, test_safe_request_cancellation)
375406
TC_PRINT("Clock control safe cancellation return value: %d\n", ret);
376407
zassert_between_inclusive(ret, ONOFF_STATE_ON, ONOFF_STATE_TO_ON);
377408
}
409+
#else
410+
ZTEST(nrf2_clock_control, test_lfclk_control)
411+
{
412+
ztest_test_skip();
413+
}
414+
415+
ZTEST(nrf2_clock_control, test_safe_request_cancellation)
416+
{
417+
ztest_test_skip();
418+
}
378419
#endif
379420

380421
#if defined(CONFIG_CLOCK_CONTROL_NRF_AUXPLL)
@@ -384,11 +425,16 @@ ZTEST(nrf2_clock_control, test_auxpll_control)
384425
test_clock_control_request(auxpll_test_clk_contexts,
385426
ARRAY_SIZE(auxpll_test_clk_contexts));
386427
}
428+
#else
429+
ZTEST(nrf2_clock_control, test_auxpll_control)
430+
{
431+
ztest_test_skip();
432+
}
387433
#endif
388434

389435
static void *setup(void)
390436
{
391-
#if defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP)
437+
#if defined(CONFIG_TEST_DVFS_INIT)
392438
const struct device *clk_dev = DEVICE_DT_GET(DT_NODELABEL(cpuapp_hsfll));
393439
const struct nrf_clock_spec clk_spec = {
394440
.frequency = MHZ(64),

0 commit comments

Comments
 (0)