summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-11-06 13:58:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-11-06 14:01:49 (GMT)
commit62d736f74ad2eaa737d37ba0b30c8a137782537b (patch)
treeb52e69861dafb8d2fd2f3321d1d9042ace22c854 /Tests
parent6a54dbe8caeaaa78a8ac78b282d80128f0201f9a (diff)
parent4c626b7e43c27de0dce4b8af15290cce861f9dc8 (diff)
downloadCMake-62d736f74ad2eaa737d37ba0b30c8a137782537b.zip
CMake-62d736f74ad2eaa737d37ba0b30c8a137782537b.tar.gz
CMake-62d736f74ad2eaa737d37ba0b30c8a137782537b.tar.bz2
Merge topic 'test-contract-refactor'
4c626b7e Tests: Refactor contract test activation 4bd5af63 Tests: Factor out contract test HOME finding 0ce082b7 Tests: Drop unused contract test environment script 36346de4 Tests: Drop unused contract test bbc9c966 Tests: Honor already-set CTEST_REAL_HOME in case of repeat run Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1444
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt51
-rw-r--r--Tests/Contracts/Home.cmake19
-rw-r--r--Tests/Contracts/Trilinos/CMakeLists.txt19
-rw-r--r--Tests/Contracts/Trilinos/Configure.cmake (renamed from Tests/Contracts/Trilinos/RunTest.cmake)2
-rw-r--r--Tests/Contracts/Trilinos/EnvScript.cmake32
-rw-r--r--Tests/Contracts/VTK/CMakeLists.txt19
-rw-r--r--Tests/Contracts/VTK/Configure.cmake (renamed from Tests/Contracts/VTK/RunTest.cmake)2
-rw-r--r--Tests/Contracts/cse-snapshot/CMakeLists.txt114
-rw-r--r--Tests/Contracts/cse-snapshot/Dashboard.cmake.in76
-rw-r--r--Tests/Contracts/cse-snapshot/RunTest.cmake3
10 files changed, 49 insertions, 288 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index d2b6969..1c69805 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -31,7 +31,9 @@ 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()
@@ -3386,31 +3388,30 @@ ${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
+ 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)
diff --git a/Tests/Contracts/Home.cmake b/Tests/Contracts/Home.cmake
new file mode 100644
index 0000000..8b05e81
--- /dev/null
+++ b/Tests/Contracts/Home.cmake
@@ -0,0 +1,19 @@
+# Find a home in which to build.
+if(NOT DEFINED HOME)
+ if(DEFINED ENV{CTEST_REAL_HOME})
+ set(HOME "$ENV{CTEST_REAL_HOME}")
+ else()
+ set(HOME "$ENV{HOME}")
+ endif()
+
+ if(NOT HOME AND WIN32)
+ # Try for USERPROFILE as HOME equivalent:
+ string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
+
+ # But just use root of SystemDrive if USERPROFILE contains any spaces:
+ # (Default on XP and earlier...)
+ if(HOME MATCHES " ")
+ string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
+ endif()
+ endif()
+endif()
diff --git a/Tests/Contracts/Trilinos/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt
index 8d74ca5..4d7062b 100644
--- a/Tests/Contracts/Trilinos/CMakeLists.txt
+++ b/Tests/Contracts/Trilinos/CMakeLists.txt
@@ -6,24 +6,7 @@ include(ExternalProject)
include("${CMAKE_CURRENT_SOURCE_DIR}/LocalOverrides.cmake" OPTIONAL)
include("${CMAKE_CURRENT_BINARY_DIR}/LocalOverrides.cmake" OPTIONAL)
-if(NOT DEFINED HOME)
- if(DEFINED ENV{CTEST_REAL_HOME})
- set(HOME "$ENV{CTEST_REAL_HOME}")
- else()
- set(HOME "$ENV{HOME}")
- endif()
-
- if(NOT HOME AND WIN32)
- # Try for USERPROFILE as HOME equivalent:
- string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
-
- # But just use root of SystemDrive if USERPROFILE contains any spaces:
- # (Default on XP and earlier...)
- if(HOME MATCHES " ")
- string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
- endif()
- endif()
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../Home.cmake)
message(STATUS "HOME='${HOME}'")
if(NOT DEFINED url)
diff --git a/Tests/Contracts/Trilinos/RunTest.cmake b/Tests/Contracts/Trilinos/Configure.cmake
index d661a4c..d62eb79 100644
--- a/Tests/Contracts/Trilinos/RunTest.cmake
+++ b/Tests/Contracts/Trilinos/Configure.cmake
@@ -4,4 +4,4 @@ set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}")
set(exe "${CMAKE_COMMAND}")
set(args -P "${dir}/ValidateBuild.cmake")
-set(Trilinos_RUN_TEST ${exe} ${args})
+set(CMake_TEST_CONTRACT_Trilinos_RUN_TEST ${exe} ${args})
diff --git a/Tests/Contracts/Trilinos/EnvScript.cmake b/Tests/Contracts/Trilinos/EnvScript.cmake
deleted file mode 100644
index dacb704..0000000
--- a/Tests/Contracts/Trilinos/EnvScript.cmake
+++ /dev/null
@@ -1,32 +0,0 @@
-# Site specific settings:
-#
-if(CTEST_SITE MATCHES "faraway")
- set(CTEST_SITE "faraway.kitware")
- set(ENV{CTEST_SITE} "${CTEST_SITE}")
-endif()
-
-if(CTEST_SITE STREQUAL "HUT11")
- set(CTEST_SITE "hut11.kitware")
- set(ENV{CTEST_SITE} "${CTEST_SITE}")
-
- set(ENV{CLAPACK_DIR} "C:/T/clapack/b/clapack-prefix/src/clapack-build")
-endif()
-
-if(CTEST_SITE MATCHES "qwghlm")
- set(CTEST_SITE "qwghlm.kitware")
- set(ENV{CTEST_SITE} "${CTEST_SITE}")
-
- set(ENV{PATH} "/opt/local/bin:$ENV{PATH}")
- set(ENV{CC} "gcc-mp-4.3")
- set(ENV{CXX} "g++-mp-4.3")
- set(ENV{FC} "gfortran-mp-4.3")
-endif()
-
-# Submit to alternate CDash server:
-#
-#set(ENV{CTEST_DROP_SITE} "localhost")
-#set(ENV{CTEST_DROP_LOCATION} "/CDash/submit.php?project=Trilinos")
-
-# Limit packages built:
-#
-set(ENV{Trilinos_PACKAGES} "Teuchos;Kokkos")
diff --git a/Tests/Contracts/VTK/CMakeLists.txt b/Tests/Contracts/VTK/CMakeLists.txt
index ef19325..c946499 100644
--- a/Tests/Contracts/VTK/CMakeLists.txt
+++ b/Tests/Contracts/VTK/CMakeLists.txt
@@ -5,24 +5,7 @@ project(VTK)
include(ExternalProject)
# find "HOME". VTK will be downloaded & built within a subdirectory.
-if(NOT DEFINED HOME)
- if(DEFINED ENV{CTEST_REAL_HOME})
- set(HOME "$ENV{CTEST_REAL_HOME}")
- else()
- set(HOME "$ENV{HOME}")
- endif()
-
- if(NOT HOME AND WIN32)
- # Try for USERPROFILE as HOME equivalent:
- string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
-
- # But just use root of SystemDrive if USERPROFILE contains any spaces:
- # (Default on XP and earlier...)
- if(HOME MATCHES " ")
- string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
- endif()
- endif()
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../Home.cmake)
set(base_dir "${HOME}/.cmake/Contracts/VTK")
diff --git a/Tests/Contracts/VTK/RunTest.cmake b/Tests/Contracts/VTK/Configure.cmake
index 65285cf..037d75a 100644
--- a/Tests/Contracts/VTK/RunTest.cmake
+++ b/Tests/Contracts/VTK/Configure.cmake
@@ -1,3 +1,3 @@
set(exe "$ENV{HOME}/.cmake/Contracts/VTK/VTK-build/bin/vtkCommonCoreCxxTests")
set(args otherArrays)
-set(VTK_RUN_TEST ${exe} ${args})
+set(CMake_TEST_CONTRACT_VTK_RUN_TEST ${exe} ${args})
diff --git a/Tests/Contracts/cse-snapshot/CMakeLists.txt b/Tests/Contracts/cse-snapshot/CMakeLists.txt
deleted file mode 100644
index 9134210..0000000
--- a/Tests/Contracts/cse-snapshot/CMakeLists.txt
+++ /dev/null
@@ -1,114 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-project(cse-snapshot)
-
-include(ExternalProject)
-
-include("${CMAKE_CURRENT_SOURCE_DIR}/LocalOverrides.cmake" OPTIONAL)
-include("${CMAKE_CURRENT_BINARY_DIR}/LocalOverrides.cmake" OPTIONAL)
-
-if(NOT DEFINED HOME)
- if(DEFINED ENV{CTEST_REAL_HOME})
- set(HOME "$ENV{CTEST_REAL_HOME}")
- else()
- set(HOME "$ENV{HOME}")
- endif()
-endif()
-message(STATUS "HOME='${HOME}'")
-
-if(NOT DEFINED repo)
- set(repo "git://public.kitware.com/cse.git")
-endif()
-message(STATUS "repo='${repo}'")
-
-if(NOT DEFINED tag)
- set(tag "cc1dcb95439a21ab1d58f444d93481598414196e")
-endif()
-message(STATUS "tag='${tag}'")
-
-string(SUBSTRING "${tag}" 0 8 shorttag)
-
-set(base_dir "${HOME}/.cmake/Contracts/${PROJECT_NAME}/${shorttag}")
-set(binary_dir "${base_dir}/build")
-set(script_dir "${base_dir}")
-set(source_dir "${base_dir}/src")
-
-if(NOT DEFINED BUILDNAME)
- set(BUILDNAME "CMakeContract-${shorttag}")
-endif()
-message(STATUS "BUILDNAME='${BUILDNAME}'")
-
-if(NOT DEFINED SITE)
- site_name(SITE)
-endif()
-message(STATUS "SITE='${SITE}'")
-
-if(NOT DEFINED PROCESSOR_COUNT)
- # Unknown:
- set(PROCESSOR_COUNT 0)
-
- # Linux:
- set(cpuinfo_file "/proc/cpuinfo")
- if(EXISTS "${cpuinfo_file}")
- file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
- list(LENGTH procs PROCESSOR_COUNT)
- endif()
-
- # Mac:
- if(APPLE)
- find_program(cmd_sysctl "sysctl")
- if(cmd_sysctl)
- execute_process(COMMAND ${cmd_sysctl} -n hw.ncpu
- OUTPUT_VARIABLE PROCESSOR_COUNT
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif()
- endif()
-
- # Windows:
- if(WIN32)
- set(PROCESSOR_COUNT "$ENV{NUMBER_OF_PROCESSORS}")
- endif()
-endif()
-message(STATUS "PROCESSOR_COUNT='${PROCESSOR_COUNT}'")
-
-find_package(Git)
-if(NOT GIT_EXECUTABLE)
- message(FATAL_ERROR "error: could not find git")
- # adjust PATH to find git, or set GIT_EXECUTABLE in LocalOverrides.cmake
-endif()
-message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
-
-configure_file(
- "${CMAKE_CURRENT_SOURCE_DIR}/Dashboard.cmake.in"
- "${script_dir}/Dashboard.cmake"
- @ONLY)
-
-# Source dir for this project exists outside the CMake build tree because it
-# is absolutely huge.
-#
-if(EXISTS "${source_dir}/.git")
- # If it exists already, download is a complete no-op:
- ExternalProject_Add(download-${PROJECT_NAME}
- DOWNLOAD_COMMAND ""
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- )
-else()
- # If it does not yet exist, download clones the git repository:
- ExternalProject_Add(download-${PROJECT_NAME}
- SOURCE_DIR "${source_dir}"
- GIT_REPOSITORY "${repo}"
- GIT_TAG "${tag}"
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- )
-endif()
-
-ExternalProject_Add(build-${PROJECT_NAME}
- DOWNLOAD_COMMAND ""
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ${CMAKE_CTEST_COMMAND} -S "${script_dir}/Dashboard.cmake"
- INSTALL_COMMAND ""
- DEPENDS download-${PROJECT_NAME}
- )
diff --git a/Tests/Contracts/cse-snapshot/Dashboard.cmake.in b/Tests/Contracts/cse-snapshot/Dashboard.cmake.in
deleted file mode 100644
index 138eb3f..0000000
--- a/Tests/Contracts/cse-snapshot/Dashboard.cmake.in
+++ /dev/null
@@ -1,76 +0,0 @@
-# This "ctest -S" script may be configured to drive a nightly dashboard on any
-# Linux machine.
-#
-set(CTEST_BINARY_DIRECTORY "@binary_dir@")
-set(CTEST_BUILD_NAME "@BUILDNAME@")
-set(CTEST_SITE "@SITE@")
-set(CTEST_SOURCE_DIRECTORY "@source_dir@")
-set(PROCESSOR_COUNT "@PROCESSOR_COUNT@")
-
-# Assume a Linux build, with a make that supports -j. Modify this script if
-# assumption is ever invalid.
-#
-if(PROCESSOR_COUNT)
- set(CTEST_BUILD_FLAGS "-j${PROCESSOR_COUNT}")
-endif()
-
-set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
-set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
-
-message("Cleaning binary dir '${CTEST_BINARY_DIRECTORY}'")
-ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
-
-# Intentionally no ctest_update step in this script. This script is run as a
-# "Contract" test on a CMake dashboard submission using the just-built ctest
-# as the driver. The download step in the Contract CMakeLists file takes care
-# of setting up the source tree before calling this ctest -S script. The idea
-# is that the source tree will be the same every day, so there should not be
-# an "update" step for this build.
-
-message("Configuring CSE in binary dir '${CTEST_BINARY_DIRECTORY}'")
-set_property(GLOBAL PROPERTY SubProject "CSE-toplevel")
-set_property(GLOBAL PROPERTY Label "CSE-toplevel")
-
-ctest_start("Experimental")
-
-set(CSE_TOPLEVEL_OPTIONS
- -DEXTERNAL_PROJECT_DASHBOARD_BUILD:BOOL=ON
- -DEXTERNAL_PROJECT_TESTS:BOOL=ON
- -DCSE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY}/built
- -DCSE_SUBSET:STRING=ALL
- -DCTEST_SITE:STRING=${CTEST_SITE}
-)
-
-ctest_configure(OPTIONS "${CSE_TOPLEVEL_OPTIONS}")
-
-# The configure step produces a file listing the CSE packages and dependencies.
-# This file also generates Project.xml and stores it in ${PROJECT_XML}.
-#
-set(subprojects "")
-if(EXISTS "${CTEST_BINARY_DIRECTORY}/CSEBuildtimeDepends.cmake")
- message("Including CSEBuildtimeDepends.cmake")
- include("${CTEST_BINARY_DIRECTORY}/CSEBuildtimeDepends.cmake")
- set(subprojects ${CSE_ALL_SORTED})
- message("Submitting Project.xml")
- ctest_submit(FILES ${PROJECT_XML})
-endif()
-
-message("Submitting CSE configure results")
-ctest_submit()
-
-if(subprojects)
- message("Building by looping over subprojects...")
- foreach(subproject ${subprojects})
- message("########## ${subproject} ##########")
- set_property(GLOBAL PROPERTY SubProject "${subproject}")
- set_property(GLOBAL PROPERTY Label "${subproject}")
- ctest_build(TARGET "${subproject}" APPEND)
- message("Submitting ${subproject} build results")
- ctest_submit(PARTS build)
- endforeach()
-else()
- message("Building all...")
- ctest_build(APPEND)
- message("Submitting build results")
- ctest_submit(PARTS build)
-endif()
diff --git a/Tests/Contracts/cse-snapshot/RunTest.cmake b/Tests/Contracts/cse-snapshot/RunTest.cmake
deleted file mode 100644
index 7eb6301..0000000
--- a/Tests/Contracts/cse-snapshot/RunTest.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(exe "$ENV{HOME}/.cmake/Contracts/cse-snapshot/510345e4/build/built/Release/git-1.6.5.2/bin/git")
-set(args help clone)
-set(cse-snapshot_RUN_TEST ${exe} ${args})