diff options
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r-- | Tests/CMakeLists.txt | 197 |
1 files changed, 61 insertions, 136 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 533788a..fb7313f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -31,14 +31,28 @@ if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME) set(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one. # But provide original ENV{HOME} value in ENV{CTEST_REAL_HOME} for tests that # need access to the real HOME directory. -set(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\") +if(NOT DEFINED ENV{CTEST_REAL_HOME}) + set(ENV{CTEST_REAL_HOME} \"\$ENV{HOME}\") +endif() set(ENV{HOME} \"${TEST_HOME}\") ") endif() +# 3.9 or later provides a definitive answer to whether we are multi-config +# through a global property. Prior to 3.9, CMAKE_CONFIGURATION_TYPES being set +# is assumed to mean multi-config, but developers might modify it so it is +# technically not as reliable. +if(NOT CMAKE_VERSION VERSION_LESS 3.9) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +elseif(CMAKE_CONFIGURATION_TYPES) + set(_isMultiConfig True) +else() + set(_isMultiConfig False) +endif() + # Choose a default configuration for CTest tests. set(CTestTest_CONFIG Debug) -if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE) +if(NOT _isMultiConfig AND CMAKE_BUILD_TYPE) set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE}) endif() @@ -147,9 +161,7 @@ if(BUILD_TESTING) if(NOT CMake_TEST_EXTERNAL_CMAKE) add_subdirectory(CMakeLib) - if(CMake_TEST_SERVER_MODE) - add_subdirectory(CMakeServerLib) - endif() + add_subdirectory(CMakeServerLib) endif() add_subdirectory(CMakeOnly) add_subdirectory(RunCMake) @@ -1242,20 +1254,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt") - # On Windows there is no RPATH, so while Qt might be available for building, - # the required dlls may not be in the PATH, so we can't run the executables - # on that platform. - if(WIN32) - set(run_autogen_test ${CMAKE_CTEST_COMMAND} -V) - set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V) - else() - set(run_autogen_test complex/QtAutogen) - set(run_autouic_test QtAutoUicInterface) - endif() - if(NOT CMAKE_CONFIGURATION_TYPES) - set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>) - endif() - if(NOT DEFINED CMake_TEST_Qt5) set(CMake_TEST_Qt5 1) endif() @@ -1263,97 +1261,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release find_package(Qt5Widgets QUIET NO_MODULE) endif() if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) - add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogen" - "${CMake_BINARY_DIR}/Tests/Qt5Autogen" - ${build_generator_args} - --build-project QtAutogen - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Autogen" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=5 - ${QtAutogen_BUILD_OPTIONS} - --test-command ${run_autogen_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") - - add_test(NAME Qt5AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=5 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun") - - add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" - "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface" - ${build_generator_args} - --build-project QtAutoUicInterface - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 - --test-command ${run_autouic_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface") + add_subdirectory(Qt5Autogen) endif() if(QT4_WORKS AND QT_QTGUI_FOUND) - add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogen" - "${CMake_BINARY_DIR}/Tests/Qt4Autogen" - ${build_generator_args} - --build-project QtAutogen - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Autogen" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - ${QtAutogen_BUILD_OPTIONS} - --test-command ${run_autogen_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") - - add_test(NAME Qt4AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun") - - add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" - "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface" - ${build_generator_args} - --build-project QtAutoUicInterface - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - --test-command ${run_autouic_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface") + add_subdirectory(Qt4Autogen) add_test(Qt4Targets ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1431,6 +1342,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(GoogleTest) endif() + if(CMake_TEST_FindIconv) + add_subdirectory(FindIconv) + endif() + if(CMake_TEST_FindICU) add_subdirectory(FindICU) endif() @@ -2838,7 +2753,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release PASS_REGULAR_EXPRESSION "Failed") else() set_tests_properties(CTestTestCrash PROPERTIES - PASS_REGULAR_EXPRESSION "(Illegal|SegFault)") + PASS_REGULAR_EXPRESSION "(Illegal|SegFault|Child aborted)") endif() configure_file( @@ -3065,8 +2980,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_test(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N) - add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B) - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" @@ -3269,6 +3182,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release --build-options ${build_options} --test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList") + add_test(Java.JarSourceListAndOutput ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Java" + "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput" + ${build_generator_args} + --build-project hello + --build-target hello3 + --build-two-config + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput/hello3" + --build-options ${build_options} + --test-command ${JAVA_RUNTIME} -classpath hello3.jar HelloWorld) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput") # For next test, java tool must have same architecture as toolchain math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") @@ -3277,7 +3202,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result ) if(_result EQUAL 0) - if(CMAKE_CONFIGURATION_TYPES) + if(_isMultiConfig) set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>) else() set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah) @@ -3382,31 +3307,31 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_property(TEST CMakeWizardTest PROPERTY PASS_REGULAR_EXPRESSION "The \"cmake -i\" wizard mode is no longer supported.") - # If the cache variable CMAKE_CONTRACT_PROJECTS is set - # then the dashboard will run a contract with CMake test of that - # name. For example CMAKE_CONTRACT_PROJECTS = vtk542 would run - # the vtk542 contract test. - # For each Contract test, the project should provide a directory - # with at least one CMakeLists.txt file that uses ExternalProject - # to download and configure the project. The directory should also - # contain a RunTest.cmake file that has a single set of the format: - # set(project_RUN_TEST testToRun) - # The testToRun should be a test executable that can be run to - # smoke test the build. - foreach(project ${CMAKE_CONTRACT_PROJECTS}) - include(Contracts/${project}/RunTest.cmake) - ADD_TEST_MACRO(Contracts.${project} - ${${project}_RUN_TEST}) - # Contract test timeout in seconds. - # Default to 6 hours. - if(DEFINED ${project}_TEST_TIMEOUT) - set(timeout ${${project}_TEST_TIMEOUT}) - elseif(CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT) - set(timeout ${CMAKE_CONTRACT_TEST_TIMEOUT_DEFAULT}) - else() - set(timeout 21600) + # Define a set of "contract" tests, each activated by a cache entry + # named "CMake_TEST_CONTRACT_<project>". For each Contract test, + # the project should provide a directory with a CMakeLists.txt file + # that uses ExternalProject to download and configure the project. + # The directory should also contain a Configure.cmake file that + # sets "CMake_TEST_CONTRACT_<project>_<var>" variables to configure + # the code below. + foreach(project + PLplot + Trilinos + VTK + ) + if(CMake_TEST_CONTRACT_${project}) + include(Contracts/${project}/Configure.cmake) + ADD_TEST_MACRO(Contracts.${project} ${CMake_TEST_CONTRACT_${project}_RUN_TEST}) + # The external projects may take a long time to build. + if(DEFINED CMake_TEST_CONTRACT_${project}_TIMEOUT) + set(timeout ${CMake_TEST_CONTRACT_${project}_TIMEOUT}) + elseif(CMake_TEST_CONTRACT_DEFAULT_TIMEOUT) + set(timeout ${CMake_TEST_CONTRACT_DEFAULT_TIMEOUT}) + else() + set(timeout 21600) + endif() + set_property(TEST Contracts.${project} PROPERTY TIMEOUT "${timeout}") endif() - set_tests_properties(Contracts.${project} PROPERTIES TIMEOUT ${timeout}) endforeach() if(TEST_CompileCommandOutput) |