Tests/RunCMake: Add RunCMake_CHECK_ONLY Option
Allows run_cmake test cases that run a verification script and no other command
This commit is contained in:
parent
5c7bb0bfd9
commit
8a3c195188
@ -146,18 +146,22 @@ function(run_cmake test)
|
|||||||
if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
|
if(NOT RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
|
||||||
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
|
||||||
endif()
|
endif()
|
||||||
string(CONCAT _code [[execute_process(
|
if(NOT RunCMake_CHECK_ONLY)
|
||||||
COMMAND ${RunCMake_TEST_COMMAND}
|
string(CONCAT _code [[execute_process(
|
||||||
${RunCMake_TEST_OPTIONS}
|
COMMAND ${RunCMake_TEST_COMMAND}
|
||||||
]] "${RunCMake_TEST_RAW_ARGS}\n" [[
|
${RunCMake_TEST_OPTIONS}
|
||||||
WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}"
|
]] "${RunCMake_TEST_RAW_ARGS}\n" [[
|
||||||
OUTPUT_VARIABLE actual_stdout
|
WORKING_DIRECTORY "${RunCMake_TEST_COMMAND_WORKING_DIRECTORY}"
|
||||||
ERROR_VARIABLE ${actual_stderr_var}
|
OUTPUT_VARIABLE actual_stdout
|
||||||
RESULT_VARIABLE actual_result
|
ERROR_VARIABLE ${actual_stderr_var}
|
||||||
ENCODING UTF8
|
RESULT_VARIABLE actual_result
|
||||||
${maybe_timeout}
|
ENCODING UTF8
|
||||||
${maybe_input_file}
|
${maybe_timeout}
|
||||||
)]])
|
${maybe_input_file}
|
||||||
|
)]])
|
||||||
|
else()
|
||||||
|
set(expect_result "")
|
||||||
|
endif()
|
||||||
if(DEFINED ENV{PWD})
|
if(DEFINED ENV{PWD})
|
||||||
set(old_pwd "$ENV{PWD}")
|
set(old_pwd "$ENV{PWD}")
|
||||||
else()
|
else()
|
||||||
@ -261,7 +265,7 @@ function(run_cmake test)
|
|||||||
if(RunCMake_TEST_FAILED)
|
if(RunCMake_TEST_FAILED)
|
||||||
set(msg "${RunCMake_TEST_FAILED}\n${msg}")
|
set(msg "${RunCMake_TEST_FAILED}\n${msg}")
|
||||||
endif()
|
endif()
|
||||||
if(msg)
|
if(msg AND NOT RunCMake_CHECK_ONLY)
|
||||||
string(REPLACE ";" "\" \"" command "\"${RunCMake_TEST_COMMAND}\"")
|
string(REPLACE ";" "\" \"" command "\"${RunCMake_TEST_COMMAND}\"")
|
||||||
if(RunCMake_TEST_OPTIONS)
|
if(RunCMake_TEST_OPTIONS)
|
||||||
string(REPLACE ";" "\" \"" options "\"${RunCMake_TEST_OPTIONS}\"")
|
string(REPLACE ";" "\" \"" options "\"${RunCMake_TEST_OPTIONS}\"")
|
||||||
@ -271,8 +275,7 @@ function(run_cmake test)
|
|||||||
string(APPEND command " ${RunCMake_TEST_RAW_ARGS}")
|
string(APPEND command " ${RunCMake_TEST_RAW_ARGS}")
|
||||||
endif()
|
endif()
|
||||||
string(APPEND msg "Command was:\n command> ${command}\n")
|
string(APPEND msg "Command was:\n command> ${command}\n")
|
||||||
endif()
|
|
||||||
if(msg)
|
|
||||||
foreach(o IN ITEMS stdout stderr config)
|
foreach(o IN ITEMS stdout stderr config)
|
||||||
if(DEFINED expect_${o})
|
if(DEFINED expect_${o})
|
||||||
string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} " expect-${o}> ${expect_${o}}")
|
string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o} " expect-${o}> ${expect_${o}}")
|
||||||
@ -286,6 +289,8 @@ function(run_cmake test)
|
|||||||
if(RunCMake_TEST_FAILURE_MESSAGE)
|
if(RunCMake_TEST_FAILURE_MESSAGE)
|
||||||
string(APPEND msg "${RunCMake_TEST_FAILURE_MESSAGE}")
|
string(APPEND msg "${RunCMake_TEST_FAILURE_MESSAGE}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
if(msg)
|
||||||
message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n${msg}")
|
message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n${msg}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - PASSED")
|
message(STATUS "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - PASSED")
|
||||||
|
Loading…
Reference in New Issue
Block a user