Skip to content

Commit

Permalink
[autogen,tests] Rework plic_all_irqs_test setup
Browse files Browse the repository at this point in the history
The setup is very earlgrey specific, assuming exactly 23 IRQ
peripheral. This commit changes the setup so that each test will
test 10 peripherals, except for the last test that will capture all
remaining. This ensures that we always test every peripheral, and
if the last test becomes too large than we just need to bump
NR_IRQ_PERIPH_TESTS.

This changes the name of the tests which are now numbered 0, 1, etc
instead of 0, 10, 20 which made little sense anyway.

Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Dec 6, 2024
1 parent 3c1e48c commit 4563c5f
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions sw/device/tests/autogen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ opentitan_autogen_tests(
top = "//hw/top:top_desc",
)

# Number of peripherals per test.
NR_IRQ_PERIPH_PER_TEST = 10

# Total numbers of tests (the last one will contain but remaining IRQs).
NR_IRQ_PERIPH_TESTS = 3

[
opentitan_test(
name = "plic_all_irqs_test_{}".format(min),
name = "plic_all_irqs_test_{}".format(idx),
srcs = [":autogen_plic_all_irqs_test_src"],
# For the last test, we do not specify TEST_MAX_IRQ_PERIPHERAL so
# we are sure to capture all peripherals.
copts = [
"-DTEST_MIN_IRQ_PERIPHERAL={}".format(min),
"-DTEST_MAX_IRQ_PERIPHERAL={}".format(min + 10),
],
"-DTEST_MIN_IRQ_PERIPHERAL={}".format(idx * NR_IRQ_PERIPH_PER_TEST),
] + ([
"-DTEST_MAX_IRQ_PERIPHERAL={}".format((idx + 1) * NR_IRQ_PERIPH_PER_TEST),
] if idx < NR_IRQ_PERIPH_TESTS - 1 else []),
exec_env = dicts.add(
EARLGREY_TEST_ENVS,
EARLGREY_SILICON_OWNER_ROM_EXT_ENVS,
Expand Down Expand Up @@ -65,15 +74,14 @@ opentitan_autogen_tests(
"//sw/device/lib/testing/test_framework:ottf_main",
],
)
for min in range(0, 23, 10)
for idx in range(NR_IRQ_PERIPH_TESTS)
]

test_suite(
name = "plic_all_irqs_test",
tests = [
"plic_all_irqs_test_0",
"plic_all_irqs_test_10",
"plic_all_irqs_test_20",
"plic_all_irqs_test_{}".format(idx)
for idx in range(NR_IRQ_PERIPH_TESTS)
],
)

Expand Down

0 comments on commit 4563c5f

Please sign in to comment.