summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2024-06-07 07:01:50 (GMT)
committerCraig Scott <craig.scott@crascit.com>2024-06-07 07:58:55 (GMT)
commitf97b25ec4b29c2a6825a255e5994995bed7328ec (patch)
treec66600add16a17b0593597014688d7570a28a556
parent11b684c449fd736575de2c4446f9e1e5fcbb56ba (diff)
downloadCMake-f97b25ec4b29c2a6825a255e5994995bed7328ec.zip
CMake-f97b25ec4b29c2a6825a255e5994995bed7328ec.tar.gz
CMake-f97b25ec4b29c2a6825a255e5994995bed7328ec.tar.bz2
Tests: Fix -direct variants of FetchContent tests using wrong files
The -direct variants of the RunCMake.FetchContent tests were meant to be using the same result, stdout and stderr files as the non-direct tests. The -direct tests were specified in the wrong way for that and ended up using no files at all, so they weren't testing the full set of expected conditions. Use the test variant feature provided by the RunCMake infrastructure instead, which is the proper way to handle this sort of scenario.
-rw-r--r--Tests/RunCMake/FetchContent/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake13
2 files changed, 6 insertions, 8 deletions
diff --git a/Tests/RunCMake/FetchContent/CMakeLists.txt b/Tests/RunCMake/FetchContent/CMakeLists.txt
index eb0b40c..04d024b 100644
--- a/Tests/RunCMake/FetchContent/CMakeLists.txt
+++ b/Tests/RunCMake/FetchContent/CMakeLists.txt
@@ -6,7 +6,6 @@ file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/_deps)
if(CMP0168 STREQUAL "NEW")
cmake_policy(SET CMP0168 NEW)
- string(REGEX REPLACE "-direct$" "" RunCMake_TEST "${RunCMake_TEST}")
else()
cmake_policy(SET CMP0168 OLD)
endif()
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index d0ec638..c0c32f3 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -4,7 +4,8 @@ unset(RunCMake_TEST_NO_CLEAN)
function(run_cmake_with_cmp0168 name)
run_cmake_with_options("${name}" -D CMP0168=OLD ${ARGN})
- run_cmake_with_options("${name}-direct" -D CMP0168=NEW ${ARGN})
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-direct")
+ run_cmake_with_options("${name}" -D CMP0168=NEW ${ARGN})
endfunction()
# Won't get to the part where CMP0168 matters
@@ -46,18 +47,16 @@ run_cmake_with_cmp0168(ManualSourceDirectoryRelative
function(run_FetchContent_DirOverrides cmp0168)
if(cmp0168 STREQUAL "NEW")
- set(suffix "-direct")
- else()
- set(suffix "")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-direct")
endif()
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides${suffix}-build)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides${RunCMake_TEST_VARIANT_DESCRIPTION}-build)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
- run_cmake_with_options(DirOverrides${suffix} -D CMP0168=${cmp0168})
+ run_cmake_with_options(DirOverrides -D CMP0168=${cmp0168})
set(RunCMake_TEST_NO_CLEAN 1)
- run_cmake_with_options(DirOverridesDisconnected${suffix}
+ run_cmake_with_options(DirOverridesDisconnected
-D CMP0168=${cmp0168}
-D FETCHCONTENT_FULLY_DISCONNECTED=YES
)