Skip to content

Commit

Permalink
[ci] Remove default local = True flag from OT tests
Browse files Browse the repository at this point in the history
As per https://bazel.build/reference/be/general#genrule.local, Bazel
normally runs tests with a default of `local = False`. Setting `local =
True` as we do for FPGA and Verilator tests by default forces genrule
to use the "local" spawn strategy, which disallows remote execution,
sandboxing and remote caching.

We do not use remote execution, but there is no reason for our FPGA
tests to be run without sandboxing or without using remotely cached test
results. Bazel will still respect the `cache_test_results` option, and
so use of this cache can be overridden. Any tests that need to opt out
of sandboxing features as the tests originally did can either add the
`no-sandbox` tag to remove sandboxing, or the `local` tag to replicate
the original functionality, though this will meant that these tests
cannot be remotely cached and thus must be re-run every time if there is
no result in a local cache.

For Verilator, the UART and SPI DPIs spin up terminals which currently
do not work in a sandbox environment; hence we make the same change but
by default add the `no-sandbox` tag to the Verilator test parmeters for
now.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
  • Loading branch information
AlexJones0 committed Jan 10, 2025
1 parent 8428ef0 commit 18b1c49
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions rules/opentitan/fpga.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ fpga_cw340 = rule(
def fpga_params(
tags = [],
timeout = "short",
local = True,
test_harness = None,
binaries = {},
rom = None,
Expand All @@ -236,7 +235,6 @@ def fpga_params(
Args:
tags: The test tags to apply to the test rule.
timeout: The timeout to apply to the test rule.
local: Whether to set the `local` flag on this test.
test_harness: Use an alternative test harness for this test.
binaries: Dict of binary labels to substitution parameter names.
rom: Use an alternate ROM for this test.
Expand Down Expand Up @@ -266,7 +264,7 @@ def fpga_params(
# via the "_hacky_tags" macro in "rules/opentitan/defs.bzl".
tags = ["exclusive"] + (["changes_otp"] if changes_otp else []) + tags,
timeout = timeout,
local = local,
local = False,
test_harness = test_harness,
binaries = binaries,
rom = rom,
Expand Down
4 changes: 1 addition & 3 deletions rules/opentitan/silicon.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ silicon = rule(
def silicon_params(
tags = [],
timeout = "short",
local = True,
rom_ext = None,
test_harness = None,
binaries = {},
Expand All @@ -198,7 +197,6 @@ def silicon_params(
Args:
tags: The test tags to apply to the test rule.
timeout: The timeout to apply to the test rule.
local: Whether to set the `local` flag on this test.
test_harness: Use an alternative test harness for this test.
binaries: Dict of binary labels to substitution parameter names.
rom_ext: Use an alternate ROM_EXT for this test.
Expand All @@ -213,7 +211,7 @@ def silicon_params(
return struct(
tags = ["silicon", "exclusive"] + (["changes_otp"] if changes_otp else []) + tags,
timeout = timeout,
local = local,
local = False,
test_harness = test_harness,
binaries = binaries,
rom = None,
Expand Down
3 changes: 1 addition & 2 deletions rules/opentitan/sim_dv.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ sim_dv = rule(
def dv_params(
tags = [],
timeout = "short",
local = False,
test_harness = None,
binaries = None,
rom = None,
Expand Down Expand Up @@ -199,7 +198,7 @@ def dv_params(
return struct(
tags = ["dv"] + tags,
timeout = timeout,
local = local,
local = False,
test_harness = test_harness,
binaries = binaries,
rom = rom,
Expand Down
6 changes: 2 additions & 4 deletions rules/opentitan/sim_verilator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ sim_verilator = rule(
def verilator_params(
tags = [],
timeout = "moderate",
local = True,
test_harness = None,
binaries = {},
rom = None,
Expand All @@ -177,7 +176,6 @@ def verilator_params(
Args:
tags: The test tags to apply to the test rule.
timeout: The timeout to apply to the test rule.
local: Whether to set the `local` flag on this test.
test_harness: Use an alternative test harness for this test.
binaries: Dict of binaries labels to substitution parameter names.
rom: Use an alternate ROM for this test.
Expand All @@ -190,9 +188,9 @@ def verilator_params(
struct of test parameters.
"""
return struct(
tags = ["verilator", "cpu:5"] + tags,
tags = ["verilator", "no-sandbox", "cpu:5"] + tags,
timeout = timeout,
local = local,
local = False,
test_harness = test_harness,
binaries = binaries,
rom = rom,
Expand Down

0 comments on commit 18b1c49

Please sign in to comment.