summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-22 15:04:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-10-22 15:05:09 (GMT)
commit609122007dc074739b394d2f70f674bbccca6073 (patch)
tree066983f69d1ac1a43b1da6750cdca6fe5f5446b0 /Tests/RunCMake
parent6af1185bb4a4cdc826763ea38db0e59e5ed3ffd7 (diff)
parent638557cbfe0618d5a0fc6f9088e34aac708f5519 (diff)
downloadCMake-609122007dc074739b394d2f70f674bbccca6073.zip
CMake-609122007dc074739b394d2f70f674bbccca6073.tar.gz
CMake-609122007dc074739b394d2f70f674bbccca6073.tar.bz2
Merge topic 'cmake-presets-invalid-macro' into release-3.19
638557cbfe CMakePresets.json: Properly report macro expansion errors Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5397
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakePresets/CMakePresets.json.in35
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnv.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyPenv.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/EnvCycle.json.in14
-rw-r--r--Tests/RunCMake/CMakePresets/ListPresets.json.in2
-rw-r--r--Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/NoSuchMacro.json.in10
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt3
-rw-r--r--Tests/RunCMake/CMakePresets/UnclosedMacro.json.in10
13 files changed, 78 insertions, 46 deletions
diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
index 18b9c3a..ea7df45 100644
--- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in
+++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
@@ -322,16 +322,6 @@
"binaryDir": "${sourceDir}/build"
},
{
- "name": "UnclosedMacro",
- "generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${sourceDir"
- },
- {
- "name": "NoSuchMacro",
- "generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${noexist}"
- },
- {
"name": "VendorMacro",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "$vendor{unknown.unknownMacro}"
@@ -342,31 +332,6 @@
"binaryDir": "${sourceDir}/build"
},
{
- "name": "EnvCycle",
- "generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${sourceDir}/build",
- "environment": {
- "ENV_1": "$env{ENV_2}",
- "ENV_2": "$env{ENV_1}"
- }
- },
- {
- "name": "EmptyEnv",
- "generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${sourceDir}/build",
- "cacheVariables": {
- "MY_VAR": "$env{}"
- }
- },
- {
- "name": "EmptyPenv",
- "generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${sourceDir}/build",
- "cacheVariables": {
- "MY_VAR": "$penv{}"
- }
- },
- {
"name": "UseHiddenPreset",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build",
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt
index 9c9c025..723ac21 100644
--- a/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt
@@ -1 +1,2 @@
-^CMake Error: Could not evaluate preset "EmptyEnv": Invalid macro expansion$
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/EmptyEnv: Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv.json.in b/Tests/RunCMake/CMakePresets/EmptyEnv.json.in
new file mode 100644
index 0000000..ef0d575
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyEnv.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "EmptyEnv",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "MY_VAR": "$env{}"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt
index 395c7b4..880cee6 100644
--- a/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt
@@ -1 +1,2 @@
-^CMake Error: Could not evaluate preset "EmptyPenv": Invalid macro expansion$
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/EmptyPenv: Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv.json.in b/Tests/RunCMake/CMakePresets/EmptyPenv.json.in
new file mode 100644
index 0000000..9081fe5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyPenv.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "EmptyPenv",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "MY_VAR": "$penv{}"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt b/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt
index c8568f1..1d22b87 100644
--- a/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/EnvCycle-stderr.txt
@@ -1 +1,2 @@
-^CMake Error: Could not evaluate preset "EnvCycle": Invalid macro expansion$
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/EnvCycle: Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/EnvCycle.json.in b/Tests/RunCMake/CMakePresets/EnvCycle.json.in
new file mode 100644
index 0000000..25a1349
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EnvCycle.json.in
@@ -0,0 +1,14 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "EnvCycle",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "environment": {
+ "ENV_1": "$env{ENV_2}",
+ "ENV_2": "$env{ENV_1}"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/ListPresets.json.in b/Tests/RunCMake/CMakePresets/ListPresets.json.in
index c7646c6..2ef3797 100644
--- a/Tests/RunCMake/CMakePresets/ListPresets.json.in
+++ b/Tests/RunCMake/CMakePresets/ListPresets.json.in
@@ -26,7 +26,7 @@
{
"name": "invalid-macro",
"generator": "@RunCMake_GENERATOR@",
- "binaryDir": "${noexist}"
+ "binaryDir": "$vendor{noexist}"
},
{
"name": "ListPresetsHidden",
diff --git a/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt b/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt
index 08fa87b..7dafe62 100644
--- a/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/NoSuchMacro-stderr.txt
@@ -1 +1,2 @@
-^CMake Error: Could not evaluate preset "NoSuchMacro": Invalid macro expansion$
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/NoSuchMacro: Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/NoSuchMacro.json.in b/Tests/RunCMake/CMakePresets/NoSuchMacro.json.in
new file mode 100644
index 0000000..94d0b76
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/NoSuchMacro.json.in
@@ -0,0 +1,10 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "NoSuchMacro",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${noexist}"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index e0e54f4..dddf05f 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -121,6 +121,13 @@ run_cmake_presets(InvalidCMakeGeneratorConfig)
run_cmake_presets(UnknownCMakeGeneratorConfig)
run_cmake_presets(EmptyCacheKey)
run_cmake_presets(EmptyEnvKey)
+set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
+run_cmake_presets(UnclosedMacro)
+run_cmake_presets(NoSuchMacro)
+run_cmake_presets(EnvCycle)
+run_cmake_presets(EmptyEnv)
+run_cmake_presets(EmptyPenv)
+set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
# Test cmakeMinimumRequired field
run_cmake_presets(MinimumRequiredInvalid)
@@ -170,13 +177,8 @@ run_cmake_presets(GoodInheritanceMultiSecond)
run_cmake_presets(GoodInheritanceMacro)
# Test bad preset arguments
-run_cmake_presets(UnclosedMacro)
-run_cmake_presets(NoSuchMacro)
run_cmake_presets(VendorMacro)
run_cmake_presets(InvalidGenerator)
-run_cmake_presets(EnvCycle)
-run_cmake_presets(EmptyEnv)
-run_cmake_presets(EmptyPenv)
# Test Visual Studio-specific stuff
if(RunCMake_GENERATOR MATCHES "^Visual Studio ")
diff --git a/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt b/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt
index 248510d..f9481f0 100644
--- a/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt
+++ b/Tests/RunCMake/CMakePresets/UnclosedMacro-stderr.txt
@@ -1 +1,2 @@
-^CMake Error: Could not evaluate preset "UnclosedMacro": Invalid macro expansion$
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/UnclosedMacro: Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/UnclosedMacro.json.in b/Tests/RunCMake/CMakePresets/UnclosedMacro.json.in
new file mode 100644
index 0000000..ad6cf7d
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/UnclosedMacro.json.in
@@ -0,0 +1,10 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "UnclosedMacro",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir"
+ }
+ ]
+}