summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2021-10-29 13:52:02 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2021-10-29 14:54:02 (GMT)
commit9c4d6404eb4ac0016d2d107d8c24c8097d4e2359 (patch)
treebfe497277ead56803eca22e53bb244d82d3f73b5 /Tests
parent7d52d48a329d6a1c456b48f63c980cce799f3a9c (diff)
downloadCMake-9c4d6404eb4ac0016d2d107d8c24c8097d4e2359.zip
CMake-9c4d6404eb4ac0016d2d107d8c24c8097d4e2359.tar.gz
CMake-9c4d6404eb4ac0016d2d107d8c24c8097d4e2359.tar.bz2
Tests/Environment: also test modifying ambient values
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt7
-rw-r--r--Tests/Environment/CMakeLists.txt8
-rw-r--r--Tests/Environment/check_mod.cmake9
3 files changed, 24 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index d1f7b69..ecb54c7 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1379,6 +1379,13 @@ if(BUILD_TESTING)
--test-command ${CMAKE_CTEST_COMMAND} -V
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Environment")
+ set_property(TEST Environment APPEND
+ PROPERTY ENVIRONMENT
+ "SET_FROM_AMBIENT_unset=base"
+ "SET_FROM_AMBIENT_replace=base"
+ "SET_FROM_AMBIENT_string=base"
+ "SET_FROM_AMBIENT_path=base"
+ "SET_FROM_AMBIENT_list=base")
add_test(QtAutomocNoQt ${CMAKE_CTEST_COMMAND}
--build-and-test
diff --git a/Tests/Environment/CMakeLists.txt b/Tests/Environment/CMakeLists.txt
index 9397bfe..abcf33c 100644
--- a/Tests/Environment/CMakeLists.txt
+++ b/Tests/Environment/CMakeLists.txt
@@ -37,6 +37,14 @@ set_property(TEST EchoEnvironment3
set_property(TEST EchoEnvironment3
PROPERTY ENVIRONMENT_MODIFICATION
+ # Modifying variables set in the ambient environment (see properties for
+ # this test in `Tests/CMakeLists.txt`).
+ "SET_FROM_AMBIENT_unset=unset:"
+ "SET_FROM_AMBIENT_replace=set:new"
+ "SET_FROM_AMBIENT_string=string_append:new"
+ "SET_FROM_AMBIENT_path=path_list_append:new"
+ "SET_FROM_AMBIENT_list=cmake_list_append:new"
+
# Modifying variables set in the `ENVIRONMENT` property.
"SET_FROM_ENVIRONMENT_PROPERTY_unset=unset:"
"SET_FROM_ENVIRONMENT_PROPERTY_replace=set:new"
diff --git a/Tests/Environment/check_mod.cmake b/Tests/Environment/check_mod.cmake
index 0691b17..0f885f0 100644
--- a/Tests/Environment/check_mod.cmake
+++ b/Tests/Environment/check_mod.cmake
@@ -14,6 +14,7 @@ else ()
set(path_sep ":")
endif ()
+set(unexpect_SET_FROM_AMBIENT_unset "")
set(unexpect_SET_FROM_ENVIRONMENT_PROPERTY_unset "")
set(unexpect_UNSET_EXPLICIT "")
set(unexpect_UNSET_VIA_RESET "")
@@ -24,12 +25,20 @@ set(expect_CMAKE_LIST_MANIP "prefix;pre;core;post;suffix")
set(expect_STRING_DNE "prefix-prepost-suffix")
set(expect_PATH_DNE "prefix${path_sep}pre${path_sep}post${path_sep}suffix")
set(expect_CMAKE_LIST_DNE "prefix;pre;post;suffix")
+set(expect_SET_FROM_AMBIENT_replace "new")
+set(expect_SET_FROM_AMBIENT_string "basenew")
+set(expect_SET_FROM_AMBIENT_path "base${path_sep}new")
+set(expect_SET_FROM_AMBIENT_list "base;new")
set(expect_SET_FROM_ENVIRONMENT_PROPERTY_replace "new")
set(expect_SET_FROM_ENVIRONMENT_PROPERTY_string "basenew")
set(expect_SET_FROM_ENVIRONMENT_PROPERTY_path "base${path_sep}new")
set(expect_SET_FROM_ENVIRONMENT_PROPERTY_list "base;new")
set(expected_vars
+ SET_FROM_AMBIENT_replace
+ SET_FROM_AMBIENT_string
+ SET_FROM_AMBIENT_path
+ SET_FROM_AMBIENT_list
SET_FROM_ENVIRONMENT_PROPERTY_replace
SET_FROM_ENVIRONMENT_PROPERTY_string
SET_FROM_ENVIRONMENT_PROPERTY_path