Skip to content

Commit 0b26bcd

Browse files
committed
jenkins: add runTests.py --test-only to run in parallel
1 parent b27a18d commit 0b26bcd

3 files changed

Lines changed: 34 additions & 20 deletions

File tree

Jenkinsfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,12 @@ LDFLAGS_OPENCL=-L/usr/local/cuda/targets/x86_64-linux/lib
244244
cmd += ' --pretend-all'
245245
}
246246
sh """
247-
unset PARALLEL
248-
$cmd | parallel --halt now,fail=1 -r -j$parallel_tests ./runTests.py -j$cores_per_test {}
247+
$cmd > changed-tests
248+
if [ -s changed-tests ] ; then
249+
./runTests.py -j${cores_per_test*parallel_tests} --make-only `< changed-tests`
250+
unset PARALLEL
251+
parallel --halt now,fail=1 -r -j$parallel_tests ./runTests.py --test-only -j$cores_per_test {} < changed-tests
252+
fi
249253
"""
250254
}
251255
}

runTests.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ def processCLIArgs():
116116
action="store_true",
117117
help="Don't run tests, just try to make them.",
118118
)
119+
parser.add_argument(
120+
"-t",
121+
"--test-only",
122+
dest="test_only",
123+
action="store_true",
124+
help="Don't make tests, just try to run them (must already be made).",
125+
)
119126
parser.add_argument(
120127
"--run-all",
121128
dest="run_all",
@@ -405,20 +412,21 @@ def main():
405412
if inputs.changed:
406413
tests = findChangedTests(inputs.debug)
407414
else:
408-
# pass 0: generate all auto-generated tests
409-
if any("test/prob" in arg for arg in inputs.tests):
410-
generateTests(inputs.j)
411-
412-
if inputs.do_jumbo:
413-
jumboFiles = generateJumboTests(inputs.tests)
414-
if inputs.e == -1:
415-
if inputs.j == 1:
416-
num_expr_test_files = 1
415+
if not inputs.test_only:
416+
# pass 0: generate all auto-generated tests
417+
if any("test/prob" in arg for arg in inputs.tests):
418+
generateTests(inputs.j)
419+
420+
if inputs.do_jumbo:
421+
jumboFiles = generateJumboTests(inputs.tests)
422+
if inputs.e == -1:
423+
if inputs.j == 1:
424+
num_expr_test_files = 1
425+
else:
426+
num_expr_test_files = inputs.j * 4
417427
else:
418-
num_expr_test_files = inputs.j * 4
419-
else:
420-
num_expr_test_files = inputs.e
421-
handleExpressionTests(inputs.tests, inputs.only_functions, num_expr_test_files)
428+
num_expr_test_files = inputs.e
429+
handleExpressionTests(inputs.tests, inputs.only_functions, num_expr_test_files)
422430

423431
tests = findTests(inputs.tests, inputs.f, inputs.do_jumbo)
424432

@@ -431,10 +439,11 @@ def main():
431439

432440
try:
433441
# pass 1: make test executables
434-
for batch in batched(tests):
435-
if inputs.debug:
436-
print("Test batch: ", batch)
437-
makeTest(" ".join(batch), inputs.j)
442+
if not inputs.test_only:
443+
for batch in batched(tests):
444+
if inputs.debug:
445+
print("Test batch: ", batch)
446+
makeTest(" ".join(batch), inputs.j)
438447
if not inputs.make_only:
439448
# pass 2: run test targets
440449
for t in tests:

test/prob/getDependencies.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ def add_tests_from_hpp(tests_to_run, test):
7272
)
7373
add_tests_from_hpp(tests_to_run, test)
7474

75-
print("\n".join(set(tests_to_run)))
75+
if tests_to_run:
76+
print("\n".join(set(tests_to_run)))

0 commit comments

Comments
 (0)