aboutsummaryrefslogtreecommitdiff
path: root/debug/testlib.py
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-12-10 13:22:58 -0800
committerGitHub <noreply@github.com>2019-12-10 13:22:58 -0800
commit9e3decb78644b7fce690acb217b295a40b86ef12 (patch)
tree975301684510c2c4ad0123d7d33054f32babaf1b /debug/testlib.py
parent39234b7491c05e98f84d981f1c7bb6aea005ab30 (diff)
downloadriscv-tests-9e3decb78644b7fce690acb217b295a40b86ef12.zip
riscv-tests-9e3decb78644b7fce690acb217b295a40b86ef12.tar.gz
riscv-tests-9e3decb78644b7fce690acb217b295a40b86ef12.tar.bz2
Improve parallellism in debug test Makefile (#223)
* Improve parallellism in debug test Makefile Now each test is an individual make target, so you can get the most out of however many cores you have. On my 12-core system, `make` went from 2m45s to 42s, and `make all` went from `3m25s` to `2m39s`. If you have few cores, this change may actually slow things down a bit, because ExamineTarget is run for every gdbserver.py invocation. * Remove test target.
Diffstat (limited to 'debug/testlib.py')
-rw-r--r--debug/testlib.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 1aa0e5b..fbb0472 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -689,6 +689,18 @@ class PrivateState:
self.gdb.pop_state()
def run_all_tests(module, target, parsed):
+ todo = []
+ for name in dir(module):
+ definition = getattr(module, name)
+ if isinstance(definition, type) and hasattr(definition, 'test') and \
+ (not parsed.test or any(test in name for test in parsed.test)):
+ todo.append((name, definition, None))
+
+ if parsed.list_tests:
+ for name, definition, hart in todo:
+ print(name)
+ return 0
+
try:
os.makedirs(parsed.logs)
except OSError:
@@ -701,7 +713,6 @@ def run_all_tests(module, target, parsed):
global gdb_cmd # pylint: disable=global-statement
gdb_cmd = parsed.gdb
- todo = []
examine_added = False
for hart in target.harts:
if parsed.misaval:
@@ -710,15 +721,9 @@ def run_all_tests(module, target, parsed):
elif hart.misa:
print("Using $misa from hart definition: 0x%x" % hart.misa)
elif not examine_added:
- todo.append(("ExamineTarget", ExamineTarget, None))
+ todo.insert(0, ("ExamineTarget", ExamineTarget, None))
examine_added = True
- for name in dir(module):
- definition = getattr(module, name)
- if isinstance(definition, type) and hasattr(definition, 'test') and \
- (not parsed.test or any(test in name for test in parsed.test)):
- todo.append((name, definition, None))
-
results, count = run_tests(parsed, target, todo)
header("ran %d tests in %.0fs" % (count, time.time() - overall_start),
@@ -786,6 +791,8 @@ def add_test_run_options(parser):
parser.add_argument("--print-log-names", "--pln", action="store_true",
help="Print names of temporary log files as soon as they are "
"created.")
+ parser.add_argument("--list-tests", action="store_true",
+ help="Print out a list of tests, and exit immediately.")
parser.add_argument("test", nargs='*',
help="Run only tests that are named here.")
parser.add_argument("--gdb",