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>
This commit is contained in:
Simon Hausmann 2019-06-25 10:57:20 +02:00
parent ebfd09e7d6
commit e25f9e2008

View File

@ -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()