tooling: pass --test_arg to test runner Signed-off-by: Chris Frantz <cfrantz@google.com>
diff --git a/target/earlgrey/tooling/opentitan_runner.bzl b/target/earlgrey/tooling/opentitan_runner.bzl index 81042bb..1744bd9 100644 --- a/target/earlgrey/tooling/opentitan_runner.bzl +++ b/target/earlgrey/tooling/opentitan_runner.bzl
@@ -111,7 +111,7 @@ output = run_script, is_executable = True, content = """#!/bin/bash -{runner} --interface {interface} {load_bitstream} {mechanism} --elf {elf} --bin {bin} {optional_args} +{runner} --interface {interface} {load_bitstream} {mechanism} --elf {elf} --bin {bin} {optional_args} "$@" """.format( runner = runner.short_path, interface = ctx.attr.interface,
diff --git a/target/earlgrey/tooling/opentitan_runner.py b/target/earlgrey/tooling/opentitan_runner.py index eedf707..9de12cc 100755 --- a/target/earlgrey/tooling/opentitan_runner.py +++ b/target/earlgrey/tooling/opentitan_runner.py
@@ -64,6 +64,7 @@ action=argparse.BooleanOptionalAction, help="load a bitstream into the FPGA board", ) + parser.add_argument( "--mechanism", type=str, @@ -82,6 +83,13 @@ help="bin file", ) parser.add_argument( + "--timestamp", + type=bool, + default=True, + action=argparse.BooleanOptionalAction, + help="Display a timestamp per line of console output", + ) + parser.add_argument( "--exit-success", type=str, default=None, @@ -174,7 +182,12 @@ def load_and_run( - image: Path, interface: str, mechanism: str, exit_success: str, exit_failure: str + image: Path, + interface: str, + mechanism: str, + exit_success: str, + exit_failure: str, + timestamp: bool, ) -> list[str]: """Prepare opentitantool arguments to load an image into a board and spawn a console.""" if interface == "verilator": @@ -211,7 +224,9 @@ else: raise Exception("unknown mechanism", mechanism) - console_command = ["console", "--timestamp"] + console_command = ["console"] + if timestamp: + console_command.append("--timestamp") if exit_success: console_command.append(f"--exit-success={exit_success}") if exit_failure: @@ -283,7 +298,12 @@ load_bitstream(args.interface) cmd = load_and_run( - args.bin, args.interface, args.mechanism, args.exit_success, args.exit_failure + args.bin, + args.interface, + args.mechanism, + args.exit_success, + args.exit_failure, + args.timestamp, ) # TODO(cfrantz): add support for the tokenized console. return_code = simple_console(cmd)