tests: extend the test_hello_se to test on print-this binary
test_hello_se.py: Added "take_params_progs" to store avaliable isa and the binary names. Added two new parameters in function "verify_config" to take verifier and input arguments for the binary. simple_binary_run.py: Added a new unrequired args called "arguments" to take input arguments for the binary. Its default value is [ ] so the "arguments = args.arguments" in the "set_se_workload" can run without inputting any args.arguments. Change-Id: Ib99dc92aa97060de5e1d34d9cac5800b82dab9e6 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61771 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -76,6 +76,15 @@ parser.add_argument(
|
||||
help="The directory in which resources will be downloaded or exist.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--arguments",
|
||||
type=str,
|
||||
action='append',
|
||||
default=[],
|
||||
required=False,
|
||||
help="The input arguments for the binary.",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Setup the system.
|
||||
@@ -96,8 +105,11 @@ motherboard = SimpleBoard(
|
||||
|
||||
# Set the workload
|
||||
binary = Resource(args.resource,
|
||||
resource_directory=args.resource_directory)
|
||||
motherboard.set_se_binary_workload(binary)
|
||||
resource_directory=args.resource_directory,)
|
||||
motherboard.set_se_binary_workload(
|
||||
binary,
|
||||
arguments=args.arguments
|
||||
)
|
||||
|
||||
# Run the simulation
|
||||
simulator = Simulator(board=motherboard)
|
||||
|
||||
@@ -69,6 +69,11 @@ static_progs = {
|
||||
constants.sparc_tag: ("sparc-hello",),
|
||||
}
|
||||
|
||||
take_params_progs = {
|
||||
constants.vega_x86_tag: ("x86-print-this",),
|
||||
constants.riscv_tag: ("riscv-print-this",),
|
||||
}
|
||||
|
||||
dynamic_progs = {constants.vega_x86_tag: ("x86-hello64-dynamic",)}
|
||||
|
||||
cpu_types = {
|
||||
@@ -100,12 +105,12 @@ regex = re.compile(r"Hello world!")
|
||||
stdout_verifier = verifier.MatchRegex(regex)
|
||||
|
||||
|
||||
def verify_config(isa, binary, cpu, hosts):
|
||||
def verify_config(isa, binary, cpu, hosts, verifier, input):
|
||||
|
||||
gem5_verify_config(
|
||||
name="test-" + binary + "-" + cpu,
|
||||
fixtures=(),
|
||||
verifiers=(stdout_verifier,),
|
||||
verifiers=(verifier,),
|
||||
config=joinpath(
|
||||
config.base_dir,
|
||||
"tests",
|
||||
@@ -119,7 +124,7 @@ def verify_config(isa, binary, cpu, hosts):
|
||||
"--resource-directory",
|
||||
resource_path,
|
||||
isa_str_map[isa],
|
||||
],
|
||||
] + input,
|
||||
valid_isas=(isa,),
|
||||
valid_hosts=hosts,
|
||||
length=os_length[isa],
|
||||
@@ -129,10 +134,41 @@ def verify_config(isa, binary, cpu, hosts):
|
||||
for isa in static_progs:
|
||||
for binary in static_progs[isa]:
|
||||
for cpu in cpu_types[isa]:
|
||||
verify_config(isa, binary, cpu, constants.supported_hosts)
|
||||
verify_config(
|
||||
isa,
|
||||
binary,
|
||||
cpu,
|
||||
constants.supported_hosts,
|
||||
stdout_verifier,
|
||||
[]
|
||||
)
|
||||
|
||||
# Run dynamically linked hello worlds
|
||||
for isa in dynamic_progs:
|
||||
for binary in dynamic_progs[isa]:
|
||||
for cpu in cpu_types[isa]:
|
||||
verify_config(isa, binary, cpu, constants.target_host[isa])
|
||||
verify_config(
|
||||
isa,
|
||||
binary,
|
||||
cpu,
|
||||
constants.target_host[isa],
|
||||
stdout_verifier,
|
||||
[]
|
||||
)
|
||||
|
||||
regex = re.compile(r"1 print this")
|
||||
stdout_verifier = verifier.MatchRegex(regex)
|
||||
|
||||
args = ["--arguments", "print this", "--arguments", "2000"]
|
||||
|
||||
for isa in take_params_progs:
|
||||
for binary in take_params_progs[isa]:
|
||||
for cpu in cpu_types[isa]:
|
||||
verify_config(
|
||||
isa,
|
||||
binary,
|
||||
cpu,
|
||||
constants.target_host[isa],
|
||||
stdout_verifier,
|
||||
args
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user