From c8ac9307fb3585e217a4f07860b12205aa2debb2 Mon Sep 17 00:00:00 2001 From: David Cole Date: Fri, 5 Nov 2010 17:52:00 -0400 Subject: [PATCH] Add contract test for Trilinos 10.6.1 snapshot. --- Tests/Contracts/Trilinos-10-6/CMakeLists.txt | 96 +++++++++++++++++++ .../Trilinos-10-6/Dashboard.cmake.in | 62 ++++++++++++ Tests/Contracts/Trilinos-10-6/EnvScript.cmake | 32 +++++++ Tests/Contracts/Trilinos-10-6/RunTest.cmake | 4 + .../Trilinos-10-6/ValidateBuild.cmake | 4 + 5 files changed, 198 insertions(+) create mode 100644 Tests/Contracts/Trilinos-10-6/CMakeLists.txt create mode 100644 Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in create mode 100644 Tests/Contracts/Trilinos-10-6/EnvScript.cmake create mode 100644 Tests/Contracts/Trilinos-10-6/RunTest.cmake create mode 100644 Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake diff --git a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt b/Tests/Contracts/Trilinos-10-6/CMakeLists.txt new file mode 100644 index 000000000..48a467ab0 --- /dev/null +++ b/Tests/Contracts/Trilinos-10-6/CMakeLists.txt @@ -0,0 +1,96 @@ +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(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) + +# 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}" + 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 000000000..1209dc87e --- /dev/null +++ b/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in @@ -0,0 +1,62 @@ +# 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(FATAL_ERROR "error(s) 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 000000000..dacb704f7 --- /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/RunTest.cmake b/Tests/Contracts/Trilinos-10-6/RunTest.cmake new file mode 100644 index 000000000..93c1505ed --- /dev/null +++ b/Tests/Contracts/Trilinos-10-6/RunTest.cmake @@ -0,0 +1,4 @@ +get_filename_component(dir "${CMAKE_CURRENT_LIST_FILE}" PATH) +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 b/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake new file mode 100644 index 000000000..6942b09ef --- /dev/null +++ b/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake @@ -0,0 +1,4 @@ +# TODO: put some actual code here to validate that the Trilinos build was +# "successful enough" +# +message(STATUS "Trilinos-10-6 build validated")