Skip to content

Commit a3172f4

Browse files
committed
[bazel] Move manual_test to //rules/opentitan
Signed-off-by: James Wainwright <[email protected]> (cherry picked from commit c04dbf5)
1 parent 11a31d1 commit a3172f4

File tree

4 files changed

+57
-42
lines changed

4 files changed

+57
-42
lines changed

rules/opentitan/defs.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ load(
3131
_spx_key_by_name = "spx_key_by_name",
3232
_spx_key_for_lc_state = "spx_key_for_lc_state",
3333
)
34+
load(
35+
"@lowrisc_opentitan//rules/opentitan:manual.bzl",
36+
_opentitan_manual_test = "opentitan_manual_test",
37+
)
3438
load(
3539
"@lowrisc_opentitan//rules/opentitan:silicon.bzl",
3640
_silicon = "silicon",
@@ -101,6 +105,8 @@ rsa_key_by_name = _rsa_key_by_name
101105
spx_key_for_lc_state = _spx_key_for_lc_state
102106
spx_key_by_name = _spx_key_by_name
103107

108+
opentitan_manual_test = _opentitan_manual_test
109+
104110
# The default set of test environments for Earlgrey.
105111
EARLGREY_TEST_ENVS = {
106112
"//hw/top_earlgrey:fpga_cw310_sival_rom_ext": None,

rules/opentitan/manual.bzl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright lowRISC contributors (OpenTitan project).
2+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
def _opentitan_manual_test_impl(ctx):
6+
executable = ctx.actions.declare_file("manual_test_wrapper")
7+
ctx.actions.write(
8+
output = executable,
9+
content = "{runner} {testplan}".format(
10+
runner = ctx.executable._runner.short_path,
11+
testplan = ctx.file.testplan.short_path,
12+
),
13+
)
14+
return [
15+
DefaultInfo(
16+
runfiles = ctx.runfiles(
17+
files = [
18+
ctx.executable._runner,
19+
ctx.file.testplan,
20+
],
21+
).merge(ctx.attr._runner[DefaultInfo].default_runfiles),
22+
executable = executable,
23+
),
24+
]
25+
26+
opentitan_manual_test = rule(
27+
_opentitan_manual_test_impl,
28+
attrs = {
29+
"testplan": attr.label(
30+
allow_single_file = [".hjson"],
31+
doc = "Testplan with manual testpoints",
32+
mandatory = True,
33+
),
34+
"_runner": attr.label(
35+
default = "//util:run_manual_tests",
36+
executable = True,
37+
cfg = "exec",
38+
),
39+
},
40+
doc = "Walks through the manual testpoints in a testplan",
41+
test = True,
42+
)

rules/opentitan_test.bzl

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -671,42 +671,3 @@ def opentitan_functest(
671671
# For more see https://bazel.build/reference/be/general#test_suite.tags
672672
],
673673
)
674-
675-
def _manual_test_impl(ctx):
676-
executable = ctx.actions.declare_file("manual_test_wrapper")
677-
ctx.actions.write(
678-
output = executable,
679-
content = "{runner} {testplan}".format(
680-
runner = ctx.executable._runner.short_path,
681-
testplan = ctx.file.testplan.short_path,
682-
),
683-
)
684-
return [
685-
DefaultInfo(
686-
runfiles = ctx.runfiles(
687-
files = [
688-
ctx.executable._runner,
689-
ctx.file.testplan,
690-
],
691-
).merge(ctx.attr._runner[DefaultInfo].default_runfiles),
692-
executable = executable,
693-
),
694-
]
695-
696-
manual_test = rule(
697-
_manual_test_impl,
698-
attrs = {
699-
"testplan": attr.label(
700-
allow_single_file = [".hjson"],
701-
doc = "Testplan with manual testpoints",
702-
mandatory = True,
703-
),
704-
"_runner": attr.label(
705-
default = "//util:run_manual_tests",
706-
executable = True,
707-
cfg = "exec",
708-
),
709-
},
710-
doc = "Walks through the manual testpoints in a testplan",
711-
test = True,
712-
)

sw/device/silicon_creator/rom/BUILD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
77
load("//rules:cross_platform.bzl", "dual_cc_library", "dual_inputs")
88
load("//rules:files.bzl", "output_groups")
99
load("//rules:linker.bzl", "ld_library")
10-
load("//rules:opentitan_test.bzl", "manual_test")
11-
load("//rules/opentitan:defs.bzl", "OPENTITAN_CPU", "fpga_params", "opentitan_binary", "opentitan_test")
10+
load(
11+
"//rules/opentitan:defs.bzl",
12+
"OPENTITAN_CPU",
13+
"fpga_params",
14+
"opentitan_binary",
15+
"opentitan_manual_test",
16+
"opentitan_test",
17+
)
1218
load("//rules/opentitan:legacy.bzl", "legacy_rom_targets")
1319

1420
package(default_visibility = ["//visibility:public"])
@@ -460,7 +466,7 @@ pkg_files(
460466
prefix = "earlgrey/rom",
461467
)
462468

463-
manual_test(
469+
opentitan_manual_test(
464470
name = "manual_test",
465471
tags = [
466472
"manual",

0 commit comments

Comments
 (0)