tests: Update Gem5Fixture to compatible of Kconfig system
Used after the build system changed to Kconfig Change-Id: I699b36f09691dc821da8ee80fe5b60f30fe2179c
This commit is contained in:
@@ -151,9 +151,44 @@ class SConsFixture(UniqueFixture):
|
||||
if config.skip_build:
|
||||
return
|
||||
|
||||
def _setup(self, testitem):
|
||||
if config.skip_build:
|
||||
return
|
||||
if not self.targets:
|
||||
log.test_log.error("No SCons targets specified.")
|
||||
else:
|
||||
log.test_log.message(
|
||||
"Building the following targets. This may take a while."
|
||||
)
|
||||
log.test_log.message(f"{', '.join(self.targets)}")
|
||||
log.test_log.message(
|
||||
"You may want to use --skip-build, or use 'rerun'."
|
||||
)
|
||||
|
||||
if self.protocol:
|
||||
defconfig_command = [
|
||||
"scons",
|
||||
"-C",
|
||||
self.directory,
|
||||
"--ignore-style",
|
||||
"--no-compress-debug",
|
||||
"defconfig",
|
||||
self.target_dir,
|
||||
joinpath(self.directory, "build_opts", self.isa.upper()),
|
||||
]
|
||||
setconfig_command = [
|
||||
"scons",
|
||||
"-C",
|
||||
self.directory,
|
||||
"--ignore-style",
|
||||
"--no-compress-debug",
|
||||
"setconfig",
|
||||
self.target_dir,
|
||||
f"RUBY_PROTOCOL_{self.protocol.upper()}=y",
|
||||
]
|
||||
log_call(
|
||||
log.test_log, defconfig_command, time=None, stderr=sys.stderr
|
||||
)
|
||||
log_call(
|
||||
log.test_log, setconfig_command, time=None, stderr=sys.stderr
|
||||
)
|
||||
|
||||
command = [
|
||||
"scons",
|
||||
@@ -164,26 +199,7 @@ class SConsFixture(UniqueFixture):
|
||||
"--ignore-style",
|
||||
"--no-compress-debug",
|
||||
]
|
||||
|
||||
if not self.targets:
|
||||
log.test_log.warn(
|
||||
"No SCons targets specified, this will"
|
||||
" build the default all target.\n"
|
||||
"This is likely unintended, and you"
|
||||
" may wish to kill testlib and reconfigure."
|
||||
)
|
||||
else:
|
||||
log.test_log.message(
|
||||
"Building the following targets. This may take a while."
|
||||
)
|
||||
log.test_log.message(f"{', '.join(self.targets)}")
|
||||
log.test_log.message(
|
||||
"You may want to use --skip-build, or use 'rerun'."
|
||||
)
|
||||
|
||||
command.extend(self.targets)
|
||||
if self.options:
|
||||
command.extend(self.options)
|
||||
log_call(log.test_log, command, time=None, stderr=sys.stderr)
|
||||
|
||||
|
||||
@@ -194,6 +210,7 @@ class Gem5Fixture(SConsFixture):
|
||||
target_dir += "_" + protocol
|
||||
target = joinpath(target_dir, f"gem5.{variant}")
|
||||
obj = super().__new__(cls, target)
|
||||
obj.target_dir = target_dir
|
||||
return obj
|
||||
|
||||
def _init(self, isa, variant, protocol=None):
|
||||
@@ -203,15 +220,12 @@ class Gem5Fixture(SConsFixture):
|
||||
self.path = self.target
|
||||
self.directory = config.base_dir
|
||||
|
||||
self.options = []
|
||||
if protocol:
|
||||
self.options = ["--default=" + isa.upper(), "PROTOCOL=" + protocol]
|
||||
self.isa = isa
|
||||
self.protocol = protocol
|
||||
self.set_global()
|
||||
|
||||
def get_get_build_info(self) -> Optional[str]:
|
||||
build_target = self.target
|
||||
if self.options:
|
||||
build_target += " ".join(self.options)
|
||||
return build_target
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user