summaryrefslogtreecommitdiffstats
path: root/Tests/Contracts/Trilinos
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2013-08-28 19:28:14 (GMT)
committerZack Galbreath <zack.galbreath@kitware.com>2013-08-28 19:28:14 (GMT)
commit5a4a5841d4b003ee3e8e62a4c1114235582cb5c4 (patch)
treefab658a6e376ab5d432f03a19549b90359bc67f8 /Tests/Contracts/Trilinos
parentb6f6802b3d0dc1a9ab7beb62a17bd0651d87a64f (diff)
downloadCMake-5a4a5841d4b003ee3e8e62a4c1114235582cb5c4.zip
CMake-5a4a5841d4b003ee3e8e62a4c1114235582cb5c4.tar.gz
CMake-5a4a5841d4b003ee3e8e62a4c1114235582cb5c4.tar.bz2
update Trilinos contract test
The old version encountered a compile error on newer versions of GCC. Update to the latest supported release of Trilinos, remove the version number from the name of the Contract, and some other minor tweaks to get the test passing once more.
Diffstat (limited to 'Tests/Contracts/Trilinos')
-rw-r--r--Tests/Contracts/Trilinos/CMakeLists.txt103
-rw-r--r--Tests/Contracts/Trilinos/Dashboard.cmake.in63
-rw-r--r--Tests/Contracts/Trilinos/EnvScript.cmake32
-rw-r--r--Tests/Contracts/Trilinos/Patch.cmake38
-rw-r--r--Tests/Contracts/Trilinos/RunTest.cmake7
-rw-r--r--Tests/Contracts/Trilinos/ValidateBuild.cmake.in39
6 files changed, 282 insertions, 0 deletions
diff --git a/Tests/Contracts/Trilinos/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt
new file mode 100644
index 0000000..f5757b5
--- /dev/null
+++ b/Tests/Contracts/Trilinos/CMakeLists.txt
@@ -0,0 +1,103 @@
+cmake_minimum_required(VERSION 2.8)
+project(Trilinos)
+
+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-11.4.1.tar.gz")
+endif()
+message(STATUS "url='${url}'")
+
+if(NOT DEFINED md5)
+ set(md5 "28b6a3c7c0fb317b3a237997293faa8b")
+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/Dashboard.cmake.in b/Tests/Contracts/Trilinos/Dashboard.cmake.in
new file mode 100644
index 0000000..93d4f61
--- /dev/null
+++ b/Tests/Contracts/Trilinos/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_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/tribits/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/EnvScript.cmake b/Tests/Contracts/Trilinos/EnvScript.cmake
new file mode 100644
index 0000000..dacb704
--- /dev/null
+++ b/Tests/Contracts/Trilinos/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/Patch.cmake b/Tests/Contracts/Trilinos/Patch.cmake
new file mode 100644
index 0000000..6c619ac
--- /dev/null
+++ b/Tests/Contracts/Trilinos/Patch.cmake
@@ -0,0 +1,38 @@
+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}")
+
+
+if(NOT EXISTS "${source_dir}/CTestConfig.cmake")
+ message(FATAL_ERROR "error: No CTestConfig.cmake file to patch!")
+endif()
+
+set(text "
+
+#
+# Use newer than 10.6.1 CTestConfig settings from the Trilinos project.
+# Send the Trilinos dashboards to the new Trilinos CDash server instance.
+#
+set(CTEST_NIGHTLY_START_TIME \"04:00:00 UTC\") # 10 PM MDT or 9 PM MST
+set(CTEST_DROP_SITE \"testing.sandia.gov\")
+")
+
+file(APPEND "${source_dir}/CTestConfig.cmake" "${text}")
diff --git a/Tests/Contracts/Trilinos/RunTest.cmake b/Tests/Contracts/Trilinos/RunTest.cmake
new file mode 100644
index 0000000..d661a4c
--- /dev/null
+++ b/Tests/Contracts/Trilinos/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_RUN_TEST ${exe} ${args})
diff --git a/Tests/Contracts/Trilinos/ValidateBuild.cmake.in b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in
new file mode 100644
index 0000000..fa38ada
--- /dev/null
+++ b/Tests/Contracts/Trilinos/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}/TeuchosCore_UnitTest_UnitTests.exe")
+list(LENGTH exe len)
+if(NOT len EQUAL 1)
+ message(FATAL_ERROR "len='${len}' is not the expected='1' (count of TeuchosCore_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 TeuchosCore_UnitTest_UnitTests.exe)")
+endif()
+message(STATUS "Ran exe='${exe}' rv='${rv}'")
+
+
+message(STATUS "All Trilinos build validation tests pass.")