diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2017-01-10 18:48:59 (GMT) |
---|---|---|
committer | Matthew Woehlke <matthew.woehlke@kitware.com> | 2017-01-10 18:48:59 (GMT) |
commit | 4b0c13a87ffb799334669f77978cc4d5e83f950a (patch) | |
tree | 365265b321dbdd62cefe6e4772e8473d7a6e77c8 /Tests/CTestTestLaunchers/test.cmake.in | |
parent | 4918cd8c98938ab245d7fea74ba6e20f3ec8ef8b (diff) | |
download | CMake-4b0c13a87ffb799334669f77978cc4d5e83f950a.zip CMake-4b0c13a87ffb799334669f77978cc4d5e83f950a.tar.gz CMake-4b0c13a87ffb799334669f77978cc4d5e83f950a.tar.bz2 |
Tests: Add additional launcher tests
Modify the launcher test to also try to build two executables, having
respectively build and link errors. This is intended to test that
launchers are used when running compile and link commands, as well as
custom commands. (In particular, this should catch breakage such as that
fixed by ce71bd9505a.)
Diffstat (limited to 'Tests/CTestTestLaunchers/test.cmake.in')
-rw-r--r-- | Tests/CTestTestLaunchers/test.cmake.in | 80 |
1 files changed, 46 insertions, 34 deletions
diff --git a/Tests/CTestTestLaunchers/test.cmake.in b/Tests/CTestTestLaunchers/test.cmake.in index 03a118a..2db1ddd 100644 --- a/Tests/CTestTestLaunchers/test.cmake.in +++ b/Tests/CTestTestLaunchers/test.cmake.in @@ -1,39 +1,51 @@ cmake_minimum_required(VERSION 2.8.12) -# Settings: -set(CTEST_DASHBOARD_SOURCE "@CMake_SOURCE_DIR@/Tests/CTestTestLaunchers") -set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTestLaunchers") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "Launchers-@BUILDNAME@-CTestTestLaunchers") - -set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_SOURCE}/launcher_test_project") -set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/launcher_test_project-bin") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) - -file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " -CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ -CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ -CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ -CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@ -CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@ -CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@ -") - -set(TEST_SUCCESS FALSE) - -ctest_start(Experimental) -ctest_configure(OPTIONS "-DCTEST_USE_LAUNCHERS=1") -ctest_build(NUMBER_ERRORS error_count) - -if("${error_count}" STREQUAL "1") - set(TEST_SUCCESS TRUE) -endif() +set(TEST_SUCCESS TRUE) + +function(run_test_case NAME WHAT) + set(_message "Testing that launchers are used when running ${WHAT}") + message(STATUS "${_message}...") + + # Settings: + set(CTEST_DASHBOARD_SOURCE "@CMake_SOURCE_DIR@/Tests/CTestTestLaunchers") + set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTestLaunchers") + set(CTEST_SITE "@SITE@") + set(CTEST_BUILD_NAME "Launchers-@BUILDNAME@-CTestTestLaunchers") + + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_SOURCE}/${NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${NAME}-bin") + set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") + set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") + set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") + set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + + ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) + + file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " + CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ + CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ + CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@ + CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@ + CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@ + CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@ + ") + + ctest_start(Experimental) + ctest_configure(OPTIONS "-DCTEST_USE_LAUNCHERS=1") + ctest_build(NUMBER_ERRORS error_count) + + if("${error_count}" STREQUAL "0") + set(TEST_SUCCESS FALSE PARENT_SCOPE) + message(STATUS "${_message}... FAIL") + else() + message(STATUS "${_message}... PASS") + endif() +endfunction() + +run_test_case(launcher_compiler_test_project "the compiler") +run_test_case(launcher_linker_test_project "the linker") +run_test_case(launcher_custom_command_test_project "a custom command") if(TEST_SUCCESS) message("CTEST_TEST_LAUNCHER_SUCCESS") |