constants.quick_tag = 'quick'
constants.long_tag = 'long'
+ constants.host_isa_tag_type = 'host'
+ constants.host_x86_64_tag = 'x86_64'
+ constants.host_i386_tag = 'i386'
+ constants.host_arm_tag = 'aarch64'
+
constants.supported_tags = {
constants.isa_tag_type : (
constants.x86_tag,
constants.quick_tag,
constants.long_tag,
),
+ constants.host_isa_tag_type: (
+ constants.host_x86_64_tag,
+ constants.host_i386_tag,
+ constants.host_arm_tag,
+ ),
+ }
+
+ # Binding target ISA with host ISA. This is useful for the
+ # case where host ISA and target ISA need to coincide
+ constants.target_host = {
+ constants.arm_tag : (constants.host_arm_tag,),
+ constants.x86_tag : (constants.host_x86_64_tag, constants.host_i386_tag),
+ constants.sparc_tag : (constants.host_x86_64_tag, constants.host_i386_tag),
+ constants.alpha_tag : (constants.host_x86_64_tag, constants.host_i386_tag),
+ constants.riscv_tag : (constants.host_x86_64_tag, constants.host_i386_tag),
+ constants.mips_tag : (constants.host_x86_64_tag, constants.host_i386_tag),
+ constants.power_tag : (constants.host_x86_64_tag, constants.host_i386_tag),
+ constants.null_tag : (None,)
}
constants.supported_isas = constants.supported_tags['isa']
constants.supported_variants = constants.supported_tags['variant']
constants.supported_lengths = constants.supported_tags['length']
+ constants.supported_hosts = constants.supported_tags['host']
constants.tempdir_fixture_name = 'tempdir'
constants.gem5_simulation_stderr = 'simerr'
else:
return length
+ def default_host(host):
+ if not host[0]:
+ try:
+ import platform
+ host_machine = platform.machine()
+ if host_machine not in constants.supported_hosts:
+ raise ValueError("Invalid host machine")
+ return [[host_machine]]
+ except:
+ return [[constants.host_x86_64_tag]]
+ else:
+ return host
+
def compile_tag_regex(positional_tags):
if not positional_tags:
return positional_tags
config._add_post_processor('isa', default_isa)
config._add_post_processor('variant', default_variant)
config._add_post_processor('length', default_length)
+ config._add_post_processor('host', default_host)
config._add_post_processor('threads', threads_as_int)
config._add_post_processor('test_threads', test_threads_as_int)
config._add_post_processor(StorePositionalTagsAction.position_kword,
action='append',
default=[],
help="Only tests that are one of these lengths. Comma separated."),
+ Argument(
+ '--host',
+ action='append',
+ default=[],
+ help="Only tests that are meant to runnable on the selected host"),
Argument(
'--uid',
action='store',
common_args.isa.add_to(parser)
common_args.variant.add_to(parser)
common_args.length.add_to(parser)
+ common_args.host.add_to(parser)
common_args.include_tags.add_to(parser)
common_args.exclude_tags.add_to(parser)
common_args.isa.add_to(parser)
common_args.variant.add_to(parser)
common_args.length.add_to(parser)
+ common_args.host.add_to(parser)
common_args.include_tags.add_to(parser)
common_args.exclude_tags.add_to(parser)
common_args.isa.add_to(parser)
common_args.variant.add_to(parser)
common_args.length.add_to(parser)
+ common_args.host.add_to(parser)
config = _Config()
define_constants(config.constants)
special_tags = (
cfg.constants.isa_tag_type,
cfg.constants.length_tag_type,
+ cfg.constants.host_isa_tag_type,
cfg.constants.variant_tag_type
)
-test-hello-RISCV-opt
-test-hello-RISCV-debug
-test-hello-RISCV-fast
-test-hello-SPARC-opt
-test-hello-SPARC-debug
-test-hello-SPARC-fast
-test-hello-MIPS-opt
-test-hello-MIPS-debug
-test-hello-MIPS-fast
-test-hello-ALPHA-opt
-test-hello-ALPHA-debug
-test-hello-ALPHA-fast
+test-hello-RISCV-x86_64-opt
+test-hello-RISCV-x86_64-debug
+test-hello-RISCV-x86_64-fast
+test-hello-RISCV-i386-opt
+test-hello-RISCV-i386-debug
+test-hello-RISCV-i386-fast
+test-hello-RISCV-aarch64-opt
+test-hello-RISCV-aarch64-debug
+test-hello-RISCV-aarch64-fast
+test-hello-SPARC-x86_64-opt
+test-hello-SPARC-x86_64-debug
+test-hello-SPARC-x86_64-fast
+test-hello-SPARC-i386-opt
+test-hello-SPARC-i386-debug
+test-hello-SPARC-i386-fast
+test-hello-SPARC-aarch64-opt
+test-hello-SPARC-aarch64-debug
+test-hello-SPARC-aarch64-fast
+test-hello-MIPS-x86_64-opt
+test-hello-MIPS-x86_64-debug
+test-hello-MIPS-x86_64-fast
+test-hello-MIPS-i386-opt
+test-hello-MIPS-i386-debug
+test-hello-MIPS-i386-fast
+test-hello-MIPS-aarch64-opt
+test-hello-MIPS-aarch64-debug
+test-hello-MIPS-aarch64-fast
+test-hello-ALPHA-x86_64-opt
+test-hello-ALPHA-x86_64-debug
+test-hello-ALPHA-x86_64-fast
+test-hello-ALPHA-i386-opt
+test-hello-ALPHA-i386-debug
+test-hello-ALPHA-i386-fast
+test-hello-ALPHA-aarch64-opt
+test-hello-ALPHA-aarch64-debug
+test-hello-ALPHA-aarch64-fast
+# Copyright (c) 2020 ARM Limited
+# All rights reserved
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder. You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
# Copyright (c) 2017 Mark D. Hill and David A. Wood
# All rights reserved.
#
valid_isas=constants.supported_isas,
valid_variants=constants.supported_variants,
length=constants.supported_lengths[0],
+ valid_hosts=constants.supported_hosts,
protocol=None):
'''
Helper class to generate common gem5 tests using verifiers.
if os.path.exists(_test_ignore_file_loc):
ignore.update(open(_test_ignore_file_loc).read().splitlines())
- for opt in valid_variants:
- for isa in valid_isas:
-
- # Create a tempdir fixture to be shared throughout the test.
- tempdir = TempdirFixture()
- gem5_returncode = VariableFixture(
- name=constants.gem5_returncode_fixture_name)
-
- # Common name of this generated testcase.
- _name = '{given_name}-{isa}-{opt}'.format(
- given_name=name,
- isa=isa,
- opt=opt)
- if protocol:
- _name += '-'+protocol
-
- # We check to see if this test suite is to be ignored. If so, we
- # skip it.
- if _name in ignore:
- continue
-
- # Create the running of gem5 subtest.
- # NOTE: We specifically create this test before our verifiers so
- # this is listed first.
- tests = []
- gem5_execution = TestFunction(
- _create_test_run_gem5(config, config_args, gem5_args),
- name=_name)
- tests.append(gem5_execution)
-
- # Create copies of the verifier subtests for this isa and
- # variant.
- for verifier in verifiers:
- tests.append(verifier.instantiate_test(_name))
-
- # Add the isa and variant to tags list.
- tags = [isa, opt, length]
-
- # Create the gem5 target for the specific architecture and
- # variant.
- _fixtures = copy.copy(fixtures)
- _fixtures.append(Gem5Fixture(isa, opt, protocol))
- _fixtures.append(tempdir)
- _fixtures.append(gem5_returncode)
-
- # Finally construct the self contained TestSuite out of our
- # tests.
- testsuites.append(TestSuite(
- name=_name,
- fixtures=_fixtures,
- tags=tags,
- tests=tests))
+ for host in valid_hosts:
+ for opt in valid_variants:
+ for isa in valid_isas:
+
+ # Create a tempdir fixture to be shared throughout the test.
+ tempdir = TempdirFixture()
+ gem5_returncode = VariableFixture(
+ name=constants.gem5_returncode_fixture_name)
+
+ # Common name of this generated testcase.
+ _name = '{given_name}-{isa}-{host}-{opt}'.format(
+ given_name=name,
+ isa=isa,
+ host=host,
+ opt=opt)
+ if protocol:
+ _name += '-'+protocol
+
+ # We check to see if this test suite is to be ignored. If so,
+ # we skip it.
+ if _name in ignore:
+ continue
+
+ # Create the running of gem5 subtest. NOTE: We specifically
+ # create this test before our verifiers so this is listed
+ # first.
+ tests = []
+ gem5_execution = TestFunction(
+ _create_test_run_gem5(config, config_args, gem5_args),
+ name=_name)
+ tests.append(gem5_execution)
+
+ # Create copies of the verifier subtests for this isa and
+ # variant.
+ for verifier in verifiers:
+ tests.append(verifier.instantiate_test(_name))
+
+ # Add the isa and variant to tags list.
+ tags = [isa, opt, length, host]
+
+ # Create the gem5 target for the specific architecture and
+ # variant.
+ _fixtures = copy.copy(fixtures)
+ _fixtures.append(Gem5Fixture(isa, opt, protocol))
+ _fixtures.append(tempdir)
+ _fixtures.append(gem5_returncode)
+
+ # Finally construct the self contained TestSuite out of our
+ # tests.
+ testsuites.append(TestSuite(
+ name=_name,
+ fixtures=_fixtures,
+ tags=tags,
+ tests=tests))
return testsuites
def _create_test_run_gem5(config, config_args, gem5_args):