From b3d0f2d66a5bf79f66893adcb85b0ac78daf3f65 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Fri, 9 Mar 2018 11:47:25 +0000 Subject: tests: Python regression scripts using new print function Change-Id: I92060da4537e4ff1c0ff665f2f6ffc3850c50e88 Signed-off-by: Giacomo Travaglini Reviewed-by: Giacomo Gabrielli Reviewed-on: https://gem5-review.googlesource.com/8892 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power --- tests/configs/checkpoint.py | 10 ++++++---- tests/configs/switcheroo.py | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'tests/configs') diff --git a/tests/configs/checkpoint.py b/tests/configs/checkpoint.py index bea481be5..e57b6a7b9 100644 --- a/tests/configs/checkpoint.py +++ b/tests/configs/checkpoint.py @@ -35,6 +35,8 @@ # # Authors: Andreas Sandberg +from __future__ import print_function + from multiprocessing import Process import sys import os @@ -80,7 +82,7 @@ def _run_step(name, restore=None, interval=0.5): elif cause in _exit_normal: sys.exit(_exitcode_done) else: - print "Test failed: Unknown exit cause: %s" % cause + print("Test failed: Unknown exit cause: %s" % cause) sys.exit(_exitcode_fail) def run_test(root, interval=0.5, max_checkpoints=5): @@ -112,12 +114,12 @@ def run_test(root, interval=0.5, max_checkpoints=5): restore = cpt_name if p.exitcode == _exitcode_done: - print >> sys.stderr, "Test done." + print("Test done.", file=sys.stderr) sys.exit(0) elif p.exitcode == _exitcode_checkpoint: pass else: - print >> sys.stderr, "Test failed." + print("Test failed.", file=sys.stderr) sys.exit(1) # Maximum number of checkpoints reached. Just run full-speed from @@ -128,5 +130,5 @@ def run_test(root, interval=0.5, max_checkpoints=5): if cause in _exit_normal: sys.exit(0) else: - print "Test failed: Unknown exit cause: %s" % cause + print("Test failed: Unknown exit cause: %s" % cause) sys.exit(1) diff --git a/tests/configs/switcheroo.py b/tests/configs/switcheroo.py index 43bd5eba1..21c6d241d 100644 --- a/tests/configs/switcheroo.py +++ b/tests/configs/switcheroo.py @@ -35,6 +35,8 @@ # # Authors: Andreas Sandberg +from __future__ import print_function + import m5 import _m5 from m5.objects import * @@ -122,19 +124,20 @@ def run_test(root, switcher=None, freq=1000, verbose=False): next_cpu = switcher.next() if verbose: - print "Switching CPUs..." - print "Next CPU: %s" % type(next_cpu) + print("Switching CPUs...") + print("Next CPU: %s" % type(next_cpu)) m5.drain() if current_cpu != next_cpu: m5.switchCpus(system, [ (current_cpu, next_cpu) ], verbose=verbose) else: - print "Source CPU and destination CPU are the same, skipping..." + print("Source CPU and destination CPU are the same," + " skipping...") current_cpu = next_cpu elif exit_cause == "target called exit()" or \ exit_cause == "m5_exit instruction encountered": sys.exit(0) else: - print "Test failed: Unknown exit cause: %s" % exit_cause + print("Test failed: Unknown exit cause: %s" % exit_cause) sys.exit(1) -- cgit v1.2.3