From 5297a0a2af7dd774a28921a44b3664f5636536c4 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 16 Mar 2021 16:41:47 +0100 Subject: Rework the failure macros in the Qt CTest kit The _qt_internal_test_expect_fail macro fails when the test fails during the configuration step. Rename this macro to _qt_internal_test_expect_build_fail and add the _qt_internal_test_expect_fail macro that expects inverted test result. Change-Id: I4635e99152f7a32f5c48202e84fec59800453d34 Reviewed-by: Alexandru Croitor (cherry picked from commit fec5b8e81c976b8b0cdf45b459f7d481222e86d7) --- src/corelib/Qt6CTestMacros.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/corelib/Qt6CTestMacros.cmake') diff --git a/src/corelib/Qt6CTestMacros.cmake b/src/corelib/Qt6CTestMacros.cmake index 50cc40939a..9062985ac0 100644 --- a/src/corelib/Qt6CTestMacros.cmake +++ b/src/corelib/Qt6CTestMacros.cmake @@ -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}") -- cgit v1.2.3