tests: Add no m5threads binary as a test skipping exception
Change-Id: I3e0f71316aa556512f844aa279356f9094387996
Signed-off-by: Sean Wilson <spwilson2@wisc.edu>
diff --git a/tests/testing/units.py b/tests/testing/units.py
index 8a9d307..ca67da1 100644
--- a/tests/testing/units.py
+++ b/tests/testing/units.py
@@ -135,6 +135,12 @@
- exit code == 0 -> STATE_OK
- exit code == 2 -> STATE_SKIPPED
"""
+ m5_missing_file_regex = [
+ r"^IOError: Can't find a path to system files\.$",
+ r"^fatal: Can't load object file.*/m5threads/",
+ ]
+
+ m5_missing_file_regex = [re.compile(r) for r in m5_missing_file_regex]
def __init__(self, gem5, gem5_args, timeout=0, **kwargs):
super(RunGem5, self).__init__("gem5", **kwargs)
@@ -184,19 +190,28 @@
elif status == 2:
return self.skip(stdout=stdout, stderr=stderr)
elif status > 0:
- m5_stderr_split = m5_stderr.splitlines()
-
- if m5_stderr_split and m5_stderr_split[-1] == \
- "IOError: Can't find a path to system files.":
-
- return self.skip(stdout="Unable to find a required file for"
- "this test.")
-
+ if RunGem5._m5_errors_indicate_missing_file(m5_stderr):
+ return self.skip(stdout="Unable to find a required file"
+ " for this test.")
return self.error("gem5 exited with non-zero status: %i" % status,
stdout=stdout, stderr=stderr)
else:
return self.ok(stdout=stdout, stderr=stderr)
+ @staticmethod
+ def _m5_errors_indicate_missing_file(m5_stderr):
+ """
+ Check if the given m5 error output is indicative of a missing
+ support file.
+
+ @returns True if so, None if the error does not indicate this.
+ """
+ for line in m5_stderr.splitlines():
+ for regex in RunGem5.m5_missing_file_regex:
+ if regex.search(line):
+ return True
+
+
class DiffOutFile(TestUnit):
"""Test unit comparing and output file and a reference file."""