diff options
author | Gabor Bencze <b.gabor98@gmail.com> | 2019-07-18 14:58:14 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2019-07-18 15:52:10 (GMT) |
commit | d7955d4e5d3038930f333bf12e15a09c7ae6088c (patch) | |
tree | d1db54fa5f24c4798b29da105a69baaaa66eb6e2 /Tests/RunCMake/CTestCommandLine | |
parent | 4f1dec86a53b789d164827eb6e89696f9e59f1c0 (diff) | |
download | CMake-d7955d4e5d3038930f333bf12e15a09c7ae6088c.zip CMake-d7955d4e5d3038930f333bf12e15a09c7ae6088c.tar.gz CMake-d7955d4e5d3038930f333bf12e15a09c7ae6088c.tar.bz2 |
Tests: Create test for SKIP_REGULAR_EXPRESSION test property
Diffstat (limited to 'Tests/RunCMake/CTestCommandLine')
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/SkipRegexFound-check.cmake | 13 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index f417db0..3fee79c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -120,6 +120,20 @@ set_tests_properties(test1 PROPERTIES FAIL_REGULAR_EXPRESSION \"foo;test1;bar\" endfunction() run_FailRegexFoundTest() +function(run_SkipRegexFoundTest) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SkipRegexFound) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(test1 \"${CMAKE_COMMAND}\" -E echo \"test1\") +set_tests_properties(test1 PROPERTIES SKIP_REGULAR_EXPRESSION \"test1\") +") + + run_cmake_command(SkipRegexFound ${CMAKE_CTEST_COMMAND} -V) +endfunction() +run_SkipRegexFoundTest() + function(run_SerialFailed) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SerialFailed) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/CTestCommandLine/SkipRegexFound-check.cmake b/Tests/RunCMake/CTestCommandLine/SkipRegexFound-check.cmake new file mode 100644 index 0000000..1a2dfa3 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/SkipRegexFound-check.cmake @@ -0,0 +1,13 @@ +set(last_test_log "${RunCMake_TEST_BINARY_DIR}/Testing/Temporary/LastTest.log") +if(EXISTS "${last_test_log}") + file(READ "${last_test_log}" last_test_log_content) + string(REGEX REPLACE "\n+$" "" last_test_log_content "${last_test_log_content}") + if(NOT last_test_log_content MATCHES " +Test Pass Reason: +Skip regular expression found in output. Regex=[[]test1]") + string(REPLACE "\n" "\n " last_test_log_content " ${last_test_log_content}") + set(RunCMake_TEST_FAILED "LastTest.log does not have expected content:\n${last_test_log_content}") + endif() +else() + set(RunCMake_TEST_FAILED "LastTest.log missing:\n ${last_test_log}") +endif() |