Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/12051
Change subject: systemc: Extend the execute phase of verify.py.
......................................................................
systemc: Extend the execute phase of verify.py.
Add -j and --timeout options to the execute phase of verify.py.
The --timeout option is implemented using the timeout utility program
which is assumed to be available on the host system. Python 3.3 added
a timeout argument to the subprocess module which is an alternative
approach, but then we would be dependent on python 3.3.
-j is implemented using the standard multiprocess.pool.ThreadPool
class.
Change-Id: I15b92f2b14de6710e2027a6a19984b2644b2a8df
---
M src/systemc/tests/verify.py
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index 34ae931..cface47 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -35,6 +35,7 @@
import itertools
import json
import logging
+import multiprocessing.pool
import os
import subprocess
import sys
@@ -120,16 +121,39 @@
number = 2
def run(self, tests):
- for test in tests:
- if test.compile_only:
- continue
- args = [
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--timeout', type=int, metavar='SECONDS',
+ help='Time limit for each run in seconds.',
+ default=0)
+ parser.add_argument('-j', type=int, default=1,
+ help='How many tests to run in parallel.')
+ args = parser.parse_args(self.args)
+
+ timeout_cmd = [
+ 'timeout',
+ '--kill-after', str(args.timeout * 2),
+ str(args.timeout)
+ ]
+ def run_test(test):
+ cmd = []
+ if args.timeout:
+ cmd.extend(timeout_cmd)
+ cmd.extend([
test.full_path(),
'-red', test.m5out_dir(),
'--listener-mode=off',
config_path
- ]
- subprocess.check_call(args)
+ ])
+ subprocess.check_call(cmd)
+
+ runnable = filter(lambda t: not t.compile_only, tests)
+ if args.j == 1:
+ map(run_test, runnable)
+ else:
+ tp = multiprocessing.pool.ThreadPool(args.j)
+ map(lambda t: tp.apply_async(run_test, (t,)), runnable)
+ tp.close()
+ tp.join()
class VerifyPhase(TestPhaseBase):
name = 'verify'
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12051
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I15b92f2b14de6710e2027a6a19984b2644b2a8df
Gerrit-Change-Number: 12051
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev