diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-06-25 10:57:20 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-06-25 13:11:05 +0000 |
commit | e25f9e20081e83a2c98d4be436d2a79a5fdbbc83 (patch) | |
tree | 26e1dcd5638b76188baad15f7a8ef3908da4904c /cmake | |
parent | ebfd09e7d66b50a93255b7bee8817132ecfc46b5 (diff) |
Prepare tests for running in the CI
* Add labels so that ctest --print-labels and ctest -L <label> gives
insight over the test plan and the ability to run easily individual
tests.
* Unfortunately we can't do the TESTARGS indirection for arguments as
coin does with testlib, so instead pass the parameters to generate
the xml unconditionally.
Change-Id: I289de9c15c516e3ac3fe04771fdbd8d7a083ff1f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtBuild.cmake | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index d588ccc5bf..2eb20660c2 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1687,9 +1687,13 @@ function(add_qt_test name) DISABLE_AUTOGEN_TOOLS ${arg_DISABLE_AUTOGEN_TOOLS} ) - add_test(NAME "${name}" COMMAND "${name}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + # Generate a label in the form tests/auto/foo/bar/tst_baz + # and use it also for XML output + file(RELATIVE_PATH label "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/${name}") - set_tests_properties("${name}" PROPERTIES RUN_SERIAL "${arg_RUN_SERIAL}") + add_test(NAME "${name}" COMMAND "${name}" -o ${name}.xml,xml -o -,txt WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + + set_tests_properties("${name}" PROPERTIES RUN_SERIAL "${arg_RUN_SERIAL}" LABELS "${label}") set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "PATH=${path}${QT_PATH_SEPARATOR}${CMAKE_CURRENT_BINARY_DIR}${QT_PATH_SEPARATOR}$ENV{PATH}") set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "QT_PLUGIN_PATH=${PROJECT_BINARY_DIR}/${INSTALL_PLUGINSDIR}") endfunction() |