tests: Python regression scripts using new print function
Change-Id: I92060da4537e4ff1c0ff665f2f6ffc3850c50e88 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com> Reviewed-on: https://gem5-review.googlesource.com/8892 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#
|
||||
# Authors: Korey Sewell
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
m5.util.addToPath('../configs/common')
|
||||
from cpu2000 import twolf
|
||||
import os
|
||||
@@ -40,8 +42,8 @@ sv2_file = os.path.join(cwd, workload.input_set + '.sv2')
|
||||
try:
|
||||
os.unlink(sav_file)
|
||||
except:
|
||||
print "Couldn't unlink ", sav_file
|
||||
print("Couldn't unlink ", sav_file)
|
||||
try:
|
||||
os.unlink(sv2_file)
|
||||
except:
|
||||
print "Couldn't unlink ", sv2_file
|
||||
print("Couldn't unlink ", sv2_file)
|
||||
|
||||
@@ -32,11 +32,14 @@
|
||||
#
|
||||
# Author: Brad Beckmann
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
executable = binpath('gpu-hello')
|
||||
kernel_path = os.path.dirname(executable)
|
||||
kernel_files = glob.glob(os.path.join(kernel_path, '*.asm'))
|
||||
if kernel_files:
|
||||
print "Using GPU kernel code file(s)", ",".join(kernel_files)
|
||||
print("Using GPU kernel code file(s)", ",".join(kernel_files))
|
||||
else:
|
||||
fatal("Can't locate kernel code (.asm) in " + kernel_path)
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
#
|
||||
# Authors: Korey Sewell
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
m5.util.addToPath('../configs/common')
|
||||
|
||||
from cpu2000 import twolf
|
||||
import os
|
||||
|
||||
@@ -40,8 +43,8 @@ sv2_file = os.path.join(cwd, workload.input_set + '.sv2')
|
||||
try:
|
||||
os.unlink(sav_file)
|
||||
except:
|
||||
print "Couldn't unlink ", sav_file
|
||||
print("Couldn't unlink ", sav_file)
|
||||
try:
|
||||
os.unlink(sv2_file)
|
||||
except:
|
||||
print "Couldn't unlink ", sv2_file
|
||||
print("Couldn't unlink ", sv2_file)
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#
|
||||
# Authors: Steve Reinhardt
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
@@ -57,7 +59,7 @@ def skip_test(reason=""):
|
||||
"""
|
||||
|
||||
if reason:
|
||||
print "Skipping test: %s" % reason
|
||||
print("Skipping test: %s" % reason)
|
||||
sys.exit(2)
|
||||
|
||||
def has_sim_object(name):
|
||||
@@ -143,7 +145,7 @@ def run_test(root):
|
||||
|
||||
# simulate until program terminates
|
||||
exit_event = m5.simulate(maxtick)
|
||||
print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
|
||||
print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())
|
||||
|
||||
# Since we're in batch mode, dont allow tcp socket connections
|
||||
m5.disableAllListeners()
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#
|
||||
# Authors: Andreas Sandberg
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import subprocess
|
||||
from threading import Timer
|
||||
import time
|
||||
@@ -187,4 +189,4 @@ if __name__ == "__main__":
|
||||
ignore_list.rules.append(FileIgnoreList.simple("bar.txt"))
|
||||
assert "bar.txt" in ignore_list
|
||||
|
||||
print "SUCCESS!"
|
||||
print("SUCCESS!")
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#
|
||||
# Authors: Andreas Sandberg
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
@@ -126,7 +128,7 @@ def _list_tests(args):
|
||||
for test in get_tests(isa, categories=categories, modes=modes,
|
||||
ruby_protocol=args.ruby_protocol,
|
||||
gpu_isa=args.gpu_isa):
|
||||
print "/".join(test)
|
||||
print("/".join(test))
|
||||
sys.exit(0)
|
||||
|
||||
def _run_tests_args(subparsers):
|
||||
@@ -175,8 +177,8 @@ def _run_tests_args(subparsers):
|
||||
|
||||
def _run_tests(args):
|
||||
if not os.path.isfile(args.gem5) or not os.access(args.gem5, os.X_OK):
|
||||
print >> sys.stderr, \
|
||||
"gem5 binary '%s' not an executable file" % args.gem5
|
||||
print("gem5 binary '%s' not an executable file" % args.gem5,
|
||||
file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
formatter = _create_formatter(args)
|
||||
@@ -195,9 +197,9 @@ def _run_tests(args):
|
||||
skip_diff_out=args.skip_diff_out))
|
||||
|
||||
all_results = []
|
||||
print "Running %i tests" % len(tests)
|
||||
print("Running %i tests" % len(tests))
|
||||
for testno, test in enumerate(tests):
|
||||
print "%i: Running '%s'..." % (testno, test)
|
||||
print("%i: Running '%s'..." % (testno, test))
|
||||
|
||||
all_results.append(test.run())
|
||||
|
||||
@@ -249,7 +251,7 @@ def _show(args):
|
||||
try:
|
||||
return pickle.load(f)
|
||||
except EOFError:
|
||||
print >> sys.stderr, 'Could not read file %s' % f.name
|
||||
print('Could not read file %s' % f.name, file=sys.stderr)
|
||||
return []
|
||||
|
||||
formatter = _create_formatter(args)
|
||||
@@ -287,7 +289,7 @@ def _test(args):
|
||||
try:
|
||||
suites = sum([ pickle.load(f) for f in args.result ], [])
|
||||
except EOFError:
|
||||
print >> sys.stderr, 'Could not read all files'
|
||||
print('Could not read all files', file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
if all(s for s in suites):
|
||||
|
||||
Reference in New Issue
Block a user