Tests: Split RunCTest helper out of RunCMake.CTest(Submit|Memcheck)

Provide the "run_ctest" macro for use in other tests that also
want to cover running "ctest" scripts.
This commit is contained in:
Brad King 2015-02-19 11:07:34 -05:00
parent 76e7c22b3c
commit 9b50388b09
4 changed files with 30 additions and 31 deletions

View File

@ -1,23 +1,11 @@
include(RunCMake)
include(RunCTest)
set(SITE test-site)
set(BUILDNAME test-build)
set(COVERAGE_COMMAND "")
function(run_mc_test CASE_NAME CHECKER_COMMAND)
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}
)
run_ctest(${CASE_NAME} ${ARGN})
endfunction()
unset(CTEST_EXTRA_CONFIG)

View File

@ -1,26 +1,10 @@
include(RunCMake)
include(RunCTest)
# Default case parameters.
set(CASE_DROP_METHOD "http")
set(CASE_DROP_SITE "-no-site-")
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.

View File

@ -22,6 +22,16 @@ but do not actually build anything. To add a test:
to fully customize the test case command-line.
Alternatively, if the test is to cover running ``ctest -S`` then use::
include(RunCTest)
run_ctest(SubTest1)
...
run_ctest(SubTestN)
and create ``test.cmake.in``, ``CTestConfig.cmake.in``, and
``CMakeLists.txt.in`` files to be configured for each case.
4. Create file ``<Test>/CMakeLists.txt`` in the directory containing::
cmake_minimum_required(...)

View File

@ -0,0 +1,17 @@
include(RunCMake)
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()