Ver código fonte

Tests: update tests to catch invalid configurePreset at read-time

Sam Freed 4 anos atrás
pai
commit
b9eb3541cf

+ 0 - 4
Tests/RunCMake/CMakePresetsBuild/Invalid.json.in

@@ -18,10 +18,6 @@
             "environment": {
                 "TEST": "$vendor{bad.TEST}"
             }
-        },
-        {
-            "name": "badConfigurePreset",
-            "configurePreset": "dne"
         }
     ]
 }

+ 1 - 0
Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset-build-badConfigurePreset-result.txt

@@ -0,0 +1 @@
+1

+ 2 - 0
Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset-build-badConfigurePreset-stderr.txt

@@ -0,0 +1,2 @@
+CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset: Invalid "configurePreset" field

+ 1 - 0
Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset-configure-default-result.txt

@@ -0,0 +1 @@
+1

+ 2 - 0
Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset-configure-default-stderr.txt

@@ -0,0 +1,2 @@
+CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset: Invalid "configurePreset" field

+ 0 - 0
Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset.cmake


+ 16 - 0
Tests/RunCMake/CMakePresetsBuild/InvalidConfigurePreset.json.in

@@ -0,0 +1,16 @@
+{
+    "version": 2,
+    "configurePresets": [
+        {
+            "name": "default",
+            "generator": "@RunCMake_GENERATOR@",
+            "binaryDir": "${sourceDir}/build/${presetName}"
+        }
+    ],
+    "buildPresets": [
+        {
+            "name": "badConfigurePreset",
+            "configurePreset": "dne"
+        }
+    ]
+}

+ 2 - 1
Tests/RunCMake/CMakePresetsBuild/RunCMakeTest.cmake

@@ -63,11 +63,12 @@ endfunction()
 set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)
 
 run_cmake_build_presets(Good "default;other" "build-other;withEnvironment;noEnvironment;macros;vendorObject")
+run_cmake_build_presets(InvalidConfigurePreset "default" "badConfigurePreset")
 
 set(CMakePresetsBuild_BUILD_ONLY 1)
 run_cmake_build_presets(ListPresets "x" "x" "--list-presets")
 run_cmake_build_presets(NoConfigurePreset "x" "noConfigurePreset")
-run_cmake_build_presets(Invalid "x" "hidden;vendorMacro;badConfigurePreset")
+run_cmake_build_presets(Invalid "x" "hidden;vendorMacro")
 
 set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
 run_cmake_build_presets(PresetsUnsupported "x" "x")

+ 0 - 4
Tests/RunCMake/CMakePresetsTest/Invalid.json.in

@@ -18,10 +18,6 @@
             "environment": {
                 "TEST": "$vendor{bad.TEST}"
             }
-        },
-        {
-            "name": "badConfigurePreset",
-            "configurePreset": "dne"
         }
     ]
 }

+ 1 - 0
Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-configure-default-result.txt

@@ -0,0 +1 @@
+1

+ 2 - 0
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

+ 1 - 0
Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset-test-badConfigurePreset-result.txt

@@ -0,0 +1 @@
+1

+ 2 - 0
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

+ 0 - 0
Tests/RunCMake/CMakePresetsTest/InvalidConfigurePreset.cmake


+ 16 - 0
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"
+        }
+    ]
+}

+ 3 - 1
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")