diff options
Diffstat (limited to 'Tests/RunCMake/CMakePresets')
7 files changed, 26 insertions, 20 deletions
diff --git a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt index 1758f33..60d6adb 100644 --- a/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresets-stdout.txt @@ -1,5 +1,5 @@ ^Not searching for unused variables given on the command line\. -Available presets: +Available configure presets: "zzzzzz" - Sleepy "aaaaaaaa" - Screaming diff --git a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt index 1758f33..60d6adb 100644 --- a/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsHidden-stdout.txt @@ -1,5 +1,5 @@ ^Not searching for unused variables given on the command line\. -Available presets: +Available configure presets: "zzzzzz" - Sleepy "aaaaaaaa" - Screaming diff --git a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt index 1758f33..60d6adb 100644 --- a/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsNoSuchPreset-stdout.txt @@ -1,5 +1,5 @@ ^Not searching for unused variables given on the command line\. -Available presets: +Available configure presets: "zzzzzz" - Sleepy "aaaaaaaa" - Screaming diff --git a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt index 1758f33..60d6adb 100644 --- a/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt +++ b/Tests/RunCMake/CMakePresets/ListPresetsWorkingDir-stdout.txt @@ -1,5 +1,5 @@ ^Not searching for unused variables given on the command line\. -Available presets: +Available configure presets: "zzzzzz" - Sleepy "aaaaaaaa" - Screaming diff --git a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt index aef30d2..a53682d 100644 --- a/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt +++ b/Tests/RunCMake/CMakePresets/NoPresetArgument-stderr.txt @@ -1 +1,2 @@ -^CMake Error: No preset specified for --preset$ +^CMake Error: No preset specified for --preset +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 1f399fe..1864ecd 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -9,21 +9,7 @@ endif() set(RunCMake-check-file check.cmake) -function(validate_schema file expected_result) - execute_process( - COMMAND "${PYTHON_EXECUTABLE}" "${RunCMake_SOURCE_DIR}/validate_schema.py" "${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}") - endif() - - set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) -endfunction() +include("${RunCMake_SOURCE_DIR}/validate_schema.cmake") function(run_cmake_presets name) set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/${name}") diff --git a/Tests/RunCMake/CMakePresets/validate_schema.cmake b/Tests/RunCMake/CMakePresets/validate_schema.cmake new file mode 100644 index 0000000..68b638f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/validate_schema.cmake @@ -0,0 +1,19 @@ +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( + 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") + endif() + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction() |