tests: Fail checkpoint regressions if no cpt has been taken
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 9 Apr 2020 15:28:59 +0000 (16:28 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 14 Apr 2020 15:01:19 +0000 (15:01 +0000)
This is to avoid the scenario where a wrong interval is chosen
and no checkpoint is taken.

Change-Id: I524d797048ab04799555aaf7a051241b2917ad95
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27710
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
tests/configs/checkpoint.py

index 4a7d15e4f2d24bafc1f9aaf0376247a81cc034f4..a652094dcb3459040462d645bdc94227e8cdac3c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 ARM Limited
+# Copyright (c) 2015, 2020 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -92,6 +92,7 @@ def run_test(root, interval=0.5, max_checkpoints=5):
 
     cpt_name = os.path.join(m5.options.outdir, "test.cpt")
     restore = None
+    checkpointed = False
 
     for cpt_no in range(max_checkpoints):
         # Create a checkpoint from a separate child process. This enables
@@ -112,10 +113,15 @@ def run_test(root, interval=0.5, max_checkpoints=5):
         restore = cpt_name
 
         if p.exitcode == _exitcode_done:
-            print("Test done.", file=sys.stderr)
-            sys.exit(0)
+            if checkpointed:
+                print("Test done.", file=sys.stderr)
+                sys.exit(0)
+            else:
+                print("Test done, but no checkpoint was created.",
+                    file=sys.stderr)
+                sys.exit(1)
         elif p.exitcode == _exitcode_checkpoint:
-            pass
+            checkpointed = True
         else:
             print("Test failed.", file=sys.stderr)
             sys.exit(1)