summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-04 20:44:18 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-01-04 20:44:18 (GMT)
commitcc6ae138d9df648562ce5945ebfd5b85bda4b9fc (patch)
treeb02a9c253152d0471222a2c884321f0537f7b256
parent0de5db755420d268279046ccdfea9c8182b5b4ae (diff)
parent81136214f3a45c84686461eab3917b6e1115f771 (diff)
downloadCMake-cc6ae138d9df648562ce5945ebfd5b85bda4b9fc.zip
CMake-cc6ae138d9df648562ce5945ebfd5b85bda4b9fc.tar.gz
CMake-cc6ae138d9df648562ce5945ebfd5b85bda4b9fc.tar.bz2
Merge topic 'add-trilinos-contract-test'
8113621 Establish pass criteria for the Trilinos contract test. 7348561 Use m prefix in shorttag value to indicate "md5 of tarball" c8ac930 Add contract test for Trilinos 10.6.1 snapshot.
-rw-r--r--Tests/Contracts/Trilinos-10-6/CMakeLists.txt103
-rw-r--r--Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in63
-rw-r--r--Tests/Contracts/Trilinos-10-6/EnvScript.cmake32
-rw-r--r--Tests/Contracts/Trilinos-10-6/Patch.cmake20
-rw-r--r--Tests/Contracts/Trilinos-10-6/RunTest.cmake7
-rw-r--r--Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in39
6 files changed, 264 insertions, 0 deletions
diff --git a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt b/Tests/Contracts/Trilinos-10-6/CMakeLists.txt
new file mode 100644
index 0000000..79ed669
--- /dev/null
+++ b/Tests/Contracts/Trilinos-10-6/CMakeLists.txt
@@ -0,0 +1,103 @@
+cmake_minimum_required(VERSION 2.8)
+project(Trilinos-10-6)
+
+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()
+message(STATUS "HOME='${HOME}'")
+
+if(NOT DEFINED url)
+ set(url "http://www.cmake.org/files/contracts/trilinos-10.6.1.tar.gz")
+endif()
+message(STATUS "url='${url}'")
+
+if(NOT DEFINED md5)
+ set(md5 "690230465dd21a76e3c6636fd07bd2f0")
+endif()
+message(STATUS "md5='${md5}'")
+
+string(SUBSTRING "${md5}" 0 8 shorttag)
+set(shorttag "m${shorttag}")
+
+set(download_dir "${HOME}/.cmake/Downloads")
+
+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}'")
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/Dashboard.cmake.in"
+ "${script_dir}/Dashboard.cmake"
+ @ONLY)
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/ValidateBuild.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/ValidateBuild.cmake"
+ @ONLY)
+
+# Source dir for this project exists outside the CMake build tree because it
+# is absolutely huge. Source dir is therefore cached under a '.cmake/Contracts'
+# dir in your HOME directory. Downloads are cached under '.cmake/Downloads'
+#
+if(EXISTS "${source_dir}/cmake/ctest/TrilinosCTestDriverCore.cmake")
+ # 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 pulls the tarball from the web (or
+ # no-ops if it already exists with the given md5 sum):
+ #
+ ExternalProject_Add(download-${PROJECT_NAME}
+ DOWNLOAD_DIR "${download_dir}"
+ URL "${url}"
+ URL_MD5 "${md5}"
+ SOURCE_DIR "${source_dir}"
+ PATCH_COMMAND ${CMAKE_COMMAND} -Dsource_dir=${source_dir} -P "${CMAKE_CURRENT_SOURCE_DIR}/Patch.cmake"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ )
+endif()
+
+ExternalProject_Add(build-${PROJECT_NAME}
+ DOWNLOAD_COMMAND ""
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ${CMAKE_COMMAND} -P "${script_dir}/Dashboard.cmake"
+ INSTALL_COMMAND ""
+ DEPENDS download-${PROJECT_NAME}
+ )
diff --git a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in b/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in
new file mode 100644
index 0000000..cc29502
--- /dev/null
+++ b/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in
@@ -0,0 +1,63 @@
+# This "cmake -P" script may be configured to drive a dashboard on any machine.
+#
+set(CTEST_BINARY_DIRECTORY "@binary_dir@")
+set(CTEST_BUILD_NAME "@BUILDNAME@")
+set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+set(CTEST_SITE "@SITE@")
+set(CTEST_SOURCE_DIRECTORY "@source_dir@")
+
+# Set the environment:
+#
+set(ENV{CTEST_BUILD_NAME} "${CTEST_BUILD_NAME}")
+set(ENV{CTEST_CMAKE_GENERATOR} "${CTEST_CMAKE_GENERATOR}")
+set(ENV{CTEST_SITE} "${CTEST_SITE}")
+
+# Allow override of the environment on a per-client basis:
+#
+set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_10_6_ENV_SCRIPT}")
+if(ENV_SCRIPT AND EXISTS "${ENV_SCRIPT}")
+ include("${ENV_SCRIPT}")
+endif()
+
+# Empty build dir to start with:
+#
+message("Cleaning binary dir '${CTEST_BINARY_DIRECTORY}'")
+file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}")
+
+# Generate 'do-configure' script:
+#
+file(WRITE "${CTEST_BINARY_DIRECTORY}/do-configure" "
+\"${CMAKE_COMMAND}\" -G \"${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"
+")
+
+# Make the 'do-configure' script executable and execute it:
+#
+if(WIN32)
+ configure_file(
+ "${CTEST_BINARY_DIRECTORY}/do-configure"
+ "${CTEST_BINARY_DIRECTORY}/do-configure.cmd"
+ COPYONLY)
+ execute_process(COMMAND "${CTEST_BINARY_DIRECTORY}/do-configure.cmd"
+ WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+else()
+ execute_process(COMMAND chmod +x "${CTEST_BINARY_DIRECTORY}/do-configure")
+ execute_process(COMMAND "${CTEST_BINARY_DIRECTORY}/do-configure"
+ WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+endif()
+
+# Run an experimental Trilinos dashboard:
+#
+execute_process(COMMAND
+ "${CMAKE_CTEST_COMMAND}"
+ -S "${CTEST_SOURCE_DIRECTORY}/cmake/ctest/experimental_build_test.cmake"
+ -VV
+ WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}"
+ RESULT_VARIABLE rv
+ )
+
+if(NOT "${rv}" STREQUAL "0")
+ message("error(s) (or warnings or test failures) running Trilinos dashboard
+script experimental_build_test.cmake...
+ctest returned rv='${rv}'
+")
+endif()
diff --git a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake b/Tests/Contracts/Trilinos-10-6/EnvScript.cmake
new file mode 100644
index 0000000..dacb704
--- /dev/null
+++ b/Tests/Contracts/Trilinos-10-6/EnvScript.cmake
@@ -0,0 +1,32 @@
+# 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/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos-10-6/Patch.cmake
new file mode 100644
index 0000000..a7aae27
--- /dev/null
+++ b/Tests/Contracts/Trilinos-10-6/Patch.cmake
@@ -0,0 +1,20 @@
+if(NOT DEFINED source_dir)
+ message(FATAL_ERROR "variable 'source_dir' not defined")
+endif()
+
+if(NOT EXISTS "${source_dir}/CMakeLists.txt")
+ message(FATAL_ERROR "error: No CMakeLists.txt file to patch!")
+endif()
+
+set(text "
+
+#
+# Reference variables typically given as experimental_build_test configure
+# options to avoid CMake warnings about unused variables
+#
+
+MESSAGE(\"Trilinos_ALLOW_NO_PACKAGES='\${Trilinos_ALLOW_NO_PACKAGES}'\")
+MESSAGE(\"Trilinos_WARNINGS_AS_ERRORS_FLAGS='\${Trilinos_WARNINGS_AS_ERRORS_FLAGS}'\")
+")
+
+file(APPEND "${source_dir}/CMakeLists.txt" "${text}")
diff --git a/Tests/Contracts/Trilinos-10-6/RunTest.cmake b/Tests/Contracts/Trilinos-10-6/RunTest.cmake
new file mode 100644
index 0000000..30124d8
--- /dev/null
+++ b/Tests/Contracts/Trilinos-10-6/RunTest.cmake
@@ -0,0 +1,7 @@
+# ValidateBuild.cmake is configured into this location when the test is built:
+set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}")
+
+set(exe "${CMAKE_COMMAND}")
+set(args -P "${dir}/ValidateBuild.cmake")
+
+set(Trilinos-10-6_RUN_TEST ${exe} ${args})
diff --git a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in b/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in
new file mode 100644
index 0000000..04bbf21
--- /dev/null
+++ b/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in
@@ -0,0 +1,39 @@
+#
+# This code validates that the Trilinos build was "successful enough" (since it
+# is difficult to detect this from the caller of the experimental_build_test
+# dashboard script...)
+#
+set(binary_dir "@binary_dir@")
+message("binary_dir='${binary_dir}'")
+
+
+# Count *.exe files:
+#
+file(GLOB_RECURSE exes "${binary_dir}/*.exe")
+message(STATUS "exes='${exes}'")
+list(LENGTH exes len)
+if(len LESS 47)
+ message(FATAL_ERROR "len='${len}' is less than minimum expected='47' (count of executables)")
+endif()
+message(STATUS "Found len='${len}' *.exe files")
+
+
+# Try to find the Teuchos unit tests executable:
+#
+file(GLOB_RECURSE exe "${binary_dir}/Teuchos_UnitTest_UnitTests.exe")
+list(LENGTH exe len)
+if(NOT len EQUAL 1)
+ message(FATAL_ERROR "len='${len}' is not the expected='1' (count of Teuchos_UnitTest_UnitTests.exe)")
+endif()
+message(STATUS "Found exe='${exe}'")
+
+
+# Try to run it:
+execute_process(COMMAND ${exe} RESULT_VARIABLE rv)
+if(NOT "${rv}" STREQUAL "0")
+ message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running Teuchos_UnitTest_UnitTests.exe)")
+endif()
+message(STATUS "Ran exe='${exe}' rv='${rv}'")
+
+
+message(STATUS "All Trilinos build validation tests pass.")