diff options
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r-- | Tests/CMakeLists.txt | 376 |
1 files changed, 209 insertions, 167 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 3e3447f..a58c7e9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -89,7 +89,7 @@ if(BUILD_TESTING) endif() endif() - set(MAKE_IS_GNU ) + set(MAKE_IS_GNU) if(CMAKE_MAKE_PROGRAM MATCHES make) execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) @@ -101,7 +101,7 @@ if(BUILD_TESTING) endif() # some old versions of make simply cannot handle spaces in paths - if (MAKE_IS_GNU OR + if(MAKE_IS_GNU OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR CMAKE_GENERATOR MATCHES "Visual Studio|Xcode|Borland|Ninja") set(MAKE_SUPPORTS_SPACES 1) @@ -181,7 +181,7 @@ if(BUILD_TESTING) ERROR_VARIABLE my_err) string(REGEX REPLACE "HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Wow6432Node\\\\Microsoft\\\\Windows CE Tools\\\\SDKs\\\\" ";" sdk_list "${sdk_reg}") list(LENGTH sdk_list sdk_list_len) - if (${sdk_list_len} GREATER 1) + if(${sdk_list_len} GREATER 1) list(GET sdk_list 1 _sdk) # The first entry is always empty due to the regex replace above string(STRIP ${_sdk} _sdk) # Make sure there is no newline in the SDK name endif() @@ -205,7 +205,7 @@ if(BUILD_TESTING) select_wince_sdk(reg_wince wince_sdk) set(reg_tegra "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;sdkRoot]") set(reg_nasm "[HKEY_CURRENT_USER\\SOFTWARE\\nasm]") - foreach(reg vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) + foreach(reg IN ITEMS vs10 vs11 vs12 vs14 ws80 ws81 ws10_0 wp80 wp81 wince tegra nasm) get_filename_component(r "${reg_${reg}}" ABSOLUTE) if(IS_DIRECTORY "${r}" AND NOT "${r}" STREQUAL "/registry") set(${reg} 1) @@ -227,7 +227,7 @@ if(BUILD_TESTING) set(vs_versions vs15) endif() endif() - foreach(info ${vs_versions}) + foreach(info IN LISTS vs_versions) cmake_host_system_information(RESULT found QUERY "${info_${info}}") if(found) set(${info} 1) @@ -287,12 +287,12 @@ if(BUILD_TESTING) "Should the long tests be run (such as Bootstrap)." ON) mark_as_advanced(CMAKE_RUN_LONG_TESTS) - if (CMAKE_RUN_LONG_TESTS) + if(CMAKE_RUN_LONG_TESTS) option(CTEST_TEST_CTEST "Should the tests that run a full sub ctest process be run?" OFF) mark_as_advanced(CTEST_TEST_CTEST) - endif () + endif() option(CTEST_TEST_CPACK "Should the tests that use '--build-target package' be run?" @@ -367,9 +367,9 @@ if(BUILD_TESTING) if(CMake_TEST_RESOURCES) ADD_TEST_MACRO(VSResource VSResource) - if (CMAKE_GENERATOR MATCHES "Ninja") + if(CMAKE_GENERATOR MATCHES "Ninja") add_test_macro(VSResourceNinjaForceRSP VSResourceNinjaForceRSP) - endif () + endif() endif() if(_isMultiConfig) set(MSManifest_CTEST_OPTIONS -C $<CONFIGURATION>) @@ -394,6 +394,9 @@ if(BUILD_TESTING) if(CMake_TEST_XCODE_SWIFT) ADD_TEST_MACRO(SwiftMix SwiftMix) endif() + if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.1) + ADD_TEST_MACRO(SwiftMixLib Swifty) + endif() endif() if(CMAKE_Fortran_COMPILER) ADD_TEST_MACRO(FortranOnly FortranOnly) @@ -431,7 +434,7 @@ if(BUILD_TESTING) if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") ADD_TEST_MACRO(CSharpOnly CSharpOnly) - if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") ADD_TEST_MACRO(CSharpLinkToCxx CSharpLinkToCxx) ADD_TEST_MACRO(CSharpLinkFromCxx CSharpLinkFromCxx) endif() @@ -499,7 +502,7 @@ if(BUILD_TESTING) endif() ADD_TEST_MACRO(SourcesProperty SourcesProperty) ADD_TEST_MACRO(SourceFileProperty SourceFileProperty) - if (NOT CMAKE_GENERATOR STREQUAL "Xcode") + if(NOT CMAKE_GENERATOR STREQUAL "Xcode") ADD_TEST_MACRO(SourceFileIncludeDirProperty SourceFileIncludeDirProperty) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" @@ -618,6 +621,11 @@ if(BUILD_TESTING) set(Module.CheckIPOSupported-CXX_BUILD_OPTIONS -DCMake_TEST_IPO_WORKS_CXX=${CMake_TEST_IPO_WORKS_CXX}) ADD_TEST_MACRO(Module.CheckIPOSupported-CXX CheckIPOSupported-CXX) + if(CMake_TEST_CUDA) + ADD_TEST_MACRO(Module.CheckIPOSupported-CUDA CheckIPOSupported-CUDA) + set_property(TEST Module.CheckIPOSupported-CUDA APPEND PROPERTY LABELS "CUDA") + endif() + if(CMAKE_Fortran_COMPILER) set(Module.CheckIPOSupported-Fortran_BUILD_OPTIONS -DCMake_TEST_IPO_WORKS_Fortran=${CMake_TEST_IPO_WORKS_Fortran}) ADD_TEST_MACRO(Module.CheckIPOSupported-Fortran CheckIPOSupported-Fortran) @@ -641,11 +649,11 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Module.WriteCompilerDetectionHeader WriteCompilerDetectionHeader) - if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") + if(APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "LCC") include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-fPIE run_pic_test) else() - if (CMAKE_CXX_COMPILER_ID MATCHES "PGI" + if(CMAKE_CXX_COMPILER_ID MATCHES "PGI" OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") set(run_pic_test 0) @@ -654,7 +662,7 @@ if(BUILD_TESTING) endif() endif() - if (run_pic_test) + if(run_pic_test) ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets) endif() @@ -725,13 +733,15 @@ if(BUILD_TESTING) # mainly it tests that cmake doesn't crash when generating these project files. if(CMAKE_GENERATOR MATCHES "^(Unix Makefiles|Ninja)$" AND NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") - foreach(extraGenerator + foreach( + extraGenerator + IN ITEMS "CodeBlocks" "CodeLite" "Eclipse CDT4" "Kate" "Sublime Text 2" - ) + ) string(REPLACE " " "" extraGeneratorTestName "Simple_${extraGenerator}Generator") add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND} --build-and-test @@ -786,7 +796,7 @@ if(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubProject/foo" --test-command foo ) - set_tests_properties ( SubProject-Stage2 PROPERTIES DEPENDS SubProject) + set_tests_properties(SubProject-Stage2 PROPERTIES DEPENDS SubProject) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubProject") endif() @@ -1056,8 +1066,11 @@ if(BUILD_TESTING) endif() endif() if(NSIS_MAKENSIS_EXECUTABLE) - set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} - -DCPACK_BINARY_NSIS:BOOL=ON) + execute_process(COMMAND ${NSIS_MAKENSIS_EXECUTABLE} "-VERSION" ERROR_QUIET OUTPUT_QUIET RESULT_VARIABLE NSIS_OK) + if("${NSIS_OK}" STREQUAL "0") + set(CPackComponents_BUILD_OPTIONS ${CPackComponents_BUILD_OPTIONS} + -DCPACK_BINARY_NSIS:BOOL=ON) + endif() endif() add_test(CPackComponents ${CMAKE_CTEST_COMMAND} @@ -1119,7 +1132,7 @@ if(BUILD_TESTING) set(CPACK_GENERATOR_STRING_${CPackGen} ${CPackGen}) endif() set(CPackRun_CPackGen "-DCPackGen=${CPACK_GENERATOR_STRING_${CPackGen}}") - foreach(CPackComponentWay ${CWAYLST}) + foreach(CPackComponentWay IN LISTS CWAYLST) set(CPackRun_CPackComponentWay "-DCPackComponentWay=${CPackComponentWay}") add_test(CPackComponentsForAll-${CPackGen}-${CPackComponentWay} ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} @@ -1153,7 +1166,6 @@ if(BUILD_TESTING) "components-source" "components-shlibdeps1" "components-depend1" - "components-depend2" "compression") # Run additional tests if dpkg-shlibdeps is available (and is new enough version) find_program(SHLIBDEPS_EXECUTABLE NAMES dpkg-shlibdeps) @@ -1173,6 +1185,11 @@ if(BUILD_TESTING) list(APPEND DEB_CONFIGURATIONS_TO_TEST "shlibdeps-with-private-lib-failure" "shlibdeps-with-private-lib-success") endif() + # Check if distro has symbols or shlibs data + file(GLOB SHLIBS_FILES_EXIST "/var/lib/dpkg/info/*.shlibs" "/var/lib/dpkg/info/*.symbols") + if(SHLIBS_FILES_EXIST) + list(APPEND DEB_CONFIGURATIONS_TO_TEST "components-depend2") + endif() endif() set(CPackGen "DEB") @@ -1338,7 +1355,7 @@ if(BUILD_TESTING) --test-command complex) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ComplexOneConfig") # because of the registry write these tests depend on each other - set_tests_properties ( complex PROPERTIES DEPENDS complexOneConfig) + set_tests_properties(complex PROPERTIES DEPENDS complexOneConfig) add_test(Environment ${CMAKE_CTEST_COMMAND} --build-and-test @@ -1421,63 +1438,66 @@ if(BUILD_TESTING) endif() # test for Find modules, simple cases - foreach(_mod IN ITEMS - ALSA - Boost - BLAS - BZip2 - CURL - Cups - Doxygen - DevIL - EnvModules - EXPAT - Fontconfig - Freetype - GDAL - GIF - Git - GLEW - GLUT - GnuTLS - GSL - GTK2 - Iconv - ICU - Intl - Jasper - JNI - JPEG - JsonCpp - LAPACK - LibArchive - LibLZMA - LibRHash - Libinput - LibUV - LibXml2 - LibXslt - LTTngUST - ODBC - OpenACC - OpenAL - OpenCL - OpenGL - OpenMP - OpenSSL - MPI - PNG - Patch - PostgreSQL - Protobuf - SDL - SQLite3 - TIFF - Vulkan - X11 - XalanC - XercesC - ) + foreach( + _mod + IN ITEMS + ALSA + BLAS + Boost + BZip2 + Cups + CURL + DevIL + Doxygen + EnvModules + EXPAT + Fontconfig + Freetype + GDAL + GIF + Git + GLEW + GLUT + GnuTLS + GSL + GTK2 + Iconv + ICU + Intl + Jasper + JNI + JPEG + JsonCpp + LAPACK + LibArchive + Libinput + LibLZMA + LibRHash + LibUV + LibXml2 + LibXslt + LTTngUST + MPI + ODBC + OpenACC + OpenAL + OpenCL + OpenGL + OpenMP + OpenSP + OpenSSL + Patch + PNG + PostgreSQL + Protobuf + SDL + SQLite3 + TIFF + Vulkan + X11 + XalanC + XercesC + ) if(CMake_TEST_Find${_mod}) add_subdirectory(Find${_mod}) endif() @@ -1523,7 +1543,7 @@ if(BUILD_TESTING) # CMake_TEST_FindMatlab_MCR_ROOT_DIR: indicates an optional root directory for the MCR, required on Linux if(CMake_TEST_FindMatlab OR CMake_TEST_FindMatlab_ROOT_DIR OR CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR) - set(FindMatlab_additional_test_options ) + set(FindMatlab_additional_test_options) if(CMake_TEST_FindMatlab_MCR OR CMake_TEST_FindMatlab_MCR_ROOT_DIR) set(FindMatlab_additional_test_options -DIS_MCR=TRUE) endif() @@ -1557,7 +1577,7 @@ if(BUILD_TESTING) endif() set(ExternalProject_BUILD_OPTIONS "") - foreach(vcs CVS SVN GIT HG) + foreach(vcs IN ITEMS CVS SVN GIT HG) if(DEFINED CMake_TEST_ExternalProject_${vcs}) list(APPEND ExternalProject_BUILD_OPTIONS -DEP_TEST_${vcs}=${CMake_TEST_ExternalProject_${vcs}}) endif() @@ -1656,7 +1676,8 @@ if(BUILD_TESTING) RUN_SERIAL 1 TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT} WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate - DEPENDS ExternalProjectUpdateSetup ) + DEPENDS ExternalProjectUpdateSetup + ) execute_process( COMMAND ${CMAKE_COMMAND} @@ -1711,7 +1732,7 @@ if(BUILD_TESTING) function(add_tutorial_test step_name use_mymath tutorial_arg pass_regex) set(tutorial_test_name Tutorial${step_name}) set(tutorial_build_dir "${CMake_BINARY_DIR}/Tests/Tutorial/${step_name}") - if (use_mymath) + if(use_mymath) set(tutorial_build_options "") else() set(tutorial_test_name ${tutorial_test_name}_MYMATH) @@ -1735,7 +1756,7 @@ if(BUILD_TESTING) if(NOT CMake_TEST_EXTERNAL_CMAKE) foreach(STP RANGE 2 12) - if (STP EQUAL 6) + if(STP EQUAL 8) set(pass_regex ".*using log and exp") else() set(pass_regex "The square root of 25 is 5") @@ -1994,11 +2015,11 @@ if(BUILD_TESTING) --test-command Exec2 ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LinkLineOrder") - set_tests_properties ( qtwrapping PROPERTIES DEPENDS wrapping) - set_tests_properties ( testdriver1 PROPERTIES DEPENDS qtwrapping) - set_tests_properties ( testdriver2 PROPERTIES DEPENDS testdriver1) - set_tests_properties ( testdriver3 PROPERTIES DEPENDS testdriver2) - set_tests_properties ( linkorder2 PROPERTIES DEPENDS linkorder1) + set_tests_properties(qtwrapping PROPERTIES DEPENDS wrapping) + set_tests_properties(testdriver1 PROPERTIES DEPENDS qtwrapping) + set_tests_properties(testdriver2 PROPERTIES DEPENDS testdriver1) + set_tests_properties(testdriver3 PROPERTIES DEPENDS testdriver2) + set_tests_properties(linkorder2 PROPERTIES DEPENDS linkorder1) # Test static linking on toolchains known to support it. if((CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") @@ -2030,9 +2051,9 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/SubDirSpaces/testfromsubdir.obj" ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDirSpaces") - endif () + endif() - if (WIN32) + if(WIN32) add_test(SubDir ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDir" @@ -2044,7 +2065,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.obj" ) - else () + else() add_test(SubDir ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDir" @@ -2056,7 +2077,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" "${CMake_BINARY_DIR}/Tests/SubDir/testfromsubdir.o" ) - endif () + endif() list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_SIMULATE_ID STREQUAL "MSVC")) @@ -2067,6 +2088,15 @@ if(BUILD_TESTING) if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM") ADD_TEST_MACRO(PrecompiledHeader foo) endif() + + set(MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) + if(CMAKE_Fortran_COMPILER) + list(APPEND MSVCDebugInformationFormat_BUILD_OPTIONS -DCMake_TEST_Fortran=1) + endif() + ADD_TEST_MACRO(MSVCDebugInformationFormat) + set_property(TEST MSVCDebugInformationFormat APPEND + PROPERTY LABELS "CUDA") + set(MSVCRuntimeLibrary_BUILD_OPTIONS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) ADD_TEST_MACRO(MSVCRuntimeLibrary) set_property(TEST MSVCRuntimeLibrary APPEND @@ -2080,7 +2110,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(ModuleDefinition example_exe) endif() - if (CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32) + if(CMAKE_C_COMPILER_ID MATCHES "Watcom" AND WIN32) ADD_TEST_MACRO(WatcomRuntimeLibrary) endif() @@ -2116,7 +2146,7 @@ if(BUILD_TESTING) if(MSVC AND NOT MSVC_VERSION LESS 1310 AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio 9 " OR CMAKE_SIZEOF_VOID_P EQUAL 4) - AND (NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + AND (NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") ) ADD_TEST_MACRO(VSMASM VSMASM) endif() @@ -2128,7 +2158,7 @@ if(BUILD_TESTING) if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 " AND NOT CMAKE_GENERATOR_TOOLSET STREQUAL "v90" - AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") + AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64") ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx) ADD_TEST_MACRO(VSManagedCustomCommand) endif() @@ -2157,7 +2187,7 @@ if(BUILD_TESTING) # The test (and tested property) works with .sln files, so it's skipped when: # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file set(_last_test "") - foreach(config ${CMAKE_CONFIGURATION_TYPES}) + foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES) add_test(NAME VSExcludeFromDefaultBuild-${config} COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild" @@ -2295,7 +2325,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(VSNASM VSNASM) endif() - if (CMake_TEST_GreenHillsMULTI) + if(CMake_TEST_GreenHillsMULTI) macro(add_test_GhsMulti test_name test_dir bin_sub_dir build_opts) separate_arguments(_ghs_build_opts UNIX_COMMAND ${build_opts}) separate_arguments(_ghs_toolset_extra UNIX_COMMAND ${ghs_toolset_extra}) @@ -2356,7 +2386,7 @@ if(BUILD_TESTING) set(ghs_config_name "__default__") endif() # test integrity build - if (NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) + if(NOT ghs_skip_integrity AND (NOT ghs_target_platform OR ghs_target_platform MATCHES "integrity")) add_test_GhsMulti(integrityDDInt GhsMultiIntegrity/GhsMultiIntegrityDDInt "" "") add_test_GhsMulti(integrityMonolith GhsMultiIntegrity/GhsMultiIntegrityMonolith "" "") add_test_GhsMulti(integrityDD GhsMultiIntegrity/GhsMultiIntegrityDD "" "") @@ -2438,8 +2468,8 @@ if(BUILD_TESTING) add_test_VSAndroid(vs17 "Visual Studio 17 2022" "ARM") endif() - if (APPLE) - if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + if(APPLE) + if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(BundleTestInstallDir "${CMake_BINARY_DIR}/Tests/BundleTest/InstallDirectory") add_test(BundleTest ${CMAKE_CTEST_COMMAND} @@ -2475,8 +2505,8 @@ if(BUILD_TESTING) add_subdirectory(ObjC) add_subdirectory(ObjCXX) - endif () - endif () + endif() + endif() if(APPLE AND CTEST_TEST_CPACK) add_test(BundleGeneratorTest ${CMAKE_CTEST_COMMAND} @@ -2666,7 +2696,10 @@ if(BUILD_TESTING) endif() if(NOT DEFINED CMake_TEST_CTestUpdate_HG AND HG_EXECUTABLE AND (UNIX OR NOT "${HG_EXECUTABLE}" MATCHES "cygwin")) - set(CMake_TEST_CTestUpdate_HG 1) + execute_process(COMMAND "${HG_EXECUTABLE}" --version OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE HG_RV) + if(HG_RV EQUAL 0) + set(CMake_TEST_CTestUpdate_HG 1) + endif() endif() if(CMake_TEST_CTestUpdate_HG) if(NOT HG_EXECUTABLE) @@ -3194,24 +3227,24 @@ if(BUILD_TESTING) --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log" ) - if (CMAKE_TESTS_CDASH_SERVER) + if(CMAKE_TESTS_CDASH_SERVER) set(regex "^([^:]+)://([^/]+)(.*)$") - if ("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") + if("${CMAKE_TESTS_CDASH_SERVER}" MATCHES "${regex}") set(protocol "${CMAKE_MATCH_1}") set(server "${CMAKE_MATCH_2}") set(path "${CMAKE_MATCH_3}") - else () + else() set(protocol "http") set(server "open.cdash.org") set(path "") message("warning: CMAKE_TESTS_CDASH_SERVER does not match expected regex...") message(" ...using default url='${protocol}://${server}${path}' for CTestTest[23]") - endif () - endif () + endif() + endif() - if (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) + if(CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS AND CMAKE_TESTS_CDASH_SERVER) configure_file("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES) add_test(CTestTest ${CMAKE_CTEST_COMMAND} @@ -3253,19 +3286,19 @@ if(BUILD_TESTING) # these tests take a long time, make sure they have it # if timeouts have not already been set get_test_property(CTestTest TIMEOUT PREVIOUS_TIMEOUT) - if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - set_tests_properties ( CTestTest + if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties(CTestTest PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) - endif () + endif() if(NOT CMake_TEST_EXTERNAL_CMAKE) get_test_property(CTestTest2 TIMEOUT PREVIOUS_TIMEOUT) if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - set_tests_properties ( CTestTest2 + set_tests_properties(CTestTest2 PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) endif() endif() - endif () + endif() if(CMake_TEST_EXTERNAL_CMAKE) set(CMAKE_SKIP_BOOTSTRAP_TEST 1) @@ -3301,10 +3334,9 @@ if(BUILD_TESTING) # provide more time for the bootstrap test get_test_property(BootstrapTest TIMEOUT PREVIOUS_TIMEOUT) - if ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) - set_tests_properties ( BootstrapTest - PROPERTIES TIMEOUT 5400) - endif () + if("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) + set_tests_properties(BootstrapTest PROPERTIES TIMEOUT 5400) + endif() endif() if(CMAKE_Fortran_COMPILER) @@ -3368,56 +3400,70 @@ if(BUILD_TESTING) set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) ADD_TEST_MACRO(JavaExportImport JavaExportImport) - get_filename_component(JNIPATH ${Java_JAVAC_EXECUTABLE} PATH) + get_filename_component(JAVACPATH ${Java_JAVAC_EXECUTABLE} REALPATH) + get_filename_component(JNIPATH ${JAVACPATH} PATH) find_file(JNI_H jni.h "${JNIPATH}/../include" "${JNIPATH}/../java/include") if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink file(READ "${JNI_H}" JNI_FILE) if("${JNI_FILE}" MATCHES "JDK1_2") - add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/Java" - "${CMake_BINARY_DIR}/Tests/JavaJar" - ${build_generator_args} - --build-project hello - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/" - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar") - # For next tests, java tool must have same architecture as toolchain - math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") execute_process( COMMAND "${Java_JAVA_EXECUTABLE}" -version OUTPUT_VARIABLE _version ERROR_VARIABLE _version RESULT_VARIABLE _result ) - if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit") - ## next test is valid only if Java version is less than 1.10 - if ("${Java_VERSION}" VERSION_LESS 1.10) - add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/JavaJavah" - "${CMake_BINARY_DIR}/Tests/JavaJavah" - ${build_generator_args} - --build-project helloJavah - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/" - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") + + # E2K has broken Java RVM before 3.5.2 + if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "e2k" AND _result EQUAL 0) + string(REGEX MATCH "RVM ([0-9.]+)" RVMVER "${_version}") + # Consider empty match a broken version too + if("${CMAKE_MATCH_1}" VERSION_LESS "3.5.2") + set(BROKEN_RVM TRUE) endif() - ## next test is valid only if Java is, at least, version 1.8 - if (NOT "${Java_VERSION}" VERSION_LESS 1.8) - add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders" - "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders" - ${build_generator_args} - --build-project helloJavaNativeHeaders - --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/" - --build-target install - --build-options - "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/Install" - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders") + endif() + + if(NOT BROKEN_RVM) + add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Java" + "${CMake_BINARY_DIR}/Tests/JavaJar" + ${build_generator_args} + --build-project hello + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar") + + # For next tests, java tool must have same architecture as toolchain + math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8") + if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit") + ## next test is valid only if Java version is less than 1.10 + if("${Java_VERSION}" VERSION_LESS 1.10) + add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/JavaJavah" + "${CMake_BINARY_DIR}/Tests/JavaJavah" + ${build_generator_args} + --build-project helloJavah + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah") + endif() + ## next test is valid only if Java is, at least, version 1.8 + if(NOT "${Java_VERSION}" VERSION_LESS 1.8) + add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders" + "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders" + ${build_generator_args} + --build-project helloJavaNativeHeaders + --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/" + --build-target install + --build-options + "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/Install" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders") + endif() endif() endif() endif() @@ -3479,18 +3525,18 @@ if(BUILD_TESTING) endif() if(CMAKE_TEST_PLPLOT_DIR) - add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake ) + add_test(plplot ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_PLPLOT_DIR}/../../EasyDashboardScripts/plplot.cmake) set_tests_properties ( plplot PROPERTIES TIMEOUT 5400) endif() if(CMAKE_TEST_CHICKEN_DIR) - add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake ) - set_tests_properties ( Chicken PROPERTIES TIMEOUT 5400) + add_test(Chicken ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_CHICKEN_DIR}/../../EasyDashboardScripts/Chicken.cmake) + set_tests_properties(Chicken PROPERTIES TIMEOUT 5400) endif() if(CMAKE_TEST_KDELIBS_ALPHA_1_DIR) - add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake ) - set_tests_properties ( KDELibsAlpha1 PROPERTIES TIMEOUT 5400) + add_test(KDELibsAlpha1 ${CMAKE_CTEST_COMMAND} -V -S ${CMAKE_TEST_KDELIBS_ALPHA_1_DIR}/../../EasyDashboardScripts/kdelibs.cmake) + set_tests_properties(KDELibsAlpha1 PROPERTIES TIMEOUT 5400) endif() # Define a set of "contract" tests, each activated by a cache entry @@ -3500,11 +3546,7 @@ if(BUILD_TESTING) # 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 - ) + foreach(project IN ITEMS PLplot Trilinos VTK) if(CMake_TEST_CONTRACT_${project}) include(Contracts/${project}/Configure.cmake) ADD_TEST_MACRO(Contracts.${project} ${CMake_TEST_CONTRACT_${project}_RUN_TEST}) |