diff options
author | Brad King <brad.king@kitware.com> | 2023-09-07 15:00:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-07 15:46:53 (GMT) |
commit | be657bf1e0c6a2ff9bc723309619e484c2a79a32 (patch) | |
tree | 94ca782a2f9b4e0f0d719498e0aa40cf34de5c69 /Tests/RunCMake | |
parent | 1c5e4b60b1776504fb75878dda05a5e7c862decb (diff) | |
download | CMake-be657bf1e0c6a2ff9bc723309619e484c2a79a32.zip CMake-be657bf1e0c6a2ff9bc723309619e484c2a79a32.tar.gz CMake-be657bf1e0c6a2ff9bc723309619e484c2a79a32.tar.bz2 |
Tests: Migrate CTestTest{NoBuild,NoExe} to RunCMake.ctest_{build,test}
Avoid duplicating infrastructure provided by the latter.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_build/BuildFailure.cxx | 4 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_build/RunCMakeTest.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/NotRun-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/NotRun-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/NotRun-stdout.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt | 4 |
10 files changed, 42 insertions, 15 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index c90d543..223a61c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -472,7 +472,7 @@ add_test(test1 \"${CMAKE_COMMAND}\" -E false) add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"hello world\") add_test(test3 \"${CMAKE_COMMAND}\" -E true) set_tests_properties(test3 PROPERTIES DISABLED \"ON\") -add_test(test4 \"${CMAKE_COMMAND}/doesnt_exist\") +add_test(test4 \"${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist\") add_test(test5 \"${CMAKE_COMMAND}\" -E echo \"please skip\") set_tests_properties(test5 PROPERTIES SKIP_REGULAR_EXPRESSION \"please skip\") ") diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt index ce30dc8..c57c378 100644 --- a/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt @@ -1 +1,2 @@ -Unable to find executable: .*doesnt_exist +Unable to find executable:[^ +]*does_not_exist diff --git a/Tests/RunCMake/ctest_build/BuildFailure.cxx b/Tests/RunCMake/ctest_build/BuildFailure.cxx new file mode 100644 index 0000000..8102883 --- /dev/null +++ b/Tests/RunCMake/ctest_build/BuildFailure.cxx @@ -0,0 +1,4 @@ +int main() +{ + this code will not compile +} diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake index 12525f2..af56ead 100644 --- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake @@ -13,18 +13,18 @@ endfunction() run_ctest_build(BuildQuiet QUIET) run_ctest_build(ParallelLevel PARALLEL_LEVEL 1) -function(run_BuildFailure) - set(CASE_CMAKELISTS_SUFFIX_CODE [[ -add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) -]]) +block() + set(LANG CXX) + configure_file("${RunCMake_SOURCE_DIR}/BuildFailure.cxx" "${RunCMake_BINARY_DIR}/BuildFailure/BuildFailure.cxx" COPYONLY) + set(CASE_CMAKELISTS_SUFFIX_CODE [=[ + add_executable(BuildFailure BuildFailure.cxx) + ]=]) set(CASE_CMAKELISTS_PREFIX_CODE [[ if(NOT CTEST_USE_LAUNCHERS) message(FATAL_ERROR "CTEST_USE_LAUNCHERS not set") endif() ]]) - set(CASE_TEST_PREFIX_CODE [[ -cmake_policy(SET CMP0061 NEW) -]]) + set(CASE_TEST_PREFIX_CODE "") set(CASE_TEST_SUFFIX_CODE [[ if (ctest_build_return_value) message("ctest_build returned non-zero") @@ -35,13 +35,16 @@ endif() run_ctest(BuildFailure) if (RunCMake_GENERATOR MATCHES "Makefiles") + set(LANG NONE) set(CASE_TEST_PREFIX_CODE [[ cmake_policy(VERSION 3.2) ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_custom_target(BuildFailure ALL COMMAND command-does-not-exist) +]]) run_ctest(BuildFailure-CMP0061-OLD) endif() -endfunction() -run_BuildFailure() +endblock() function(run_BuildChangeId) set(CASE_TEST_PREFIX_CODE [[ diff --git a/Tests/RunCMake/ctest_test/NotRun-result.txt b/Tests/RunCMake/ctest_test/NotRun-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_test/NotRun-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_test/NotRun-stderr.txt b/Tests/RunCMake/ctest_test/NotRun-stderr.txt new file mode 100644 index 0000000..85907f3 --- /dev/null +++ b/Tests/RunCMake/ctest_test/NotRun-stderr.txt @@ -0,0 +1,2 @@ +.*Unable to find executable[^ +]*does_not_exist diff --git a/Tests/RunCMake/ctest_test/NotRun-stdout.txt b/Tests/RunCMake/ctest_test/NotRun-stdout.txt new file mode 100644 index 0000000..8d60833 --- /dev/null +++ b/Tests/RunCMake/ctest_test/NotRun-stdout.txt @@ -0,0 +1,7 @@ +.*Could not find executable[^ +]*does_not_exist +.* +50% tests passed, 1 tests failed out of 2 +.* +The following tests FAILED: +.*testNotRun \(Not Run\) diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 242a059..d2f3da3 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -53,6 +53,13 @@ unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) unset(CASE_CTEST_TEST_LOAD) unset(RunCTest_VERBOSE_FLAG) +block() + set(CASE_CMAKELISTS_SUFFIX_CODE [[ + add_test(NAME testNotRun COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist) + ]]) + run_ctest_test(NotRun) +endblock() + function(run_TestChangeId) set(CASE_TEST_PREFIX_CODE [[ set(CTEST_CHANGE_ID "<>1") @@ -131,8 +138,7 @@ run_TestRepeat(AfterTimeout RETURN_VALUE:0 REPEAT AFTER_TIMEOUT:3) # test repeat and not run tests interact correctly set(CASE_CMAKELISTS_SUFFIX_CODE [[ -add_test(NAME testNotRun - COMMAND ${CMAKE_COMMAND}/doesnt_exist) + add_test(NAME testNotRun COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist) set_property(TEST testNotRun PROPERTY TIMEOUT 5) ]]) run_TestRepeat(NotRun RETURN_VALUE:1 REPEAT UNTIL_PASS:3) diff --git a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt index a69932d..85907f3 100644 --- a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt +++ b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stderr.txt @@ -1 +1,2 @@ -.*Unable to find executable.* +.*Unable to find executable[^ +]*does_not_exist diff --git a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt index 72c98bc..8d60833 100644 --- a/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt +++ b/Tests/RunCMake/ctest_test/TestRepeatNotRun-stdout.txt @@ -1,5 +1,7 @@ +.*Could not find executable[^ +]*does_not_exist .* 50% tests passed, 1 tests failed out of 2 .* The following tests FAILED: -.*testNotRun.*Not Run.* +.*testNotRun \(Not Run\) |