summaryrefslogtreecommitdiff
path: root/src/systemc/tests
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-07-27 23:39:10 -0700
committerGabe Black <gabeblack@google.com>2018-09-11 21:54:28 +0000
commit267b788783f0edd9359ea489aec592910472154d (patch)
treedea9f732c0f09fe9e5c449bc0b08932ec1c3af56 /src/systemc/tests
parent8f69ce7dd950da9e70ed09098fe2b12c0a639485 (diff)
downloadgem5-267b788783f0edd9359ea489aec592910472154d.tar.xz
systemc: Make verify.py compare non output log reference files.
There are only a few of these which are vcd files. If there are reference files which aren't the log and which aren't in the gem5 output directory, mark those tests as failed as well. Change-Id: I2c880c13d0f90ccf16ac0439dbac68de9223cc90 Reviewed-on: https://gem5-review.googlesource.com/12060 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests')
-rwxr-xr-xsrc/systemc/tests/verify.py79
1 files changed, 74 insertions, 5 deletions
diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index ad6131970..062651d5d 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -227,6 +227,60 @@ class LogChecker(Checker):
os.unlink(diff_path)
return True
+class GoldenDir(object):
+ def __init__(self, path, platform):
+ self.path = path
+ self.platform = platform
+
+ contents = os.listdir(path)
+ suffix = '.' + platform
+ suffixed = filter(lambda c: c.endswith(suffix), contents)
+ bases = map(lambda t: t[:-len(platform)], suffixed)
+ common = filter(lambda t: not t.startswith(tuple(bases)), contents)
+
+ self.entries = {}
+ class Entry(object):
+ def __init__(self, e_path):
+ self.used = False
+ self.path = os.path.join(path, e_path)
+
+ def use(self):
+ self.used = True
+
+ for entry in contents:
+ self.entries[entry] = Entry(entry)
+
+ def entry(self, name):
+ def match(n):
+ return (n == name) or n.startswith(name + '.')
+ matches = { n: e for n, e in self.entries.items() if match(n) }
+
+ for match in matches.values():
+ match.use()
+
+ platform_name = '.'.join([ name, self.platform ])
+ if platform_name in matches:
+ return matches[platform_name].path
+ if name in matches:
+ return matches[name].path
+ else:
+ return None
+
+ def unused(self):
+ items = self.entries.items()
+ items = filter(lambda i: not i[1].used, items)
+
+ items.sort()
+ sources = []
+ i = 0
+ while i < len(items):
+ root = items[i][0]
+ sources.append(root)
+ i += 1
+ while i < len(items) and items[i][0].startswith(root):
+ i += 1
+ return sources
+
class VerifyPhase(TestPhaseBase):
name = 'verify'
number = 3
@@ -321,14 +375,29 @@ class VerifyPhase(TestPhaseBase):
diffs = []
+ gd = GoldenDir(test.golden_dir(), 'linux64')
+
+ missing = []
log_file = '.'.join([test.name, 'log'])
- log_path = os.path.join(test.golden_dir(), log_file)
+ log_path = gd.entry(log_file)
simout_path = os.path.join(out_dir, 'simout')
if not os.path.exists(simout_path):
- self.failed(test, 'no log output')
- if os.path.exists(log_path):
- diffs.append(LogChecker(
- log_path, simout_path, log_file, out_dir))
+ missing.append('log output')
+ elif log_path:
+ diffs.append(LogChecker(log_path, simout_path,
+ log_file, out_dir))
+
+ for name in gd.unused():
+ test_path = os.path.join(out_dir, name)
+ ref_path = gd.entry(name)
+ if not os.path.exists(test_path):
+ missing.append(name)
+ else:
+ diffs.append(Checker(ref_path, test_path, name))
+
+ if missing:
+ self.failed(test, 'missing output', ' '.join(missing))
+ continue
failed_diffs = filter(lambda d: not d.check(), diffs)
if failed_diffs: