Skip to content
Snippets Groups Projects
Commit 3f005a8d authored by Dennis Gläser's avatar Dennis Gläser
Browse files

Merge branch 'feature/ensure-junit-report-creation' into 'master'

[bin][runselected] ensure junit report is created

See merge request !2582
parents f594d475 32bb316d
No related branches found
No related tags found
1 merge request!2582[bin][runselected] ensure junit report is created
Pipeline #3740 failed
+2
...@@ -5,6 +5,7 @@ Build and/or run (using `dune-ctest`) a selection of tests. ...@@ -5,6 +5,7 @@ Build and/or run (using `dune-ctest`) a selection of tests.
Run this in the top level of the build tree. Run this in the top level of the build tree.
""" """
import os
import sys import sys
import json import json
import subprocess import subprocess
...@@ -46,10 +47,8 @@ def runTests(config, script='', flags=['-j4', '--output-on-failure']): ...@@ -46,10 +47,8 @@ def runTests(config, script='', flags=['-j4', '--output-on-failure']):
tests = ['NOOP'] tests = ['NOOP']
# if not given, try system-wide call to dune-ctest # if not given, try system-wide call to dune-ctest
call = ['dune-ctest'] if not script else ['./' + script.lstrip('./')] script = ['dune-ctest'] if not script else script
call.extend(flags) subprocess.run([script] + flags + ['-R'] + tests, check=True)
call.extend(['-R'] + tests)
subprocess.run(call, check=True)
if __name__ == '__main__': if __name__ == '__main__':
...@@ -93,6 +92,8 @@ if __name__ == '__main__': ...@@ -93,6 +92,8 @@ if __name__ == '__main__':
# prepare build and test flags # prepare build and test flags
buildFlags = args['buildflags'].split(' ') buildFlags = args['buildflags'].split(' ')
testFlags = args['testflags'].split(' ') testFlags = args['testflags'].split(' ')
dunectest = args['script']
dunectest = 'dune-ctest' if not dunectest else os.path.abspath(dunectest)
# use target `all` # use target `all`
if args['all']: if args['all']:
...@@ -101,7 +102,7 @@ if __name__ == '__main__': ...@@ -101,7 +102,7 @@ if __name__ == '__main__':
subprocess.run(['make'] + buildFlags + ['build_tests'], check=True) subprocess.run(['make'] + buildFlags + ['build_tests'], check=True)
if args['test']: if args['test']:
print('Running all tests') print('Running all tests')
subprocess.run(['ctest'] + testFlags, check=True) subprocess.run([dunectest] + testFlags, check=True)
# use target selection # use target selection
else: else:
...@@ -113,4 +114,4 @@ if __name__ == '__main__': ...@@ -113,4 +114,4 @@ if __name__ == '__main__':
if args['build']: if args['build']:
buildTests(config, buildFlags) buildTests(config, buildFlags)
if args['test']: if args['test']:
runTests(config, args['script'], testFlags) runTests(config, dunectest, testFlags)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment