diff options
author | Brad King <brad.king@kitware.com> | 2021-12-09 15:38:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-12-09 15:39:20 (GMT) |
commit | 78c20892bfef6a961e780b0380c37537d1ee178b (patch) | |
tree | 96be00c28c5cb5f10df012e4d7fcf4228ffc7330 /Tests | |
parent | 01e768850a4b250c5775e95c1568d59de07105de (diff) | |
parent | 7c5a120c38a90ee2ac262371410b5e31fd6f52be (diff) | |
download | CMake-78c20892bfef6a961e780b0380c37537d1ee178b.zip CMake-78c20892bfef6a961e780b0380c37537d1ee178b.tar.gz CMake-78c20892bfef6a961e780b0380c37537d1ee178b.tar.bz2 |
Merge topic 'ctest-add_subdirectory'
7c5a120c38 Tests: Add case covering both ctest subdirectory commands
04deda1d2a CTest: Extract common implementation of add_subdirectory and subdirs
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6795
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 32 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/Subdirectories-stdout.txt | 8 |
2 files changed, 40 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 4b654f8..7da95a2 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -85,6 +85,38 @@ subdirs() endfunction() run_BadCTestTestfile() +function(run_Subdirectories) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Subdirectories) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/add_subdirectory") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/add_subdirectory/sub") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/subdirs") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/subdirs/sub") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_subdirectory(add_subdirectory) +subdirs(subdirs) +") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/add_subdirectory/CTestTestfile.cmake" " +add_test(add_subdirectory \"${CMAKE_COMMAND}\" -E echo add_subdirectory) +add_subdirectory(sub) +") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/add_subdirectory/sub/CTestTestfile.cmake" " +add_test(add_subdirectory.sub \"${CMAKE_COMMAND}\" -E echo add_subdirectory.sub) +") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/subdirs/CTestTestfile.cmake" " +add_test(subdirs \"${CMAKE_COMMAND}\" -E echo subdirs) +subdirs(sub) +") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/subdirs/sub/CTestTestfile.cmake" " +add_test(subdirs.sub \"${CMAKE_COMMAND}\" -E echo subdirs.sub) +") + + run_cmake_command(Subdirectories ${CMAKE_CTEST_COMMAND} -N) +endfunction() +run_Subdirectories() + function(run_MergeOutput) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MergeOutput) set(RunCMake_TEST_NO_CLEAN 1) diff --git a/Tests/RunCMake/CTestCommandLine/Subdirectories-stdout.txt b/Tests/RunCMake/CTestCommandLine/Subdirectories-stdout.txt new file mode 100644 index 0000000..770609a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/Subdirectories-stdout.txt @@ -0,0 +1,8 @@ +^Test project [^ +]*/Tests/RunCMake/CTestCommandLine/Subdirectories + Test #1: add_subdirectory + Test #2: add_subdirectory\.sub + Test #3: subdirs + Test #4: subdirs\.sub ++ +Total Tests: 4$ |