Commit fd904f8a authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ci][makeyml] support case of no tests

parent 402056ff
......@@ -37,6 +37,7 @@ def substituteAndWrite(mapping):
commandIndentation = ' '*args['indentation']
duneConfigCommand = 'dunecontrol --opts=$DUNE_OPTS_FILE --current all'
with open(args['outfile'], 'w') as ymlFile:
def makeScriptString(commands):
......@@ -45,7 +46,7 @@ with open(args['outfile'], 'w') as ymlFile:
# if no configuration is given, build and run all tests
if not args['testconfig']:
buildCommand = ['dunecontrol --opts=$DUNE_OPTS_FILE --current all',
buildCommand = [duneConfigCommand,
'dunecontrol --opts=$DUNE_OPTS_FILE --current '
'make -k -j4 build_tests']
testCommand = ['cd build-cmake', 'dune-ctest -j4 --output-on-failure']
......@@ -58,24 +59,35 @@ with open(args['outfile'], 'w') as ymlFile:
testNames = config.keys()
targetNames = [tc['target'] for tc in config.values()]
# The MakeFile generated by cmake contains .NOTPARALLEL statement,
# as it only allows one call to `CMakeFiles/Makefile2` at a time.
# Parallelism is taken care of within that latter Makefile. Thus,
# we let the script create a small custom makeFile here on top of
# `Makefile2`, where we define a new target to be built in parallel
buildCommand = [
'rm -f TestMakefile',
'touch TestMakefile',
'echo "include CMakeFiles/Makefile2" >> TestMakefile',
'echo "" >> TestMakefile',
'|\n'
+ commandIndentation
+ ' "echo "build_selected_tests: {}" >> TestMakefile"'
.format(' '.join(targetNames)),
'make -j4 build_selected_tests']
testCommand = ['cd build-cmake',
'dune-ctest -j4 --output-on-failure -R {}'
.format(' '.join(testNames))]
if not targetNames:
buildCommand = [duneConfigCommand,
'echo "No tests to be built."']
else:
# The MakeFile generated by cmake contains .NOTPARALLEL,
# as it only allows a single call to `CMakeFiles/Makefile2`.
# Parallelism is taken care of within that latter Makefile.
# We let the script create a small custom makeFile here on top
# of `Makefile2`, defining a new target to be built in parallel
buildCommand = [
duneConfigCommand,
'cd build-cmake',
'rm -f TestMakefile && touch TestMakefile',
'echo "include CMakeFiles/Makefile2" >> TestMakefile',
'echo "" >> TestMakefile',
'|\n'
+ commandIndentation
+ ' echo "build_selected_tests: {}" >> TestMakefile'
.format(' '.join(targetNames)),
'make -f TestMakefile -j4 build_selected_tests']
if not testNames:
testCommand = ['echo "No tests to be run, make empty report."',
'cd build-cmake',
'dune-ctest -R NOOP']
else:
testCommand = ['cd build-cmake',
'dune-ctest -j4 --output-on-failure -R {}'
.format(' '.join(testNames))]
substituteAndWrite({'build_script': makeScriptString(buildCommand),
'test_script': makeScriptString(testCommand)})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment