Merge "Rework the failure macros in the Qt CTest kit"

This commit is contained in:
Alexey Edelev 2021-03-16 16:41:47 +01:00 committed by Qt CI Bot
commit fac23d695f
2 changed files with 17 additions and 5 deletions

View File

@ -113,6 +113,7 @@ function(_qt_internal_set_up_test_run_environment testname)
endfunction()
# Checks if the test project can be built successfully.
macro(_qt_internal_test_expect_pass _dir)
cmake_parse_arguments(_ARGS "" "BINARY" "" ${ARGN})
string(REPLACE "(" "_" testname "${_dir}")
@ -137,7 +138,18 @@ macro(_qt_internal_test_expect_pass _dir)
endif()
endmacro()
macro(_qt_internal_test_expect_fail _dir)
# Checks if the build of the test project fails.
# This test passes if the test project fails either at the
# configuring or build steps.
macro(_qt_internal_test_expect_fail)
_qt_internal_test_expect_pass(${ARGV})
set_tests_properties(${testname} PROPERTIES WILL_FAIL TRUE)
endmacro()
# Checks if the build of the test project fails.
# This test passes only if the test project fails at the build step,
# but not at the configuring step.
macro(_qt_internal_test_expect_build_fail _dir)
string(REPLACE "(" "_" testname "${_dir}")
string(REPLACE ")" "_" testname "${testname}")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")

View File

@ -102,8 +102,8 @@ if (NOT NO_WIDGETS)
_qt_internal_test_expect_pass(test_dependent_modules)
_qt_internal_test_expect_pass("test(needsquoting)dirname")
endif()
_qt_internal_test_expect_fail(test_add_resource_options)
_qt_internal_test_expect_fail(test_wrap_cpp_options)
_qt_internal_test_expect_build_fail(test_add_resource_options)
_qt_internal_test_expect_build_fail(test_wrap_cpp_options)
_qt_internal_test_expect_pass(test_platform_defs_include)
_qt_internal_test_expect_pass(test_qtmainwin_library)
@ -146,7 +146,7 @@ _qt_internal_test_expect_pass(test_testlib_definitions)
_qt_internal_test_expect_pass(test_json_plugin_includes)
if(NOT NO_GUI)
_qt_internal_test_expect_fail(test_testlib_no_link_gui)
_qt_internal_test_expect_build_fail(test_testlib_no_link_gui)
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
@ -155,7 +155,7 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy
)
if (NOT NO_WIDGETS)
_qt_internal_test_expect_fail(test_testlib_no_link_widgets)
_qt_internal_test_expect_build_fail(test_testlib_no_link_widgets)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/test_testlib_definitions/main.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/failbuild/test_testlib_no_link_widgets/test_testlib_no_link_widgets/"