diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2023-08-10 18:41:39 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2023-08-11 14:50:52 (GMT) |
commit | efc8f19cc5b4442cbfb9c40f36b8d3909d42cd92 (patch) | |
tree | aacac6992d3f914f26e2a642eb5dce7ecc5f0f99 /Tests | |
parent | 753999d4db842a73727f7efb68ce1b6406b5913b (diff) | |
download | CMake-efc8f19cc5b4442cbfb9c40f36b8d3909d42cd92.zip CMake-efc8f19cc5b4442cbfb9c40f36b8d3909d42cd92.tar.gz CMake-efc8f19cc5b4442cbfb9c40f36b8d3909d42cd92.tar.bz2 |
set_tests_properties(): Add DIRECTORY option
Diffstat (limited to 'Tests')
9 files changed, 43 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f8b84b2..8562e2b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1064,6 +1064,7 @@ add_RunCMake_test(CMakePresetsWorkflow ) add_RunCMake_test(VerifyHeaderSets) +add_RunCMake_test(set_tests_properties) if(${CMAKE_GENERATOR} MATCHES "Make|Ninja") add_RunCMake_test(TransformDepfile) diff --git a/Tests/RunCMake/set_tests_properties/CMakeLists.txt b/Tests/RunCMake/set_tests_properties/CMakeLists.txt new file mode 100644 index 0000000..922aad6 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.27) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-result.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-stderr.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-stderr.txt new file mode 100644 index 0000000..e219399 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at DIRECTORY-invalid\.cmake:[0-9]+ \(set_tests_properties\): + Error after keyword "DIRECTORY": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) + + +CMake Error at DIRECTORY-invalid\.cmake:[0-9]+ \(set_tests_properties\): + set_tests_properties given non-existent DIRECTORY nonexistent +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid.cmake b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid.cmake new file mode 100644 index 0000000..4d87df1 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-invalid.cmake @@ -0,0 +1,4 @@ +enable_testing() + +set_tests_properties(t DIRECTORY PROPERTIES PASS_REGULAR_EXPRESSION "Top directory") +set_tests_properties(t DIRECTORY nonexistent PROPERTIES PASS_REGULAR_EXPRESSION "Top directory") diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir1/CMakeLists.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir1/CMakeLists.txt new file mode 100644 index 0000000..b1fad66 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir1/CMakeLists.txt @@ -0,0 +1,3 @@ +add_test(NAME t COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") +add_test(NAME t2 COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") +add_test(NAME t3 COMMAND ${CMAKE_COMMAND} -E echo "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir2/CMakeLists.txt b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir2/CMakeLists.txt new file mode 100644 index 0000000..8859597 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY-subdir2/CMakeLists.txt @@ -0,0 +1 @@ +set_tests_properties(t3 DIRECTORY ../DIRECTORY-subdir1 PROPERTIES PASS_REGULAR_EXPRESSION "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/DIRECTORY.cmake b/Tests/RunCMake/set_tests_properties/DIRECTORY.cmake new file mode 100644 index 0000000..87d13e3 --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/DIRECTORY.cmake @@ -0,0 +1,9 @@ +enable_testing() + +add_test(NAME t COMMAND ${CMAKE_COMMAND} -E echo "Top directory") +add_subdirectory(DIRECTORY-subdir1) +add_subdirectory(DIRECTORY-subdir2) + +set_tests_properties(t PROPERTIES PASS_REGULAR_EXPRESSION "Top directory") +set_tests_properties(t DIRECTORY DIRECTORY-subdir1 PROPERTIES PASS_REGULAR_EXPRESSION "Subdirectory") +set_tests_properties(t2 DIRECTORY "${CMAKE_BINARY_DIR}/DIRECTORY-subdir1" PROPERTIES PASS_REGULAR_EXPRESSION "Subdirectory") diff --git a/Tests/RunCMake/set_tests_properties/RunCMakeTest.cmake b/Tests/RunCMake/set_tests_properties/RunCMakeTest.cmake new file mode 100644 index 0000000..b49158f --- /dev/null +++ b/Tests/RunCMake/set_tests_properties/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(DIRECTORY-invalid) + +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DIRECTORY-build) +run_cmake(DIRECTORY) +set(RunCMake_TEST_NO_CLEAN 1) +run_cmake_command(DIRECTORY-test ${CMAKE_CTEST_COMMAND} -C Debug) |