Tests: Add RunCMake.CTestSubmit cases covering ctest_submit failures

Cover command invocation argument errors.  Prepare infrastructure
to cover failed 'drop' cases, but do not cover them yet because
we need to collect error messages from each platform.
This commit is contained in:
Brad King 2015-01-15 13:41:39 -05:00
parent 287070ceb8
commit 352de1d749
13 changed files with 81 additions and 0 deletions

View File

@ -52,6 +52,7 @@ add_RunCMake_test(CMP0053)
add_RunCMake_test(CMP0054)
add_RunCMake_test(CMP0055)
add_RunCMake_test(CTest)
add_RunCMake_test(CTestSubmit)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
add_RunCMake_test(CTestMemcheck

View File

@ -0,0 +1 @@
(-1|255)

View File

@ -0,0 +1,2 @@
CMake Error at .*/Tests/RunCMake/CTestSubmit/BadArg/test.cmake:[0-9]+ \(ctest_submit\):
ctest_submit called with unknown argument "bad-arg".

View File

@ -0,0 +1 @@
(-1|255)

View File

@ -0,0 +1,2 @@
CMake Error at .*/Tests/RunCMake/CTestSubmit/BadFILES/test.cmake:[0-9]+ \(ctest_submit\):
File "bad-file" does not exist. Cannot submit a non-existent file.

View File

@ -0,0 +1 @@
(-1|255)

View File

@ -0,0 +1,2 @@
CMake Error at .*/Tests/RunCMake/CTestSubmit/BadPARTS/test.cmake:[0-9]+ \(ctest_submit\):
Part name "bad-part" is invalid.

View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.1)
project(CTestSubmit@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)

View File

@ -0,0 +1,5 @@
set(CTEST_PROJECT_NAME "CTestSubmit@CASE_NAME@")
# Intentionally leave out other upload-related CTestConfig.cmake settings
# so that any ctest_submit calls fail with an error message.
set(CTEST_DROP_METHOD "@CASE_DROP_METHOD@")

View File

@ -0,0 +1 @@
(-1|255)

View File

@ -0,0 +1,2 @@
CMake Error at .*/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE/test.cmake:[0-9]+ \(ctest_submit\):
Called with more than one value for RETURN_VALUE

View File

@ -0,0 +1,43 @@
include(RunCMake)
# Default case parameters.
set(CASE_DROP_METHOD "http")
set(CASE_CTEST_SUBMIT_ARGS "")
function(run_ctest CASE_NAME)
configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in
${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake @ONLY)
configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in
${RunCMake_BINARY_DIR}/${CASE_NAME}/CTestConfig.cmake @ONLY)
configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in
${RunCMake_BINARY_DIR}/${CASE_NAME}/CMakeLists.txt @ONLY)
run_cmake_command(${CASE_NAME} ${CMAKE_CTEST_COMMAND}
-C Debug
-S ${RunCMake_BINARY_DIR}/${CASE_NAME}/test.cmake
-V
--output-log ${RunCMake_BINARY_DIR}/${CASE_NAME}-build/testOutput.log
${ARGN}
)
endfunction()
#-----------------------------------------------------------------------------
# Test bad argument combinations.
function(run_ctest_submit CASE_NAME)
set(CASE_CTEST_SUBMIT_ARGS "${ARGN}")
run_ctest(${CASE_NAME})
endfunction()
run_ctest_submit(BadArg bad-arg)
run_ctest_submit(BadPARTS PARTS bad-part)
run_ctest_submit(BadFILES FILES bad-file)
run_ctest_submit(RepeatRETURN_VALUE RETURN_VALUE res RETURN_VALUE res)
#-----------------------------------------------------------------------------
# Test failed drops by various protocols
function(run_ctest_submit_FailDrop CASE_DROP_METHOD)
run_ctest(FailDrop-${CASE_DROP_METHOD})
endfunction()
# TODO: call run_ctest_submit_FailDrop() for each submission protocol

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.1)
set(CTEST_SITE "test-site")
set(CTEST_BUILD_NAME "test-build-name")
set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
ctest_start(Experimental)
ctest_configure()
set(ctest_submit_args "@CASE_CTEST_SUBMIT_ARGS@")
ctest_submit(${ctest_submit_args})