Skip to content

Commit

Permalink
[topgen] Generate top-specific tests in their outdirs
Browse files Browse the repository at this point in the history
Darjeeling's software tests only avoided overwriting the earlgrey tests
by nature of sorting earlier alphabetically. Move autogenerated tests to
the top-specific output directories. Fix up paths to match.

Signed-off-by: Alexander Williams <[email protected]>
  • Loading branch information
a-will committed Dec 27, 2024
1 parent ec1f8ad commit ff3387f
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 34 deletions.
8 changes: 4 additions & 4 deletions hw/top_earlgrey/data/ip/chip_alert_handler_testplan.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
si_stage: SV3
lc_states: ["PROD"]
tests: ["chip_sw_alert_test"]
bazel: ["//sw/device/tests/autogen:alert_test"]
bazel: ["//hw/top_earlgrey/sw/autogen/tests:alert_test"]
}
{
name: chip_sw_alert_handler_escalations
Expand Down Expand Up @@ -125,9 +125,9 @@
lc_states: ["PROD"]
tests: ["chip_plic_all_irqs_0", "chip_plic_all_irqs_10", "chip_plic_all_irqs_20"]
bazel: [
"//sw/device/tests/autogen:plic_all_irqs_test_0",
"//sw/device/tests/autogen:plic_all_irqs_test_10",
"//sw/device/tests/autogen:plic_all_irqs_test_20",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_0",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_10",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_20",
]
}
{
Expand Down
6 changes: 3 additions & 3 deletions hw/top_earlgrey/data/ip/chip_rv_plic_testplan.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"chip_plic_all_irqs_20",
]
bazel: [
"//sw/device/tests/autogen:plic_all_irqs_test_0",
"//sw/device/tests/autogen:plic_all_irqs_test_10",
"//sw/device/tests/autogen:plic_all_irqs_test_20",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_0",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_10",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_20",
]
}
{
Expand Down
8 changes: 4 additions & 4 deletions hw/top_earlgrey/dv/chip_sim_cfg.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@
{
name: chip_sw_alert_test
uvm_test_seq: chip_sw_base_vseq
sw_images: ["//sw/device/tests/autogen:alert_test:1:new_rules"]
sw_images: ["//hw/top_earlgrey/sw/autogen/tests:alert_test:1:new_rules"]
en_run_modes: ["sw_test_mode_test_rom"]
}
{
Expand Down Expand Up @@ -1718,19 +1718,19 @@
{
name: chip_plic_all_irqs_0
uvm_test_seq: chip_sw_base_vseq
sw_images: ["//sw/device/tests/autogen:plic_all_irqs_test_0:1:new_rules"]
sw_images: ["//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_0:1:new_rules"]
en_run_modes: ["sw_test_mode_test_rom"]
}
{
name: chip_plic_all_irqs_10
uvm_test_seq: chip_sw_base_vseq
sw_images: ["//sw/device/tests/autogen:plic_all_irqs_test_10:1:new_rules"]
sw_images: ["//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_10:1:new_rules"]
en_run_modes: ["sw_test_mode_test_rom"]
}
{
name: chip_plic_all_irqs_20
uvm_test_seq: chip_sw_base_vseq
sw_images: ["//sw/device/tests/autogen:plic_all_irqs_test_20:1:new_rules"]
sw_images: ["//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_20:1:new_rules"]
en_run_modes: ["sw_test_mode_test_rom"]
}
{
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions sw/device/tests/sival/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ test_suite(
test_suite(
name = "sv2_tests",
tests = [
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_0",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_10",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_20",
"//sw/device/silicon_creator/lib:otbn_boot_services_functest",
"//sw/device/tests:aes_smoketest",
"//sw/device/tests:aon_timer_irq_test",
Expand Down Expand Up @@ -63,9 +66,6 @@ test_suite(
"//sw/device/tests:sram_ctrl_smoketest",
"//sw/device/tests:uart_smoketest",
"//sw/device/tests:uart_tx_rx_test",
"//sw/device/tests/autogen:plic_all_irqs_test_0",
"//sw/device/tests/autogen:plic_all_irqs_test_10",
"//sw/device/tests/autogen:plic_all_irqs_test_20",
"//sw/device/tests/crypto:aes_kwp_functest",
"//sw/device/tests/crypto:aes_kwp_kat_functest",
"//sw/device/tests/crypto:ecdh_p256_sideload_functest",
Expand All @@ -78,6 +78,8 @@ test_suite(
test_suite(
name = "sv3_tests",
tests = [
"//hw/top_earlgrey/sw/autogen/tests:alert_test",
"//hw/top_earlgrey/sw/autogen/tests:plic_all_irqs_test_0",
"//sw/device/silicon_creator/rom/e2e:rom_e2e_smoke",
"//sw/device/tests:aes_entropy_test",
"//sw/device/tests:aes_idle_test",
Expand Down Expand Up @@ -208,8 +210,6 @@ test_suite(
"//sw/device/tests:usbdev_stream_test",
"//sw/device/tests:usbdev_test",
"//sw/device/tests:usbdev_vbus_test",
"//sw/device/tests/autogen:alert_test",
"//sw/device/tests/autogen:plic_all_irqs_test_0",
"//sw/device/tests/crypto:aes_functest",
"//sw/device/tests/crypto:aes_kwp_sideload_functest",
"//sw/device/tests/crypto:aes_sideload_functest",
Expand Down
33 changes: 16 additions & 17 deletions util/topgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,22 @@ def render_template(template_path: str, rendered_path: Path,
helper=c_helper,
gencmd=gencmd_bzl)

# Auto-generate tests in "sw/device/tests/autogen" area.
for fname in ["plic_all_irqs_test.c", "BUILD"]:
outfile = cformat_dir / "tests" / fname
render_template(TOPGEN_TEMPLATE_PATH / f"{fname}.tpl",
outfile,
helper=c_helper,
gencmd=gencmd_c)

# Render alert tests only if there is really an alert handler
if lib.find_module(completecfg['module'], 'alert_handler'):
outfile = cformat_dir / "tests" / "alert_test.c"
render_template(TOPGEN_TEMPLATE_PATH / "alert_test.c.tpl",
outfile,
helper=c_helper,
gencmd=gencmd_c)

# generate chip level xbar and alert_handler TB
tb_files = [
"xbar_env_pkg__params.sv", "tb__xbar_connect.sv",
Expand Down Expand Up @@ -1395,23 +1411,6 @@ def render_template(template_path: str, rendered_path: Path,
# generate documentation for toplevel
gen_top_docs(completecfg, c_helper, out_path)

# Auto-generate tests in "sw/device/tests/autogen" area.
gencmd = warnhdr + GENCMD.format(top_name=top_name)
for fname in ["plic_all_irqs_test.c", "BUILD"]:
outfile = SRCTREE_TOP / "sw/device/tests/autogen" / fname
render_template(TOPGEN_TEMPLATE_PATH / f"{fname}.tpl",
outfile,
helper=c_helper,
gencmd=gencmd)

# Render alert tests only if there is really an alert handler
if lib.find_module(completecfg['module'], 'alert_handler'):
outfile = SRCTREE_TOP / "sw/device/tests/autogen" / "alert_test.c"
render_template(TOPGEN_TEMPLATE_PATH / "alert_test.c.tpl",
outfile,
helper=c_helper,
gencmd=gencmd)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion util/topgen/templates/toplevel.c.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ ${helper.alert_mapping.render_definition()}
* This array is a mapping from `${helper.plic_interrupts.name.as_c_type()}` to
* `${helper.plic_sources.name.as_c_type()}`.
*/
${helper.plic_mapping.render_definition()}
${helper.plic_mapping.render_definition()}\

0 comments on commit ff3387f

Please sign in to comment.