tests: Standardized used of the ISA constants tags

Change-Id: I4a3966168a1d159bf4ac4cc3148e9c7a43c880e3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38278
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Bobby R. Bruce
2020-12-03 12:24:48 -08:00
parent 0ed320747f
commit 9e03d3bb5d
12 changed files with 61 additions and 54 deletions

View File

@@ -83,7 +83,7 @@ def asm_test(test, #The full path of the test
gem5_args = gem5_args,
config = config_file,
config_args = config_args,
valid_isas = ('RISCV',),
valid_isas = (constants.riscv_tag,),
valid_hosts = constants.supported_hosts
)

View File

@@ -46,23 +46,25 @@ from testlib import *
workloads = ('Bubblesort','FloatMM')
valid_isas = {
'x86': ('AtomicSimpleCPU', 'TimingSimpleCPU', 'DerivO3CPU'),
'arm': ('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU'),
'riscv': ('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU'),
constants.x86_tag : ('AtomicSimpleCPU', 'TimingSimpleCPU', 'DerivO3CPU'),
constants.arm_tag:
('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU'),
constants.riscv_tag:
('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU'),
}
base_path = joinpath(config.bin_path, 'cpu_tests')
base_url = config.resource_url + '/gem5/cpu_tests/benchmarks/bin/'
for isa in valid_isas:
path = joinpath(base_path, isa)
path = joinpath(base_path, isa.lower())
for workload in workloads:
ref_path = joinpath(getcwd(), 'ref', workload)
verifiers = (
verifier.MatchStdout(ref_path),
)
url = base_url + isa + '/' + workload
url = base_url + isa.lower() + '/' + workload
workload_binary = DownloadedProgram(url, path, workload)
binary = joinpath(workload_binary.path, workload)
@@ -72,6 +74,6 @@ for isa in valid_isas:
verifiers=verifiers,
config=joinpath(getcwd(), 'run.py'),
config_args=['--cpu={}'.format(cpu), binary],
valid_isas=(isa.upper(),),
valid_isas=(isa,),
fixtures=[workload_binary]
)

View File

@@ -36,7 +36,7 @@ gem5_verify_config(
verifiers=verifiers,
config=joinpath(config.base_dir, 'configs', 'dram','low_power_sweep.py'),
config_args=['-p', 'close_adaptive', '-r', '2'],
valid_isas=('NULL',),
valid_isas=(constants.null_tag,),
valid_hosts=constants.supported_hosts,
)
@@ -46,6 +46,6 @@ gem5_verify_config(
verifiers=verifiers,
config=joinpath(config.base_dir, 'configs', 'dram','low_power_sweep.py'),
config_args=['-p', 'open_adaptive', '-r', '2'],
valid_isas=('NULL',),
valid_isas=(constants.null_tag,),
valid_hosts=constants.supported_hosts,
)

View File

@@ -45,41 +45,42 @@ Test file for the util m5 exit assembly instruction.
from testlib import *
static_progs = {
'x86': ('hello64-static', 'hello32-static'),
'arm': ('hello64-static', 'hello32-static'),
'mips': ('hello',),
'riscv': ('hello',),
'sparc': ('hello',)
constants.x86_tag : ('hello64-static', 'hello32-static'),
constants.arm_tag : ('hello64-static', 'hello32-static'),
constants.mips_tag : ('hello',),
constants.riscv_tag : ('hello',),
constants.sparc_tag : ('hello',)
}
dynamic_progs = {
'x86': ('hello64-dynamic',)
constants.x86_tag : ('hello64-dynamic',)
}
cpu_types = {
'x86': ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU'),
'arm' : ('TimingSimpleCPU', 'AtomicSimpleCPU','DerivO3CPU'),
'mips' : ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU'),
'riscv' : ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU', 'MinorCPU'),
'sparc' : ('TimingSimpleCPU', 'AtomicSimpleCPU')
constants.x86_tag : ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU'),
constants.arm_tag : ('TimingSimpleCPU', 'AtomicSimpleCPU','DerivO3CPU'),
constants.mips_tag : ('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU'),
constants.riscv_tag :
('TimingSimpleCPU', 'AtomicSimpleCPU', 'DerivO3CPU', 'MinorCPU'),
constants.sparc_tag : ('TimingSimpleCPU', 'AtomicSimpleCPU')
}
supported_os = {
'x86': ('linux',),
'arm' : ('linux',),
'mips' : ('linux',),
'riscv' : ('linux',),
'sparc' : ('linux',)
constants.x86_tag : ('linux',),
constants.arm_tag : ('linux',),
constants.mips_tag : ('linux',),
constants.riscv_tag : ('linux',),
constants.sparc_tag : ('linux',)
}
# We only want to test x86, arm, and riscv on quick. Mips and sparc will be
# left for long.
os_length = {
'x86': constants.quick_tag,
'arm' : constants.quick_tag,
'mips' : constants.long_tag,
'riscv' : constants.quick_tag,
'sparc' : constants.long_tag,
constants.x86_tag : constants.quick_tag,
constants.arm_tag : constants.quick_tag,
constants.mips_tag : constants.long_tag,
constants.riscv_tag : constants.quick_tag,
constants.sparc_tag : constants.long_tag,
}
base_path = joinpath(config.bin_path, 'hello')
@@ -92,8 +93,8 @@ verifiers = (
)
def verify_config(isa, binary, operating_s, cpu, hosts):
url = urlbase + isa + '/' + operating_s + '/' + binary
path = joinpath(base_path, isa, operating_s)
url = urlbase + isa.lower() + '/' + operating_s + '/' + binary
path = joinpath(base_path, isa.lower(), operating_s)
hello_program = DownloadedProgram(url, path, binary)
gem5_verify_config(
@@ -103,7 +104,7 @@ def verify_config(isa, binary, operating_s, cpu, hosts):
config=joinpath(config.base_dir, 'configs', 'example','se.py'),
config_args=['--cmd', joinpath(path, binary), '--cpu-type', cpu,
'--caches'],
valid_isas=(isa.upper(),),
valid_isas=(isa,),
valid_hosts=hosts,
length = os_length[isa],
)
@@ -122,4 +123,4 @@ for isa in dynamic_progs:
for operating_s in supported_os[isa]:
for cpu in cpu_types[isa]:
verify_config(isa, binary, operating_s, cpu,
constants.target_host[isa.upper()])
constants.target_host[isa])

View File

@@ -30,15 +30,15 @@ Test file for the insttest binary running on the SPARC ISA
from testlib import *
test_progs = {
'sparc': ('insttest',)
constants.sparc_tag : ('insttest',)
}
cpu_types = {
'sparc' : ('AtomicSimpleCPU', 'TimingSimpleCPU')
constants.sparc_tag : ('AtomicSimpleCPU', 'TimingSimpleCPU')
}
supported_os = {
'sparc' : ('linux',)
constants.sparc_tag : ('linux',)
}
base_path = joinpath(config.bin_path, 'insttest')
@@ -48,15 +48,17 @@ for isa in test_progs:
for binary in test_progs[isa]:
for operating_s in supported_os[isa]:
import os
url = urlbase + isa + '/' + operating_s + '/' + binary
path = joinpath(base_path, isa, operating_s, binary)
url = urlbase + isa.lower() + '/' + operating_s + '/' + binary
path = joinpath(base_path, isa.lower(), operating_s, binary)
try:
program = DownloadedProgram(url, path, binary)
except:
continue
ref_path = joinpath(getcwd(), 'ref', isa, operating_s, binary)
ref_path = joinpath(
getcwd(), 'ref', isa.lower(), operating_s, binary
)
verifiers = (
verifier.MatchStdoutNoPerf(joinpath(ref_path, 'simout')),
)
@@ -71,6 +73,6 @@ for isa in test_progs:
'example','se.py'),
config_args=['--cmd', joinpath(path, binary),
'--cpu-type', cpu, '--caches'],
valid_isas=(isa.upper(),),
valid_isas=(isa,),
length = constants.long_tag,
)

View File

@@ -35,7 +35,7 @@ gem5_verify_config(
config=joinpath(config_path, 'simple.py'),
config_args = [],
length = constants.quick_tag,
valid_isas=('X86', 'RISCV', 'ARM'),
valid_isas=(constants.x86_tag, constants.riscv_tag, constants.arm_tag),
)
# The "quick" two level tests.
@@ -45,5 +45,5 @@ gem5_verify_config(
config=joinpath(config_path, 'two_level.py'),
config_args = [],
length = constants.quick_tag,
valid_isas=('X86', 'RISCV', 'ARM'),
valid_isas=(constants.x86_tag, constants.riscv_tag, constants.arm_tag),
)

View File

@@ -35,7 +35,7 @@ gem5_verify_config(
verifiers = (get_verifier('simple'),),
config=joinpath(config_path, 'run_simple.py'),
config_args = [],
valid_isas=("NULL",),
valid_isas=(constants.null_tag,),
)
gem5_verify_config(
@@ -43,7 +43,7 @@ gem5_verify_config(
verifiers =(get_verifier('hello_goodbye'),),
config=joinpath(config_path, 'hello_goodbye.py'),
config_args = [],
valid_isas=("NULL",),
valid_isas=(constants.null_tag,),
)
gem5_verify_config(
@@ -51,7 +51,8 @@ gem5_verify_config(
verifiers =(verifier.MatchStdoutNoPerf(joinpath(ref_path, 'hello')),),
config=joinpath(config_path, 'simple_memobj.py'),
config_args = [],
valid_isas=("X86",), # note: by default the above script uses x86
# note: by default the above script uses x86
valid_isas=(constants.x86_tag,),
)
gem5_verify_config(
@@ -59,7 +60,8 @@ gem5_verify_config(
verifiers =(verifier.MatchStdoutNoPerf(joinpath(ref_path, 'hello')),),
config=joinpath(config_path, 'simple_cache.py'),
config_args = [],
valid_isas=("X86",), # note: by default the above script uses x86
# note: by default the above script uses x86
valid_isas=(constants.x86_tag,),
)
# Note: for simple memobj and simple cache I want to use the traffic generator

View File

@@ -39,8 +39,8 @@ gem5_verify_config(
config=joinpath(config_path, 'simple_ruby.py'),
config_args = [],
protocol = 'MSI',
valid_isas=("X86",), # Currently only x86 has the threads test
valid_hosts=constants.target_host["X86"], # dynamically linked
valid_isas=(constants.x86_tag,), # Currently only x86 has the threads test
valid_hosts=constants.target_host[constants.x86_tag], # dynamically linked
)
gem5_verify_config(
@@ -49,5 +49,5 @@ gem5_verify_config(
config=joinpath(config_path, 'ruby_test.py'),
config_args = [],
protocol = 'MSI',
valid_isas=("X86",), # Currently only x86 has the threads test
valid_isas=(constants.x86_tag,), # Currently only x86 has the threads test
)

View File

@@ -59,5 +59,5 @@ gem5_verify_config(
fixtures=(test_program,),
config=os.path.join(config.base_dir, 'configs', 'example','se.py'),
config_args=['--cmd', joinpath(test_program.path, filename)],
valid_isas=('X86',)
valid_isas=(constants.x86_tag,)
)

View File

@@ -57,7 +57,7 @@ for cpu in cpu_types:
config_args=['--cpu-type', cpu,
'--num-cores', '8',
'--cmd', joinpath(base_path, binary)],
valid_isas=('SPARC',),
valid_isas=(constants.sparc_tag,),
valid_hosts=constants.supported_hosts,
length = constants.long_tag,
)

View File

@@ -85,6 +85,6 @@ for basename_noext, args in null_tests:
config=joinpath(config.base_dir, 'configs',
'example', basename_noext + '.py'),
config_args=args,
valid_isas=('NULL',),
valid_isas=(constants.null_tag,),
valid_hosts=constants.supported_hosts,
)

View File

@@ -60,7 +60,7 @@ def test_boot(cpu_type, num_cpus, boot_type, host):
'--num-cpus', num_cpus,
'--boot-type', boot_type,
],
valid_isas = ('X86',),
valid_isas = (constants.x86_tag,),
valid_hosts = host,
length = constants.long_tag,
)