summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-05-18 15:52:38 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-05-19 14:26:57 (GMT)
commita1612af7497ca8496f216d95e25e4809da7c7c99 (patch)
treec90a9b926e50ccc78e36ad9366b27a35afee6bc7 /Tests/RunCMake/ctest_test/TestEnvironment-check.cmake
parent6d9bc2d8cf41d651a6e8c9f6e3e6f5ab384d1f6a (diff)
downloadCMake-a1612af7497ca8496f216d95e25e4809da7c7c99.zip
CMake-a1612af7497ca8496f216d95e25e4809da7c7c99.tar.gz
CMake-a1612af7497ca8496f216d95e25e4809da7c7c99.tar.bz2
CTest: Log environment variables as a test measurement
Diffstat (limited to 'Tests/RunCMake/ctest_test/TestEnvironment-check.cmake')
-rw-r--r--Tests/RunCMake/ctest_test/TestEnvironment-check.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake b/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake
new file mode 100644
index 0000000..91c9731
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestEnvironment-check.cmake
@@ -0,0 +1,10 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag)
+string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}")
+file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents)
+
+if(NOT _test_contents MATCHES "<Value>ENV1=env1\nENV2=env2\n#CTEST_RESOURCE_GROUP_COUNT=</Value>")
+ string(APPEND RunCMake_TEST_FAILED "Could not find expected environment variables in Test.xml")
+endif()
+if(_test_contents MATCHES "BAD_ENVIRONMENT_VARIABLE")
+ string(APPEND RunCMake_TEST_FAILED "Found BAD_ENVIRONMENT_VARIABLE in Test.xml")
+endif()