diff --git a/rules/opentitan_test.bzl b/rules/opentitan_test.bzl index 385a7295993783..fd71f355065d8f 100644 --- a/rules/opentitan_test.bzl +++ b/rules/opentitan_test.bzl @@ -502,3 +502,42 @@ def opentitan_functest( # For more see https://bazel.build/reference/be/general#test_suite.tags ], ) + +def _manual_test_impl(ctx): + executable = ctx.actions.declare_file("manual_test_wrapper") + ctx.actions.write( + output = executable, + content = "{runner} {testplan}".format( + runner = ctx.executable._runner.short_path, + testplan = ctx.file.testplan.short_path, + ), + ) + return [ + DefaultInfo( + runfiles = ctx.runfiles( + files = [ + ctx.executable._runner, + ctx.file.testplan, + ], + ).merge(ctx.attr._runner[DefaultInfo].default_runfiles), + executable = executable, + ), + ] + +manual_test = rule( + _manual_test_impl, + attrs = { + "testplan": attr.label( + allow_single_file = [".hjson"], + doc = "Testplan with manual testpoints", + mandatory = True, + ), + "_runner": attr.label( + default = "//util:run_manual_tests", + executable = True, + cfg = "exec", + ), + }, + doc = "Walks through the manual testpoints in a testplan", + test = True, +) diff --git a/sw/device/silicon_creator/rom/BUILD b/sw/device/silicon_creator/rom/BUILD index ce2363711ab121..1f77149c494daf 100644 --- a/sw/device/silicon_creator/rom/BUILD +++ b/sw/device/silicon_creator/rom/BUILD @@ -7,6 +7,7 @@ load("//rules:exclude_files.bzl", "exclude_files") load("//rules:linker.bzl", "ld_library") load( "//rules:opentitan_test.bzl", + "manual_test", "opentitan_functest", ) load("//rules:cross_platform.bzl", "dual_cc_library", "dual_inputs") @@ -318,3 +319,12 @@ pkg_files( srcs = [":pre_package"], prefix = "earlgrey/rom", ) + +manual_test( + name = "manual", + tags = [ + "manual", + "no-cache", + ], + testplan = "//sw/device/silicon_creator/rom/data:rom_manual_testplan.hjson", +) diff --git a/sw/device/silicon_creator/rom/data/BUILD b/sw/device/silicon_creator/rom/data/BUILD new file mode 100644 index 00000000000000..41eb4dba4bc3c3 --- /dev/null +++ b/sw/device/silicon_creator/rom/data/BUILD @@ -0,0 +1,10 @@ +# Copyright lowRISC contributors. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +package(default_visibility = ["//visibility:public"]) + +exports_files([ + "rom_e2e_testplan.hjson", + "rom_manual_testplan.hjson", +]) diff --git a/util/BUILD b/util/BUILD index 7d3c2b8b7a416f..9c9351bce7fac0 100644 --- a/util/BUILD +++ b/util/BUILD @@ -65,3 +65,16 @@ py_test( "generate_compilation_db_test.py", ], ) + +py_binary( + name = "run_manual_tests", + srcs = [ + "run_manual_tests.py", + ], + deps = [ + requirement("typer"), + requirement("hjson"), + requirement("rich"), + requirement("pluralizer"), + ], +)