Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12060 )

Change subject: systemc: Make verify.py compare non output log reference files.
......................................................................

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 <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/tests/verify.py
1 file changed, 74 insertions(+), 5 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index ad61319..062651d 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -227,6 +227,60 @@
                     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 @@

             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:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12060
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I2c880c13d0f90ccf16ac0439dbac68de9223cc90
Gerrit-Change-Number: 12060
Gerrit-PatchSet: 9
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to