:param directory: The directory which scons will -C (cd) into before
executing. If None is provided, will choose the config base_dir.
'''
- def __init__(self, directory=None, target_class=None):
+ def __init__(self, directory=None, target_class=None, options=[]):
self.directory = directory if directory else config.base_dir
self.target_class = target_class if target_class else SConsTarget
self.threads = config.threads
self.targets = set()
+ self.options = options
super(SConsFixture, self).__init__()
def setup(self, testitem):
"You may want to run with only a single ISA"
"(--isa=), use --skip-build, or use 'rerun'.")
-
-
command.extend(self.targets)
+ if self.options:
+ command.extend(self.options)
log_call(log.test_log, command)
return Fixture.schedule_finalized(self, schedule)
class Gem5Fixture(SConsTarget):
- def __init__(self, isa, variant):
- target = joinpath(isa.upper(), 'gem5.%s' % variant)
- super(Gem5Fixture, self).__init__(target)
+ other_invocations = {} # stores scons invocations other than the default
+
+ def __init__(self, isa, variant, protocol=None):
+ if protocol:
+ # When specifying an non-default protocol, we have to make a
+ # separate scons invocation with specific parameters. However, if
+ # more than one tests needs the same target, we need to make sure
+ # that we don't call scons too many times.
+ target_dir = isa.upper()+'-'+protocol
+ target = joinpath(target_dir, 'gem5.%s' % variant)
+ if target_dir in self.other_invocations.keys():
+ invocation = self.other_invocations[target_dir]
+ else:
+ options = ['PROTOCOL='+protocol, '--default='+isa.upper()]
+ invocation = SConsFixture(options=options)
+ globalfixture(invocation)
+ Gem5Fixture.other_invocations[target_dir] = invocation
+ else:
+ target = joinpath(isa.upper(), 'gem5.%s' % variant)
+ invocation = None # use default
+ super(Gem5Fixture, self).__init__(target, invocation=invocation)
self.name = constants.gem5_binary_fixture_name
self.path = self.target
fixtures=[],
valid_isas=constants.supported_isas,
valid_variants=constants.supported_variants,
- length=constants.supported_lengths[0]):
+ length=constants.supported_lengths[0],
+ protocol=None):
'''
Helper class to generate common gem5 tests using verifiers.
given_name=name,
isa=isa,
opt=opt)
+ if protocol:
+ _name += '-'+protocol
# Create the running of gem5 subtest.
# NOTE: We specifically create this test before our verifiers so
# Create the gem5 target for the specific architecture and
# variant.
_fixtures = copy.copy(fixtures)
- _fixtures.append(Gem5Fixture(isa, opt))
+ _fixtures.append(Gem5Fixture(isa, opt, protocol))
_fixtures.append(tempdir)
_fixtures.append(gem5_returncode)