diff options
author | Brad King <brad.king@kitware.com> | 2015-01-15 18:41:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-01-19 14:53:57 (GMT) |
commit | 352de1d74960dea4db66ac560ad7e4489546f2dd (patch) | |
tree | f1b3663bda185c3096040653a465265b9e4f7458 | |
parent | 287070ceb8eda82cf58595c9ea2dde57b0d6d45e (diff) | |
download | CMake-352de1d74960dea4db66ac560ad7e4489546f2dd.zip CMake-352de1d74960dea4db66ac560ad7e4489546f2dd.tar.gz CMake-352de1d74960dea4db66ac560ad7e4489546f2dd.tar.bz2 |
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.
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/BadArg-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/BadArg-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/BadFILES-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/BadPARTS-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/CMakeLists.txt.in | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/CTestConfig.cmake.in | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake | 43 | ||||
-rw-r--r-- | Tests/RunCMake/CTestSubmit/test.cmake.in | 16 |
13 files changed, 81 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 1697025..3a61751 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -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 diff --git a/Tests/RunCMake/CTestSubmit/BadArg-result.txt b/Tests/RunCMake/CTestSubmit/BadArg-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/BadArg-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestSubmit/BadArg-stderr.txt b/Tests/RunCMake/CTestSubmit/BadArg-stderr.txt new file mode 100644 index 0000000..68812ab --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/BadArg-stderr.txt @@ -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". diff --git a/Tests/RunCMake/CTestSubmit/BadFILES-result.txt b/Tests/RunCMake/CTestSubmit/BadFILES-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/BadFILES-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt b/Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt new file mode 100644 index 0000000..703224b --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/BadFILES-stderr.txt @@ -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. diff --git a/Tests/RunCMake/CTestSubmit/BadPARTS-result.txt b/Tests/RunCMake/CTestSubmit/BadPARTS-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/BadPARTS-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt b/Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt new file mode 100644 index 0000000..4e491a9 --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/BadPARTS-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at .*/Tests/RunCMake/CTestSubmit/BadPARTS/test.cmake:[0-9]+ \(ctest_submit\): + Part name "bad-part" is invalid. diff --git a/Tests/RunCMake/CTestSubmit/CMakeLists.txt.in b/Tests/RunCMake/CTestSubmit/CMakeLists.txt.in new file mode 100644 index 0000000..96e6c13 --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/CMakeLists.txt.in @@ -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) diff --git a/Tests/RunCMake/CTestSubmit/CTestConfig.cmake.in b/Tests/RunCMake/CTestSubmit/CTestConfig.cmake.in new file mode 100644 index 0000000..f0e1653 --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/CTestConfig.cmake.in @@ -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@") diff --git a/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-result.txt b/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt b/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt new file mode 100644 index 0000000..d56793e --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/RepeatRETURN_VALUE-stderr.txt @@ -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 diff --git a/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake b/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake new file mode 100644 index 0000000..6f18563 --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/RunCMakeTest.cmake @@ -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 diff --git a/Tests/RunCMake/CTestSubmit/test.cmake.in b/Tests/RunCMake/CTestSubmit/test.cmake.in new file mode 100644 index 0000000..ba826f1 --- /dev/null +++ b/Tests/RunCMake/CTestSubmit/test.cmake.in @@ -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}) |