2021-09-14 00:13:48 +02:00
function ( validate_schema file expected_result )
if ( NOT CMakePresets_VALIDATE_SCRIPT_PATH )
set ( CMakePresets_VALIDATE_SCRIPT_PATH "${RunCMake_SOURCE_DIR}/validate_schema.py" )
endif ( )
execute_process (
2022-08-04 22:12:04 +02:00
C O M M A N D " $ { P y t h o n _ E X E C U T A B L E } " " $ { C M a k e P r e s e t s _ V A L I D A T E _ S C R I P T _ P A T H } " " $ { f i l e } "
2021-09-14 00:13:48 +02:00
R E S U L T _ V A R I A B L E _ r e s u l t
O U T P U T _ V A R I A B L E _ o u t p u t
E R R O R _ V A R I A B L E _ e r r o r
)
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" )
endif ( )
set ( RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE )
endfunction ( )