From: Bobby R. Bruce Date: Thu, 3 Dec 2020 20:24:48 +0000 (-0800) Subject: tests: Standardized used of the ISA constants tags X-Git-Tag: develop-gem5-snapshot~376 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e03d3bb5dbfc2106a4407c6be3feb5838966615;p=gem5.git 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 Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/tests/gem5/asmtest/tests.py b/tests/gem5/asmtest/tests.py index 026b2304f..f267b9116 100755 --- a/tests/gem5/asmtest/tests.py +++ b/tests/gem5/asmtest/tests.py @@ -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 ) diff --git a/tests/gem5/cpu_tests/test.py b/tests/gem5/cpu_tests/test.py index 44f057489..33a9c1278 100644 --- a/tests/gem5/cpu_tests/test.py +++ b/tests/gem5/cpu_tests/test.py @@ -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] ) diff --git a/tests/gem5/dram-lowp/test_dram_lowp.py b/tests/gem5/dram-lowp/test_dram_lowp.py index 7a065f0d8..b90fca4b5 100644 --- a/tests/gem5/dram-lowp/test_dram_lowp.py +++ b/tests/gem5/dram-lowp/test_dram_lowp.py @@ -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, ) diff --git a/tests/gem5/hello_se/test_hello_se.py b/tests/gem5/hello_se/test_hello_se.py index abae3cf10..5ebdd0cd9 100644 --- a/tests/gem5/hello_se/test_hello_se.py +++ b/tests/gem5/hello_se/test_hello_se.py @@ -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]) diff --git a/tests/gem5/insttest_se/test.py b/tests/gem5/insttest_se/test.py index c58a42bf3..0d86f4781 100644 --- a/tests/gem5/insttest_se/test.py +++ b/tests/gem5/insttest_se/test.py @@ -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, ) diff --git a/tests/gem5/learning_gem5/part1_test.py b/tests/gem5/learning_gem5/part1_test.py index f8363acf6..4ca844295 100644 --- a/tests/gem5/learning_gem5/part1_test.py +++ b/tests/gem5/learning_gem5/part1_test.py @@ -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), ) diff --git a/tests/gem5/learning_gem5/part2_test.py b/tests/gem5/learning_gem5/part2_test.py index 4209a9fd9..d487f8096 100644 --- a/tests/gem5/learning_gem5/part2_test.py +++ b/tests/gem5/learning_gem5/part2_test.py @@ -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 diff --git a/tests/gem5/learning_gem5/part3_test.py b/tests/gem5/learning_gem5/part3_test.py index 9847ab7bc..e8ca35190 100644 --- a/tests/gem5/learning_gem5/part3_test.py +++ b/tests/gem5/learning_gem5/part3_test.py @@ -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 ) diff --git a/tests/gem5/m5_util/test_exit.py b/tests/gem5/m5_util/test_exit.py index 98c3fbd17..ff900b87b 100644 --- a/tests/gem5/m5_util/test_exit.py +++ b/tests/gem5/m5_util/test_exit.py @@ -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,) ) diff --git a/tests/gem5/m5threads_test_atomic/test.py b/tests/gem5/m5threads_test_atomic/test.py index 6bb4eafa4..9596d2f99 100644 --- a/tests/gem5/m5threads_test_atomic/test.py +++ b/tests/gem5/m5threads_test_atomic/test.py @@ -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, ) diff --git a/tests/gem5/memory/test.py b/tests/gem5/memory/test.py index beed08405..7b839f2fe 100644 --- a/tests/gem5/memory/test.py +++ b/tests/gem5/memory/test.py @@ -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, ) diff --git a/tests/gem5/x86-boot-tests/test_linux_boot.py b/tests/gem5/x86-boot-tests/test_linux_boot.py index 314059500..542242514 100644 --- a/tests/gem5/x86-boot-tests/test_linux_boot.py +++ b/tests/gem5/x86-boot-tests/test_linux_boot.py @@ -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, )