tests: Don't treat new stats as a cause for failures
authorAndreas Sandberg <andreas.sandberg@arm.com>
Fri, 30 Jun 2017 09:38:48 +0000 (10:38 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Mon, 17 Jul 2017 15:41:48 +0000 (15:41 +0000)
We currently fail the stat diff stage of tests if there are new
stats. This is usually undesirable since this would require any change
that adds a stat to also update the regressions.

Change-Id: Ieadebac6fd17534e1b49b6b9a1d56f037a423325
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/3962
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

tests/diff-out
tests/testing/units.py

index c00d4f3de6bf2fdcb0a1d709b40585f38d21e560..1eeac81379980eefe00b4dc3db1cbedfed5f86eb 100755 (executable)
@@ -361,8 +361,12 @@ if ($added_stats)
 }
 
 cleanup();
-# Exit code is 0 if all stats are found (with no extras) & no stats error, 1 otherwise
-$status = ($missing_stats == 0 && $added_stats == 0 && $max_err_mag == 0.0) ? 0 : 1;
+# Exit codes:
+# 0 if all stats are found (with no extras) & no stats error
+# 1 if there are additional stats, but no stat errors
+# 2 otherwise
+$no_hard_errors = $missing_stats == 0 && $max_err_mag == 0.0;
+$status = $no_hard_errors ? ($added_stats == 0 ? 0 : 1) : 2;
 exit $status;
 
 sub cleanup
index e8b87a0b22dcc1b29a76d3e7aa6719e113c842e2..220cf61f6ac92ba6bc3008a10aa8eec1888b9092 100644 (file)
@@ -270,6 +270,10 @@ class DiffStatFile(TestUnit):
         self.stat_diff = os.path.join(_test_base, "diff-out")
 
     def _run(self):
+        STATUS_OK = 0
+        STATUS_NEW_STATS = 1
+        STATUS_FAILED = 2
+
         stats = "stats.txt"
 
         cmd = [
@@ -281,9 +285,9 @@ class DiffStatFile(TestUnit):
                            stderr=subprocess.PIPE) as p:
             status, stdout, stderr = p.call()
 
-        if status == 0:
+        if status in (STATUS_OK, STATUS_NEW_STATS):
             return self.ok(stdout=stdout, stderr=stderr)
-        if status == 1:
+        elif status == STATUS_FAILED:
             return self.failure("Statistics mismatch",
                                 stdout=stdout, stderr=stderr)
         else: