presets: Diagnose invalid test filter index types

This commit is contained in:
Maximilian Sander
2026-07-29 18:20:32 +02:00
parent b1d80531dc
commit d4bb9f2c53
7 changed files with 40 additions and 0 deletions
+8
View File
@@ -252,6 +252,14 @@ void WORKFLOW_STEP_CONFIGURE_PRESET_MISMATCH(
"\", but workflow configure preset is \"", workflowConfigurePreset, '"'));
}
void INVALID_TEST_FILTER_INCLUDE_INDEX(Json::Value const* value,
cmJSONState* state)
{
state->AddErrorAtValue(
"Invalid \"filter.include.index\" field: expected a string or object",
value);
}
void NO_WORKFLOW_STEPS(std::string const& presetName, cmJSONState* state)
{
state->AddError(
+3
View File
@@ -98,6 +98,9 @@ void WORKFLOW_STEP_CONFIGURE_PRESET_MISMATCH(
std::string const& stepConfigurePreset,
std::string const& workflowConfigurePreset, cmJSONState* state);
void INVALID_TEST_FILTER_INCLUDE_INDEX(Json::Value const* value,
cmJSONState* state);
void NO_WORKFLOW_STEPS(std::string const& presetName, cmJSONState* state);
void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(std::string const& stepName,
@@ -162,6 +162,7 @@ bool TestPresetOptionalFilterIncludeIndexHelper(
return TestPresetOptionalFilterIncludeIndexObjectHelper(out, value, state);
}
cmCMakePresetsErrors::INVALID_TEST_FILTER_INCLUDE_INDEX(value, state);
return false;
}
@@ -0,0 +1,5 @@
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresetsTest/InvalidFilterIncludeIndex:
CMakePresets\.json:16: Invalid "filter.include.index" field: expected a string or object
"index": 42
\^$
@@ -0,0 +1,21 @@
{
"version": 2,
"configurePresets": [
{
"name": "default",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build"
}
],
"testPresets": [
{
"name": "invalidIndex",
"configurePreset": "default",
"filter": {
"include": {
"index": 42
}
}
}
]
}
@@ -122,6 +122,7 @@ run_cmake_test_presets(ConditionFuture "" "" "x")
run_cmake_test_presets(TestOutputTruncationUnsupported "" "" "x")
run_cmake_test_presets(OutputJUnitUnsupported "" "" "x")
run_cmake_test_presets(InvalidJobs "" "" "x")
run_cmake_test_presets(InvalidFilterIncludeIndex "" "" "invalidIndex")
run_cmake_test_presets(JobsProcUnsupported "" "" "x")
run_cmake_test_presets(PassthroughUnsupported "" "" "x")
set(CMakePresets_SCHEMA_EXPECTED_RESULT 0)