From 4997ec2d166dbc2d88b8ebba662ea62dc57ff84a Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 9 Apr 2020 16:28:59 +0100 Subject: [PATCH] tests: Fail checkpoint regressions if no cpt has been taken 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 Reviewed-by: Richard Cooper Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27710 Maintainer: Bobby R. Bruce Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com> Tested-by: kokoro Reviewed-by: Ciro Santilli --- tests/configs/checkpoint.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/configs/checkpoint.py b/tests/configs/checkpoint.py index 4a7d15e4f..a652094dc 100644 --- a/tests/configs/checkpoint.py +++ b/tests/configs/checkpoint.py @@ -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) -- 2.30.2