aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrun_tests.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/run_tests.py b/run_tests.py
index a3ec0dc..e42e10d 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -28,6 +28,8 @@ from mesonbuild.scripts import meson_test, meson_benchmark
import argparse
import xml.etree.ElementTree as ET
import time
+import multiprocessing
+import concurrent.futures as conc
from mesonbuild.mesonmain import backendlist
@@ -195,7 +197,9 @@ def parse_test_args(testdir):
pass
return args
-def run_test(testdir, extra_args, should_succeed):
+def run_test(skipped, testdir, extra_args, should_succeed):
+ if skipped:
+ return None
with tempfile.TemporaryDirectory(prefix='b ', dir='.') as build_dir:
with tempfile.TemporaryDirectory(prefix='i ', dir=os.getcwd()) as install_dir:
try:
@@ -292,18 +296,24 @@ def run_tests(extra_args):
build_time = 0
test_time = 0
+ executor = conc.ProcessPoolExecutor(max_workers=multiprocessing.cpu_count())
+
for name, test_cases, skipped in all_tests:
current_suite = ET.SubElement(junit_root, 'testsuite', {'name' : name, 'tests' : str(len(test_cases))})
if skipped:
print('\nNot running %s tests.\n' % name)
else:
print('\nRunning %s tests.\n' % name)
+ futures = []
for t in test_cases:
# Jenkins screws us over by automatically sorting test cases by name
# and getting it wrong by not doing logical number sorting.
(testnum, testbase) = os.path.split(t)[-1].split(' ', 1)
testname = '%.3d %s' % (int(testnum), testbase)
- if skipped:
+ result = executor.submit(run_test, skipped, t, extra_args, name != 'failing')
+ for (testname, result) in futures:
+ futures.append((testname, result))
+ if result is None:
current_test = ET.SubElement(current_suite, 'testcase', {'name' : testname,
'classname' : name})
ET.SubElement(current_test, 'skipped', {})
@@ -311,7 +321,6 @@ def run_tests(extra_args):
skipped_tests += 1
else:
ts = time.time()
- result = run_test(t, extra_args, name != 'failing')
te = time.time()
conf_time += result.conftime
build_time += result.buildtime