Skip to content

Commit 403c28c

Browse files
nordic-baminordicjm
authored andcommitted
tests: benchmarks: Collect coverage data from multicore benchmarks
Add coverage calculation test case for each multicore idle* test Signed-off-by: Bartosz Miller <[email protected]>
1 parent a2f01a9 commit 403c28c

37 files changed

+560
-30
lines changed

tests/benchmarks/multicore/idle_adc/Kconfig.sysbuild

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
88

99
config REMOTE_BOARD
10-
string "The board used for remote target"
10+
string
11+
default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CONFIG_ADC=y
2+
CONFIG_GPIO=y
3+
4+
CONFIG_PM=y
5+
CONFIG_PM_S2RAM=n
6+
CONFIG_PM_S2RAM_CUSTOM_MARKING=n
7+
CONFIG_PM_DEVICE=y
8+
CONFIG_PM_DEVICE_RUNTIME=y
9+
CONFIG_POWEROFF=y
10+
11+
CONFIG_BOOT_BANNER=n
12+
CONFIG_ASSERT=n
13+
CONFIG_CLOCK_CONTROL=n
14+
15+
CONFIG_PRINTK=y
16+
CONFIG_LOG=n
17+
CONFIG_CONSOLE=y
18+
CONFIG_UART_CONSOLE=y
19+
20+
CONFIG_LOG_BUFFER_SIZE=16384

tests/benchmarks/multicore/idle_adc/src/main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int main(void)
3030
int err;
3131
uint16_t channel_reading[5];
3232
int16_t sample_value;
33+
int test_repetitions = 3;
3334

3435
/* Options for the sequence sampling. */
3536
const struct adc_sequence_options options = {
@@ -51,7 +52,13 @@ int main(void)
5152
err = adc_setup();
5253
__ASSERT_NO_MSG(err == 0);
5354

54-
while (1) {
55+
#if defined(CONFIG_COVERAGE)
56+
printk("Coverage analysis enabled\n");
57+
while (test_repetitions--)
58+
#else
59+
while (test_repetitions)
60+
#endif
61+
{
5562
gpio_pin_set_dt(&gpio, 1);
5663
err = adc_read(adc, &sequence);
5764
sample_value = channel_reading[0];
@@ -63,5 +70,8 @@ int main(void)
6370
__ASSERT_NO_MSG(sample_value == ADC_LOW_LEVEL);
6471
k_sleep(K_SECONDS(1));
6572
}
73+
#if defined(CONFIG_COVERAGE)
74+
printk("Coverage analysis start\n");
75+
#endif
6676
return 0;
6777
}

tests/benchmarks/multicore/idle_adc/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/benchmarks/multicore/idle_adc/testcase.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,36 @@ common:
66
- ci_tests_benchmarks_multicore
77
- adc
88
- ppk_power_measure
9+
910
tests:
1011
benchmarks.multicore.idle_adc.nrf54h20dk_cpuapp_cpurad.s2ram:
12+
filter: not CONFIG_COVERAGE
1113
harness: pytest
1214
platform_allow:
1315
- nrf54h20dk/nrf54h20/cpuapp
1416
integration_platforms:
1517
- nrf54h20dk/nrf54h20/cpuapp
1618
extra_args:
1719
- FILE_SUFFIX=s2ram
18-
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
1920
harness_config:
2021
fixture: gpio_loopback
2122
pytest_root:
2223
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_adc"
24+
25+
benchmarks.multicore.idle_adc.nrf54h20dk_cpuapp_cpurad.coverage:
26+
filter: CONFIG_COVERAGE
27+
platform_allow:
28+
- nrf54h20dk/nrf54h20/cpuapp
29+
integration_platforms:
30+
- nrf54h20dk/nrf54h20/cpuapp
31+
extra_args:
32+
- CONF_FILE=coverage.conf
33+
- SHIELD=coverage_support
34+
harness: console
35+
harness_config:
36+
fixture: gpio_loopback
37+
type: multi_line
38+
ordered: true
39+
regex:
40+
- ".*Coverage analysis enabled.*"
41+
- ".*Coverage analysis start.*"

tests/benchmarks/multicore/idle_comp/Kconfig.sysbuild

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"
88

99
config REMOTE_BOARD
10-
string "The board used for remote target"
10+
string
11+
default "$(BOARD)/nrf54h20/cpurad" if SOC_NRF54H20_CPUAPP
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CONFIG_COMPARATOR=y
2+
CONFIG_GPIO=y
3+
4+
CONFIG_PM=y
5+
CONFIG_PM_S2RAM=n
6+
CONFIG_PM_S2RAM_CUSTOM_MARKING=n
7+
CONFIG_PM_DEVICE=y
8+
CONFIG_PM_DEVICE_RUNTIME=y
9+
CONFIG_POWEROFF=y
10+
11+
CONFIG_BOOT_BANNER=n
12+
CONFIG_ASSERT=n
13+
CONFIG_CLOCK_CONTROL=n
14+
15+
CONFIG_PRINTK=y
16+
CONFIG_LOG=n
17+
CONFIG_CONSOLE=y
18+
CONFIG_UART_CONSOLE=y
19+
20+
CONFIG_LOG_BUFFER_SIZE=16384

tests/benchmarks/multicore/idle_comp/src/main.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ int main(void)
2222
{
2323

2424
int rc;
25+
int test_repetitions = 3;
2526

2627
gpio_pin_configure_dt(&test_pin, GPIO_OUTPUT_INACTIVE);
2728

@@ -34,7 +35,13 @@ int main(void)
3435
rc = comparator_set_trigger(test_dev, COMPARATOR_TRIGGER_BOTH_EDGES);
3536
__ASSERT_NO_MSG(rc == 0);
3637

37-
while (1) {
38+
#if defined(CONFIG_COVERAGE)
39+
printk("Coverage analysis enabled\n");
40+
while (test_repetitions--)
41+
#else
42+
while (test_repetitions)
43+
#endif
44+
{
3845
counter = 0;
3946
k_msleep(200);
4047
gpio_pin_set_dt(&test_pin, 1);
@@ -49,5 +56,9 @@ int main(void)
4956
pm_device_runtime_get(test_dev);
5057
k_msleep(1);
5158
}
59+
60+
#if defined(CONFIG_COVERAGE)
61+
printk("Coverage analysis start\n");
62+
#endif
5263
return 0;
5364
}

tests/benchmarks/multicore/idle_comp/sysbuild/nrf54h20dk_nrf54h20_cpurad.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/benchmarks/multicore/idle_comp/testcase.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,50 @@ common:
66
- ppk_power_measure
77
tests:
88
benchmarks.multicore.idle_comp.nrf54h20dk_cpuapp_cpurad.s2ram:
9+
filter: not CONFIG_COVERAGE
910
harness: pytest
1011
platform_allow:
1112
- nrf54h20dk/nrf54h20/cpuapp
1213
integration_platforms:
1314
- nrf54h20dk/nrf54h20/cpuapp
1415
extra_args:
1516
- FILE_SUFFIX=s2ram
16-
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
1717
- EXTRA_DTC_OVERLAY_FILE="boards/comp.overlay"
1818
harness_config:
1919
fixture: gpio_loopback
2020
pytest_root:
2121
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_comp"
2222

2323
benchmarks.multicore.idle_lpcomp.nrf54h20dk_cpuapp_cpurad.s2ram:
24+
filter: not CONFIG_COVERAGE
2425
harness: pytest
2526
platform_allow:
2627
- nrf54h20dk/nrf54h20/cpuapp
2728
integration_platforms:
2829
- nrf54h20dk/nrf54h20/cpuapp
2930
extra_args:
3031
- FILE_SUFFIX=s2ram
31-
- SB_CONF_FILE=sysbuild/nrf54h20dk_nrf54h20_cpurad.conf
3232
- EXTRA_DTC_OVERLAY_FILE="boards/lpcomp.overlay"
3333
harness_config:
3434
fixture: gpio_loopback
3535
pytest_root:
3636
- "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_power_consumption_lpcomp"
37+
38+
benchmarks.multicore.idle_lpcomp.nrf54h20dk_cpuapp_cpurad.coverage:
39+
filter: CONFIG_COVERAGE
40+
platform_allow:
41+
- nrf54h20dk/nrf54h20/cpuapp
42+
integration_platforms:
43+
- nrf54h20dk/nrf54h20/cpuapp
44+
extra_args:
45+
- EXTRA_DTC_OVERLAY_FILE="boards/lpcomp.overlay"
46+
- CONF_FILE=coverage.conf
47+
- SHIELD=coverage_support
48+
harness: console
49+
harness_config:
50+
fixture: gpio_loopback
51+
type: multi_line
52+
ordered: true
53+
regex:
54+
- ".*Coverage analysis enabled.*"
55+
- ".*Coverage analysis start.*"

0 commit comments

Comments
 (0)