configs,stdlib,tests: Update riscvmatched-fs.py to-init

The "test-gem5-library-example-riscvmatched-fs" test, which runs
"configs/example/gem5_library/riscvmatched-fs.py", was running the
script in full. This takes a very long time. Given we already have boot
tests for RISCV, it's better to just run this configuration to just the
end of the Linux boot (significantly faster than a full OS boot). This
patch adds this feature to the config script and modifies the test to
utilize it.

Change-Id: I1e37a26aab5e9a127ebd64590be79fbc16fe53aa
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65853
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2022-11-21 11:57:40 -08:00
committed by Bobby Bruce
parent 36f2964d19
commit 5794643e44
2 changed files with 26 additions and 2 deletions

View File

@@ -44,8 +44,23 @@ from gem5.isas import ISA
from gem5.simulate.simulator import Simulator
from gem5.resources.workload import Workload
import argparse
requires(isa_required=ISA.RISCV)
parser = argparse.ArgumentParser(
description="A script which uses the RISCVMatchedBoard in FS mode."
)
parser.add_argument(
"-i",
"--to-init",
action="store_true",
help="Exit the simulation after the Linux Kernel boot.",
)
args = parser.parse_args()
# instantiate the riscv matched board with default parameters
board = RISCVMatchedBoard(
clk_freq="1.2GHz",
@@ -57,7 +72,16 @@ board = RISCVMatchedBoard(
# Ubuntu 20.04. Once the system successfully boots it encounters an `m5_exit`
# instruction which stops the simulation. When the simulation has ended you may
# inspect `m5out/system.pc.com_1.device` to see the stdout.
board.set_workload(Workload("riscv-ubuntu-20.04-boot"))
#
# In the case where the `-i` flag is passed, we add the kernel argument
# `init=/root/exit.sh`. This means the simulation will exit after the Linux
# Kernel has booted.
workload = Workload("riscv-ubuntu-20.04-boot")
kernel_args = board.get_default_kernel_args()
if args.to_init:
kernel_args.append("init=/root/exit.sh")
workload.set_parameter("kernel_args", kernel_args)
board.set_workload(workload)
simulator = Simulator(board=board)
simulator.run()

View File

@@ -319,7 +319,7 @@ gem5_verify_config(
"gem5_library",
"riscvmatched-fs.py",
),
config_args=[],
config_args=["--to-init"],
valid_isas=(constants.riscv_tag,),
valid_hosts=constants.supported_hosts,
length=constants.very_long_tag,