diff options
Diffstat (limited to 'Tests')
6 files changed, 46 insertions, 3 deletions
diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake new file mode 100644 index 0000000..4cf999f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.cmake @@ -0,0 +1,4 @@ +option(FRESH_CONFIGURE "" ON) +if(NOT FRESH_CONFIGURE) + message(FATAL_ERROR "FRESH_CONFIGURE is ${FRESH_CONFIGURE}, should be ON") +endif() diff --git a/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in new file mode 100644 index 0000000..4ce0ca5 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/Fresh.json.in @@ -0,0 +1,21 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ], + "workflowPresets": [ + { + "name": "Fresh", + "steps": [ + { + "type": "configure", + "name": "default" + } + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-result.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt new file mode 100644 index 0000000..049ff54 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stderr.txt @@ -0,0 +1,6 @@ +^Unknown argument -DINVALID_OPTION +Usage: cmake --workflow \[options\] +Options: + --preset <preset> = Workflow preset to execute\. + --list-presets = List available workflow presets\. + --fresh = Configure a fresh build tree, removing any existing cache file\.$ diff --git a/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/CMakePresetsWorkflow/InvalidOption-stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake index b89a11a..550600a 100644 --- a/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresetsWorkflow/RunCMakeTest.cmake @@ -10,10 +10,12 @@ function(run_cmake_workflow_presets name) set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_SOURCE_DIR}/build") set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") - set(RunCMake_TEST_NO_CLEAN TRUE) + if(NOT RunCMake_TEST_NO_CLEAN) + file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + endif() - file(REMOVE_RECURSE "${RunCMake_TEST_SOURCE_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_SOURCE_DIR}") + set(RunCMake_TEST_NO_CLEAN TRUE) set(CASE_NAME "${name}") set(CASE_SOURCE_DIR "${RunCMake_SOURCE_DIR}") @@ -77,3 +79,11 @@ unset(CMakeUserPresets_FILE) unset(CMakePresets_ASSETS) run_cmake_workflow_presets(ListPresets --list-presets) +run_cmake_workflow_presets(InvalidOption -DINVALID_OPTION) + +set(RunCMake_TEST_NO_CLEAN TRUE) +file(REMOVE_RECURSE "${RunCMake_BINARY_DIR}/Fresh") +file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/Fresh/build") +file(WRITE "${RunCMake_BINARY_DIR}/Fresh/build/CMakeCache.txt" "FRESH_CONFIGURE:BOOL=OFF\n") +run_cmake_workflow_presets(Fresh --fresh) +unset(RunCMake_TEST_NO_CLEAN) |