diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-03-16 16:41:47 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-03-17 13:34:39 +0100 |
commit | fec5b8e81c976b8b0cdf45b459f7d481222e86d7 (patch) | |
tree | 18521e246a4afce96ecfac9ea1799cf363fa536c /src/corelib/Qt6CTestMacros.cmake | |
parent | 253485425725736a5ea71de911beecddbd17987e (diff) |
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'src/corelib/Qt6CTestMacros.cmake')
-rw-r--r-- | src/corelib/Qt6CTestMacros.cmake | 14 |
1 files changed, 13 insertions, 1 deletions
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}") |