summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMakePresetsTest
diff options
context:
space:
mode:
authorSam Freed <safreed@microsoft.com>2021-03-15 21:45:59 (GMT)
committerSam Freed <safreed@microsoft.com>2021-03-15 21:53:00 (GMT)
commitb9eb3541cf16fd393183e077257f21061d25c521 (patch)
tree2c05396ec475d28c62d72afd80417a1686c55c57 /Tests/RunCMake/CMakePresetsTest
parent83eeeff7dc0cf5c298d8696096926c57cd6cff5e (diff)
downloadCMake-b9eb3541cf16fd393183e077257f21061d25c521.zip
CMake-b9eb3541cf16fd393183e077257f21061d25c521.tar.gz
CMake-b9eb3541cf16fd393183e077257f21061d25c521.tar.bz2
Tests: update tests to catch invalid configurePreset at read-time
Diffstat (limited to 'Tests/RunCMake/CMakePresetsTest')
-rw-r--r--Tests/RunCMake/CMakePresetsTest/Invalid.json.in4
-rw-r--r--Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.cmake0
-rw-r--r--Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.json.in16
-rw-r--r--Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake4
8 files changed, 25 insertions, 5 deletions
diff --git a/Tests/RunCMake/CMakePresetsTest/Invalid.json.in b/Tests/RunCMake/CMakePresetsTest/Invalid.json.in
index c7096f2..cfcf4b7 100644
--- a/Tests/RunCMake/CMakePresetsTest/Invalid.json.in
+++ b/Tests/RunCMake/CMakePresetsTest/Invalid.json.in
@@ -18,10 +18,6 @@
"environment": {
"TEST": "$vendor{bad.TEST}"
}
- },
- {
- "name": "badConfigurePreset",
- "configurePreset": "dne"
}
]
}
diff --git a/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-result.txt b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-stderr.txt b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-stderr.txt
new file mode 100644
index 0000000..3d7cdd0
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset: Invalid "configurePreset" field
diff --git a/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-result.txt b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-stderr.txt b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-stderr.txt
new file mode 100644
index 0000000..3d7cdd0
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset: Invalid "configurePreset" field
diff --git a/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.cmake b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.cmake
diff --git a/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.json.in b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.json.in
new file mode 100644
index 0000000..e305c42
--- /dev/null
+++ b/Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.json.in
@@ -0,0 +1,16 @@
+{
+ "version": 2,
+ "configurePresets": [
+ {
+ "name": "default",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build/${presetName}"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "badConfigurePreset",
+ "configurePreset": "dne"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
index 4ffdfab..c93dff3 100644
--- a/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresetsTest/RunCMakeTest.cmake
@@ -85,6 +85,8 @@ run_cmake_test_presets(Good
"${GoodTestPresets}")
unset(CMakePresetsTest_ASSETS)
+run_cmake_test_presets(InvalidConfigurePreset "default" "" "badConfigurePreset")
+
set(CMakePresetsTest_NO_CONFIGURE 1)
set(CMakePresetsTest_FILE "${RunCMake_SOURCE_DIR}/Good.json.in")
run_cmake_test_presets(ListPresets "" "" "x" "--list-presets")
@@ -92,7 +94,7 @@ unset(CMakePresetsTest_FILE)
run_cmake_test_presets(NoConfigurePreset "" "" "noConfigurePreset")
run_cmake_test_presets(NoTestsAction "default" "" "noTestsAction")
-run_cmake_test_presets(Invalid "" "" "hidden;vendorMacro;badConfigurePreset")
+run_cmake_test_presets(Invalid "" "" "hidden;vendorMacro")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_test_presets(PresetsUnsupported "" "" "x")