mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-01-26 19:09:06 +00:00
Merge branch 'preset-schema-refactor' into 'master'
Draft: presets: Refactor JSON schema See merge request cmake/cmake!11591
This commit is contained in:
commit
d59592a556
File diff suppressed because it is too large
Load Diff
@ -6,13 +6,11 @@ function(validate_schema file expected_result)
|
||||
execute_process(
|
||||
COMMAND "${Python_EXECUTABLE}" "${CMakePresets_VALIDATE_SCRIPT_PATH}" "${file}"
|
||||
RESULT_VARIABLE _result
|
||||
OUTPUT_VARIABLE _output
|
||||
ERROR_VARIABLE _error
|
||||
)
|
||||
if(NOT _result STREQUAL expected_result)
|
||||
string(REPLACE "\n" "\n " _output_p "${_output}")
|
||||
string(REPLACE "\n" "\n " _error_p "${_error}")
|
||||
string(APPEND RunCMake_TEST_FAILED "Expected result of validating ${file}: ${expected_result}\nActual result: ${_result}\nOutput:\n ${_output_p}\nError:\n ${_error_p}\n")
|
||||
string(APPEND RunCMake_TEST_FAILED "Expected result of validating ${file}: ${expected_result}\nActual result: ${_result}\nError:\n ${_error_p}")
|
||||
endif()
|
||||
|
||||
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
|
||||
|
||||
@ -13,4 +13,8 @@ schema_file = os.path.join(
|
||||
with open(schema_file, "r", encoding="utf-8") as f:
|
||||
schema = json.load(f)
|
||||
|
||||
jsonschema.validate(contents, schema)
|
||||
try:
|
||||
jsonschema.validate(contents, schema)
|
||||
except jsonschema.ValidationError as e:
|
||||
sys.stderr.write(e.message)
|
||||
sys.exit(1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user