diff --git a/cmake/tribits/ReleaseNotes.txt b/cmake/tribits/ReleaseNotes.txt index 38cc91a4da8c..12528d490dcb 100644 --- a/cmake/tribits/ReleaseNotes.txt +++ b/cmake/tribits/ReleaseNotes.txt @@ -1,9 +1,29 @@ ---------------------------------------- Release Notes for TriBITS ---------------------------------------- + +2017/06/24: + +(*) MINOR: Add new all-at-once more for CTest -S driver scripts using + TRIBITS_CTEST_DRIVER() by setting the variable + ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE=TRUE. This works with older versions + of CMake/CTest and CDash but, by default, will just return a single glob + of results, not breaking results out package-by-package. Therefore, this + is disabled by default and package-by-package mode is used by default. + But if ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES=TRUE is set, then + TriBITS will take advantage of new CMake, CTest, and CDash features + (currently on a branch) to display the results on CDash broken down + package-by-package. Once these changes are merged to the CMake/CTest and + CDash 'master' branches, then the default for + ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES will be set to TRUE + automatically when it detects an updated version of CMake/CTest is + present. In the future, at some point, the TriBITS default for + ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE will change from FALSE to TRUE since + that is a much more efficient way to drive automated testing. + 2017/05/25: -(*) MINOR: PARSE_ARGUMENTS() has been depricated and replaced by +(*) MINOR: PARSE_ARGUMENTS() has been deprecated and replaced by CMAKE_PARSE_ARGUMENTS() everywhere in TriBITS. Any call to PARSE_ARGUMENTS() will warn users and tell them to use CMAKE_PARSE_ARGUMENTS() instead. @@ -21,7 +41,7 @@ Release Notes for TriBITS _SCALE_TEST_TIMEOUT even if DART_TESTING_TIMEOUT is not explicitly set. -2016/12/7/2016: +2016/12/07: (*) MAJOR: The long deprecated variable ${PROJECT_NAME}_ENABLE_SECONDARY_STABLE_CODE has been removed. Upgrading diff --git a/cmake/tribits/ci_support/TribitsDependencies.py b/cmake/tribits/ci_support/TribitsDependencies.py index 8d6cc40343d5..6e849261237a 100644 --- a/cmake/tribits/ci_support/TribitsDependencies.py +++ b/cmake/tribits/ci_support/TribitsDependencies.py @@ -266,6 +266,21 @@ def getPackageNameFromPath(self, fullPath): # packages because subpackages are listed before packages! + def getPackageNameFromTestName(self, testName): + for packageDep in self.__packagesList: + startTestName = packageDep.packageName+"_" + #print("\nstartTestName="+startTestName) + testNameStartIdx = testName.find(startTestName, 0) + if testNameStartIdx == 0: + #print("MATCH!") + if packageDep.parentPackage: + #print("Subpackage match!") + return self.getPackageByName(packageDep.parentPackage).packageName + # Else, is not a subpackage + return packageDep.packageName + return u"" + + def filterPackageNameList(self, inputPackagesList, keepTypesList, verbose=False): i = 0 outputPackagesList = [] diff --git a/cmake/tribits/ci_support/TribitsPackageTestNameUtils.py b/cmake/tribits/ci_support/TribitsPackageTestNameUtils.py new file mode 100644 index 000000000000..f0f29a2c504b --- /dev/null +++ b/cmake/tribits/ci_support/TribitsPackageTestNameUtils.py @@ -0,0 +1,86 @@ +# @HEADER +# ************************************************************************ +# +# TriBITS: Tribal Build, Integrate, and Test System +# Copyright 2013 Sandia Corporation +# +# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +# the U.S. Government retains certain rights in this software. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Corporation nor the names of the +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ************************************************************************ +# @HEADER + + +# +# General scripting support +# +# NOTE: Included first to check the version of python! +# + +from TribitsDependencies import getProjectDependenciesFromXmlFile +from GeneralScriptSupport import * + + +def getPackageNameFromTestName(trilinosDependencies, testName): + return trilinosDependencies.getPackageNameFromTestName(testName) + + +def getTestNameFromLastTestsFailedLine(trilinosDependencies, line): + lineArray = line.split(':') + assert len(lineArray) == 2, "Error, the line '"+line+"' not formatted correctly!" + testName = lineArray[1] + assert testName != "", "Error, test name '"+testName+"' can't be empty!" + return testName + + +# +# Given the lines from a LastTestsFail*.log file, return an array of the +# matching parent package names. +# +# This will return the list of matching packages only once per package. +# + +def getPackageNamesFromLastTestsFailedLines(trilinosDependencies, \ + lastTestsFailedLines \ + ): + #print ("\nlastTestsFailedLine:\n"+str(lastTestsFailedLines)) + packageNames = [] + for lastTestsFailedLine in lastTestsFailedLines: + #print ("\nlastTestsFailedLine = '"+lastTestsFailedLine+"'") + testName = \ + getTestNameFromLastTestsFailedLine(trilinosDependencies, lastTestsFailedLine) + #print ("\ntestName = '"+testName+"'") + packageName = getPackageNameFromTestName(trilinosDependencies, testName) + #print("\npackageName = '"+packageName+"'") + if findInSequence(packageNames, packageName) == -1 and packageName: + #print ("\nAppend '"+packageName+"'") + packageNames.append(packageName) + return packageNames + diff --git a/cmake/tribits/ci_support/get-tribits-packages-from-last-tests-failed.py b/cmake/tribits/ci_support/get-tribits-packages-from-last-tests-failed.py new file mode 100755 index 000000000000..958fece98bcd --- /dev/null +++ b/cmake/tribits/ci_support/get-tribits-packages-from-last-tests-failed.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +# @HEADER +# ************************************************************************ +# +# TriBITS: Tribal Build, Integrate, and Test System +# Copyright 2013 Sandia Corporation +# +# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +# the U.S. Government retains certain rights in this software. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Corporation nor the names of the +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ************************************************************************ +# @HEADER + +from TribitsPackageTestNameUtils import * + + +# +# Read in the commandline arguments +# + +usageHelp = r"""get-tribits-packages-from-last-tests-failed.py --deps-xml-file= --last-tests-failed-file= +""" + +from optparse import OptionParser + +clp = OptionParser(usage=usageHelp) + +clp.add_option( + "--deps-xml-file", dest="depsXmlFile", type="string", default=None, + help="File containing the listing of packages, dir names, dependencies, etc.") + +clp.add_option( + "--last-tests-failed-file", dest="lastTestsFailedFile", type="string", default=None, + help="LastTestsFailed*.log file generated by CTest.") + +(options, args) = clp.parse_args() + +if not options.lastTestsFailedFile: + raise Exception("Error, the option --last-tests-failed-file=FILENAME must be set!") + +trilinosDependencies = getProjectDependenciesFromXmlFile(options.depsXmlFile) + +lastTestsFailedLines = readStrFromFile(options.lastTestsFailedFile).splitlines() + +packageNames = getPackageNamesFromLastTestsFailedLines(trilinosDependencies, + lastTestsFailedLines) + +print ';'.join(packageNames) diff --git a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake index 42a268055290..c67f30458d5d 100644 --- a/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -1515,26 +1515,38 @@ ENDFUNCTION() # -# Function that prints the current set of enabled/disabled packages +# Function that prints the current set of enabled/disabled packages given +# input list of packages. # -FUNCTION(TRIBITS_PRINT_ENABLED_PACKAGE_LIST DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) +FUNCTION(TRIBITS_PRINT_ENABLED_PACKAGES_LIST_FROM_VAR PACKAGES_LIST_VAR + DOCSTRING ENABLED_FLAG INCLUDE_EMPTY + ) IF (ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_ENABLED_LIST(${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} + TRIBITS_GET_ENABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) ELSEIF (ENABLED_FLAG AND INCLUDE_EMPTY) - TRIBITS_GET_NONDISABLED_LIST(${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} + TRIBITS_GET_NONDISABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) ELSEIF (NOT ENABLED_FLAG AND NOT INCLUDE_EMPTY) - TRIBITS_GET_DISABLED_LIST(${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} + TRIBITS_GET_DISABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) ELSE() # NOT ENABLED_FLAG AND INCLUDE_EMPTY - TRIBITS_GET_NONENABLED_LIST(${PROJECT_NAME}_PACKAGES ${PROJECT_NAME} + TRIBITS_GET_NONENABLED_LIST(${PACKAGES_LIST_VAR} ${PROJECT_NAME} ENABLED_PACKAGES NUM_ENABLED) ENDIF() TRIBITS_PRINT_PREFIX_STRING_AND_LIST("${DOCSTRING}" "${ENABLED_PACKAGES}") ENDFUNCTION() +# +# Function that prints the current set of enabled/disabled packages +# +FUNCTION(TRIBITS_PRINT_ENABLED_PACKAGE_LIST DOCSTRING ENABLED_FLAG INCLUDE_EMPTY) + TRIBITS_PRINT_ENABLED_PACKAGES_LIST_FROM_VAR( ${PROJECT_NAME}_PACKAGES + "${DOCSTRING}" ${ENABLED_FLAG} ${INCLUDE_EMPTY} ) +ENDFUNCTION() + + # # Function that prints the current set of enabled/disabled SE packages # diff --git a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake index 2fc50b11693d..6da27399e55e 100644 --- a/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake +++ b/cmake/tribits/core/package_arch/TribitsPackageMacros.cmake @@ -241,6 +241,11 @@ MACRO(TRIBITS_PACKAGE_DECL PACKAGE_NAME_IN) # Set up parent package linkage varaibles TRIBITS_DEFINE_TARGET_VARS(${PACKAGE_NAME}) + IF (${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES) + # Define this as a CMake/CTest "Subproject" + SET_DIRECTORY_PROPERTIES(PROPERTIES LABELS "${PACKAGE_NAME}") + ENDIF() + # # Append the local package's cmake directory in order to help pull in # configure-time testing macros diff --git a/cmake/tribits/core/utils/NinjaMakefileCommon.make b/cmake/tribits/core/utils/NinjaMakefileCommon.make index da615f635f67..56d3a4f5521c 100644 --- a/cmake/tribits/core/utils/NinjaMakefileCommon.make +++ b/cmake/tribits/core/utils/NinjaMakefileCommon.make @@ -13,10 +13,15 @@ endif STANDARD_TARGETS := install test package package_source edit_cache rebuild_cache +BUILD_OBJ := "^build $(SUBDIR)/CMakeFiles/\([^:]*\.o\):.*" +OBJECTS := $(shell sed -n "\|"$(BUILD_OBJ)"| {s|"$(BUILD_OBJ)"|CMakeFiles/\1|;p}" $(TOPDIR)/build.ninja) + all $(STANDARD_TARGETS): $(NINJA) -C $(TOPDIR) $(NINJA_FLAGS) $(SUBDIR)/$@ $(TARGETS): $(NINJA) -C $(TOPDIR) $(NINJA_FLAGS) $@ +$(OBJECTS): + $(NINJA) -C $(TOPDIR) $(NINJA_FLAGS) $(SUBDIR)/$@ clean: $(NINJA) -C $(TOPDIR) $(NINJA_FLAGS) -t clean $(SUBDIR)/all help: @@ -27,5 +32,11 @@ help: @echo "and the following project targets:" @echo "" @for t in $(sort $(TARGETS)); do echo " $$t"; done + @echo "" + @echo "Run 'make help-objects' to list object files." +help-objects: + @echo "This Makefile supports the following object files:" + @echo "" + @for t in $(sort $(OBJECTS)); do echo " $$t"; done -.PHONY: all clean help $(STANDARD_TARGETS) $(TARGETS) +.PHONY: all clean help help-objects $(STANDARD_TARGETS) $(TARGETS) $(OBJECTS) diff --git a/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake b/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake index d0fcb25caafa..bbb1b63db444 100644 --- a/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake +++ b/cmake/tribits/ctest_driver/TribitsAddDashboardTarget.cmake @@ -85,9 +85,17 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) APPEND_SET(EXPR_CMND_ARGS "TRIBITS_PROJECT_ROOT=${${PROJECT_NAME}_SOURCE_DIR}") APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}") APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS='${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS}'") + APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE='${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}'") - # Conditionally override options used only for testing. These options have no use in a - # a basic build/test so we don't want to interfere with options users might set on the env. + # Conditionally override options used only for testing. These options + # have no use in a a basic build/test so we don't want to interfere with + # options users might set on the env. + IF (${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) + APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE=TRUE") + ENDIF() + IF (${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES) + APPEND_SET(EXPR_CMND_ARGS "${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES=TRUE") + ENDIF() IF (${PROJECT_NAME}_ENABLE_COVERAGE_TESTING) APPEND_SET(EXPR_CMND_ARGS "CTEST_DO_COVERAGE_TESTING=TRUE") ENDIF() @@ -97,6 +105,9 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) IF (CTEST_PARALLEL_LEVEL) APPEND_SET(EXPR_CMND_ARGS "CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL}") ENDIF() + IF (NOT "${CTEST_DO_SUBMIT}" STREQUAL "") + APPEND_SET(EXPR_CMND_ARGS "CTEST_DO_SUBMIT=${CTEST_DO_SUBMIT}") + ENDIF() IF (CTEST_DROP_SITE) APPEND_SET(EXPR_CMND_ARGS "CTEST_DROP_SITE=${CTEST_DROP_SITE}") ENDIF() @@ -126,38 +137,91 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) # H.2) Add the custom target to enable all the packages with tests enabled - ADD_CUSTOM_TARGET(dashboard + IF (${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) + + SET(RUNNING_EXP_DASHBOARD_MSG_HEADER + "Running all-at-once experimental dashboard" + ) + + SET(DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS) + + SET(DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM) + + SET(DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS) + + ELSE() + + SET(RUNNING_EXP_DASHBOARD_MSG_HEADER + "Running package-by-package experimental dashboard" + ) + + SET(DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS + COMMAND echo + COMMAND echo "***" + COMMAND echo "*** A) Clean out the list of packages" + COMMAND echo "***" + COMMAND echo + COMMAND echo Running: ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE + -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} + COMMAND echo + COMMAND ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE + -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} + # NOTE: Above, if ${PROJECT_NAME}_ENABLE_ALL_PACKAGES was set in CMakeCache.txt, then setting + # -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF will turn it off in the cache. Note that it will + # never be turned on again which means that the list of packages will be set explicitly below. + ) + + SET(DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM "B) ") + + SET(DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS + COMMAND echo + COMMAND echo "***" + COMMAND echo "*** C) Clean out the list of packages again to clean the cache file" + COMMAND echo "***" + COMMAND echo + COMMAND echo Running: ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE + -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} + COMMAND echo + COMMAND ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE + -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} + + COMMAND echo + COMMAND echo "***" + COMMAND echo "*** D) Reconfigure with the original package list" + COMMAND echo "***" + COMMAND echo + COMMAND echo Running: ${CMAKE_COMMAND} ${${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST} + -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON ${PROJECT_SOURCE_DIR} + COMMAND echo + COMMAND ${CMAKE_COMMAND} ${${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST} + -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON ${PROJECT_SOURCE_DIR} + + COMMAND echo + COMMAND echo "See the results at http://${CTEST_DROP_SITE}${CTEST_DROP_LOCATION}&display=project\#Experimental" + COMMAND echo + ) + + ENDIF() + + ADD_CUSTOM_TARGET( dashboard VERBATIM # WARNING: The echoed command and the actual commands are duplicated! You have to reproduce them! COMMAND echo - COMMAND echo "***************************************************" - COMMAND echo "*** Running incremental experimental dashboard ***" - COMMAND echo "***************************************************" + COMMAND echo "**************************************************" + COMMAND echo "*** ${RUNNING_EXP_DASHBOARD_MSG_HEADER} ***" + COMMAND echo "**************************************************" COMMAND echo COMMAND echo ${PROJECT_NAME}_ENABLED_PACKAGES_LIST=${${PROJECT_NAME}_ENABLED_PACKAGES_LIST} COMMAND echo - COMMAND echo - COMMAND echo "***" - COMMAND echo "*** A) Clean out the list of packages" - COMMAND echo "***" - COMMAND echo - COMMAND echo Running: ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE - -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} - COMMAND echo - COMMAND ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE - -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} - - # NOTE: Above, if ${PROJECT_NAME}_ENABLE_ALL_PACKAGES was set in CMakeCache.txt, then setting - # -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF will turn it off in the cache. Note that it will - # never be turned on again which means that the list of packages will be set explicitly below. + ${DASHBOARD_TARGET_PRE_CTEST_DRIVER_CMNDS} COMMAND echo COMMAND echo "***" - COMMAND echo "*** B) Run the dashboard command setting the list of packages" + COMMAND echo "*** ${DASHBOARD_TARGET_CTEST_DRIVER_CMND_NUM}Run the dashboard command setting the list of packages" COMMAND echo "***" COMMAND echo COMMAND echo Running: env ${EXPR_CMND_ARGS} @@ -171,32 +235,11 @@ MACRO(TRIBITS_ADD_DASHBOARD_TARGET) PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} ${CMAKE_CTEST_COMMAND} ${${PROJECT_NAME}_DASHBOARD_CTEST_ARGS} -S ${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver/experimental_build_test.cmake || echo - # 2009/07/05: rabartl: Above, I added the ending '|| echo' to always make # the command pass so that 'make' will not stop and avoid this last command # to set back the enabled packages. - COMMAND echo - COMMAND echo "***" - COMMAND echo "*** C) Clean out the list of packages again to clean the cache file" - COMMAND echo "***" - COMMAND echo - COMMAND echo Running: ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE - -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} - COMMAND echo - COMMAND ${CMAKE_COMMAND} -D${PROJECT_NAME}_UNENABLE_ENABLED_PACKAGES:BOOL=TRUE - -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON -D${PROJECT_NAME}_ENABLE_ALL_PACKAGES:BOOL=OFF ${PROJECT_SOURCE_DIR} - - COMMAND echo - COMMAND echo "***" - COMMAND echo "*** D) Reconfigure with the original package list" - COMMAND echo "***" - COMMAND echo - COMMAND echo Running: ${CMAKE_COMMAND} ${${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST} - -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON ${PROJECT_SOURCE_DIR} - COMMAND echo - COMMAND ${CMAKE_COMMAND} ${${PROJECT_NAME}_ENABLED_PACKAGES_CMAKE_ARG_LIST} - -D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON ${PROJECT_SOURCE_DIR} + ${DASHBOARD_TARGET_POST_CTEST_DRIVER_CMNDS} COMMAND echo COMMAND echo "See the results at http://${CTEST_DROP_SITE}${CTEST_DROP_LOCATION}&display=project\#Experimental" diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake index d2ce81898c8c..10c4c8bbea60 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -210,36 +210,37 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # @FUNCTION: TRIBITS_CTEST_DRIVER() # -# Platform-independent package-by-package CTest/CDash driver (run by ``ctest`` -# **NOT** ``cmake``). +# Platform-independent CTest/CDash driver # # Usage:: # # TRIBITS_CTEST_DRIVER() # -# This driver code that is platform independent. This script drives the -# testing process by doing a version control (VC) source update on all of the -# VC repos and then configuring and building the top-level TriBITS packages -# one at a time, in order. This function gets called from inside of a -# platform and build-specific ``ctest -S`` driver script. +# This driver code is platform independent. CTest -S scripts use this +# function to drive the testing process for a TriBITS projects by doing a +# version control (VC) source update on all of the VC repos and then +# configuring, building, testing, and submitting results to CDash for the +# TriBITS packages in a project either in package-by-package mode (the +# default), or in an all-at-once mode (see +# ``${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE``). # -# To understand this script, one must understand that it gets run in several -# different modes: +# **Source and Binary Directory Locations:** +# +# To understand how to set the source and binary directories, one must +# understand that it gets run in one of two different modes: # # **Mode 1**: Run where there are already existing source and binary -# directories (``CTEST_DASHBOARD_ROOT`` is set empty before call). This is -# for when the ctest driver script is run on an existing source and binary -# tree. In this case, there is one project source tree and -# ``CTEST_SOURCE_DIRECTORY`` and ``CTEST_BINARY_DIRECTORY`` must be set by the -# user before calling this function. This is used to test a local build and -# post to CDash. +# directories (i.e. ``CTEST_DASHBOARD_ROOT`` is set empty before call). In +# this case, ``CTEST_SOURCE_DIRECTORY`` and ``CTEST_BINARY_DIRECTORY`` must be +# set by the user before calling this function. This is used to test a local +# build and post to CDash (see the custom ``dashboard`` target). # # **Mode 2**: A new binary directory is created and new sources are cloned (or -# updated) in a driver directory (``CTEST_DASHBOARD_ROOT`` is set before +# updated) in a driver directory (i.e. ``CTEST_DASHBOARD_ROOT`` is set before # call). In this case, there are always two (partial) project source tree's, -# i) a "driver" skeleton source tree (typically embedded with TriBITS -# directory) that bootstraps the testing process, and ii) a true full "source" -# that is (optionally) cloned and/or updated. +# a) a "driver" skeleton source tree (typically embedded with TriBITS +# directory) that bootstraps the testing process, and b) a true full "source" +# that is (optionally) cloned and/or updated and tested.. # # There are a few different directory locations are significant for this # script: @@ -247,8 +248,8 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # ``TRIBITS_PROJECT_ROOT`` # # The root directory to an existing source tree where the project's -# `/ProjectName.cmake`_ (defining ``PROJECT_NAME`` variable) -# and ``Version.cmake`` file's can be found. +# `/ProjectName.cmake`_ (defining the ``PROJECT_NAME`` +# variable) and ``Version.cmake`` files can be found. # # ``${PROJECT_NAME}_TRIBITS_DIR`` # @@ -261,17 +262,17 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # If set, this is the base directory where this script runs that clones # the sources for the project. If this directory does not exist, it will -# be created. If provided the special value 'PWD', then the present -# working directory is used. If empty, then has no effect on the script. +# be created. If provided as the special value "PWD", then the present +# working directory is used. If empty, then this var has no effect. # # ``CTEST_SOURCE_DIRECTORY`` # # Determines the location of the sources that are used to define packages, -# dependencies and configure and build the software. This is a variable -# that CTest directly reads and must therefore be set. This is used to set -# `PROJECT_SOURCE_DIR`_ which is used by the TriBITS system. If -# ``CTEST_DASHBOARD_ROOT`` is set, then this is hard-coded internally to -# ``${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}``. +# dependencies and configure, build, and test the software. This is a +# variable that CTest directly reads and must therefore be set. This is +# used to set `PROJECT_SOURCE_DIR`_ which is used by the TriBITS system. +# If ``CTEST_DASHBOARD_ROOT`` is set, then this is hard-coded internally +# to ``${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}``. # # ``CTEST_BINARY_DIRECTORY`` # @@ -280,6 +281,12 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # the TriBITS system. If ``CTEST_DASHBOARD_ROOT`` is set, then this is # hard-coded internally to ``${CTEST_DASHBOARD_ROOT}/BUILD``. # +# **Determining What Packages Get Tested:** +# +# Before any testing is done, the set of packages to be tested is determined +# are determined. By default, the set of packages to be tested is determined +# by the var: +# # ``${PROJECT_NAME}_PACKAGES`` # # Determines the specific set of packages to test. If left at the default @@ -289,15 +296,69 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # This variable can also be specified and read from from the env and can # use `,` to separate package names instead of ';'. # -# ToDo: Document input variables that have defaults, to be set before, and can -# be overridden from the env. +# ToDo: Document other variables that determine what packages get tested. +# +# The other mode is to only test the packages that have changes since the last +# time this build was run and testing packages that previously failed. That +# mode is turned on by the var: +# +# ``CTEST_ENABLE_MODIFIED_PACKAGES_ONLY`` +# +# If ``TRUE``, then only packages that have changes pulled from the git +# repos since the last time the build ran will be tested (in addition to +# packages that failed in the last build). If ``FALSE``, the set of +# packages to be tested is determined by ``${PROJECT_NAME}_PACKAGES`` and +# other variables as described above. +# +# ToDo: Document other input variables that have defaults, to be set before, +# and can be overridden from the env. +# +# **All-at-once vs. package-by-package mode:** +# +# This function supports driving the configure, build, testing, and submitting +# to CDash of the packages in the TriBITS project either all-at-once or +# package-by-package, based on the value: +# +# ``${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE`` # -# **Repository updates:** +# If ``TRUE``, then single calls to ``CTEST_CONFIGURE()``, +# ``CTEST_BUILD()`` and ``CTEST_TEST()` are made for all of the packages +# to be tested all at once with ``CTEST_SUBMIT()`` called after each of +# these. If ``FALSE`` then ``CTEST_CONFIGURE()``, ``CTEST_BUILD()`` and +# ``CTEST_TEST()` and ``CTEST_SUBMIT()`` are called in a loop, once for +# each package to be explicitly tested. +# +# Both the all-at-once mode and the package-by-package mode should produce +# equivalent builds of the project and submits to CDash (for correctly +# constructed TriBITS projects and package). But the package-by-package mode +# will disable failing packages when processing downstream packages, and +# therefore reduce the propagation of failures to downstream packages. +# +# For versions of CMake 3.10.0 and above and newer versions of CDash, the +# all-at-once mode will break down the build and test results on a +# package-by-package basis on CDash. For older versions of CMake or CDash, it +# will not break down results on a package-by-package basis on CDash and all +# of the build warnings and errors and test will be all globed together. +# +# **Repository Updates:** # # Like the rest of TriBITS, ``ctest -S`` scripts written using this function -# supports a collection of extra repositories in addition to the base +# supports a collection of extra repositories in addition to the base git # repository. The basic clone of the extra repositories requires all repos to -# use the version control system. +# use the git version control system. +# +# Whether the repos are updated (or left as is) is determined by the var: +# +# ``CTEST_DO_UPDATES`` +# +# If set to ``TRUE``, then each of the git repos will be cloned if they are +# missing and if already present will be updated as described below (and +# will wipe out any local changes). If ``FALSE``, then the git repos will +# be left alone (and must therefore already be cloned and updated at the +# desired state). +# +# **WARNING:** If you don't want local changes in your git repos to get blown +# away, then set ``CTEST_DO_UPDATES`` to ``FALSE``! # # CTest itself is used for handling the cloning and the pull of the base # repository by calling ``CTEST_UPDATE()``. The other extra git repositories @@ -309,13 +370,14 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # git clone # -# Therefore, by default, whatever the default branch is set to on clone, that -# is the branch that will be used. Also, future repository updates will be -# done on those branches. +# Therefore, by default, whatever the default branch is set to on clone in the +# base repos, that is the branch that will be used. Also, future repository +# updates will be done on those branches. # # However, if ``${PROJECT_NAME}_BRANCH`` is set to non-empty, then that branch # will be checked out in all of the repositories. For the base repository, -# after the clone or update, that branch is checked out using the command:: +# after the clone or update is performed in the call to ``CTEST_UPDATE()``, +# then that branch is checked out using the command:: # # $ git checkout -B ${${PROJECT_NAME}_BRANCH} \ # --track origin/${${PROJECT_NAME}_BRANCH}` @@ -333,9 +395,9 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # The command ``git clone -fdx`` removes any untracked ignored files that may # have been created since the last update (either by the build process or by -# someone messing around in that git repository). The command ``git reset -# --hard HEAD`` removes any untracked non-ignored files, any modified tracked -# files, and sets ``ORIG_HEAD`` to the current ``HEAD``. This sets +# someone messing around in that local git repository). The command ``git +# reset --hard HEAD`` removes any untracked non-ignored files, any modified +# tracked files, and sets ``ORIG_HEAD`` to the current ``HEAD``. This sets # ``ORIG_HEAD`` after the initial clone (as ``ORIG_HEAD`` is not set after a # ``git clone``). This allows using the range ``ORIG_HEAD..HEAD`` with git # diff and log commands even after the initial clone. The ``git fetch`` @@ -367,12 +429,13 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # Note that the repository updating approach using non-empty # ``${PROJECT_NAME}_BRANCH`` is more robust, because it can recover from a -# state where someone may have put the repo on a detached head or checked out -# a different branch. This might occur when a person is messing around in the -# Nightly build and source directories to try to figure out what happened and -# forgot to put the repos back on the correct tracking branch. Therefore, it -# is recommended to always set ``${PROJECT_NAME}_BRANCH`` to a non-null value -# like ``master`` for git repos. +# state where someone may have put A repo on a detached head or checked out a +# different branch. One of these repos might get into this state when a +# person is messing around in the Nightly build and source directories to try +# to figure out what happened and forgot to put the repos back on the correct +# tracking branch. Therefore, it is recommended to always set +# ``${PROJECT_NAME}_BRANCH`` to a non-null value like ``master`` for git +# repos. # # ToDo: Finish Documentation! # @@ -439,7 +502,7 @@ FUNCTION(TRIBITS_CTEST_DRIVER) # Set the default compiler version SET_DEFAULT_AND_FROM_ENV(COMPILER_VERSION UNKNOWN) - # The name of the build that appears in the dashbaord + # The name of the build that appears in the dashboard SET_DEFAULT_AND_FROM_ENV( CTEST_BUILD_NAME "${HOST_TYPE}-${COMPILER_VERSION}-${BUILD_DIR_NAME}" ) @@ -467,6 +530,20 @@ FUNCTION(TRIBITS_CTEST_DRIVER) # Flags used on update when doing a Git update SET_DEFAULT_AND_FROM_ENV( CTEST_UPDATE_OPTIONS "") + # If doing all-at-one approach, use new CMkae/CTest/CDash features to allow + # it to split out results into different rows on CDash like the + # package-by-packages appraoch. + SET_DEFAULT_AND_FROM_ENV( ${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES FALSE ) + + # Do all-at-once configure, build, test and submit (or package-by-package) + IF (${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES) + SET(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT TRUE) + ELSE() + SET(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT FALSE) + ENDIF() + SET_DEFAULT_AND_FROM_ENV( ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE + ${${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT} ) + # Flags passed to 'make' assume gnumake with unix makefiles IF("${CTEST_CMAKE_GENERATOR}" MATCHES "Unix Makefiles") SET_DEFAULT_AND_FROM_ENV( CTEST_BUILD_FLAGS "-j2") @@ -613,7 +690,8 @@ FUNCTION(TRIBITS_CTEST_DRIVER) # Set as part of CI testing in order to only enable modified packages SET_DEFAULT_AND_FROM_ENV( CTEST_ENABLE_MODIFIED_PACKAGES_ONLY OFF ) - # Set if implicitly enabled packages should be explicitly processes + # Set if implicitly enabled packages should be explicitly processed in + # package-by-package mode. IF (CTEST_ENABLE_MODIFIED_PACKAGES_ONLY AND NOT CTEST_START_WITH_EMPTY_BINARY_DIRECTORY) SET( CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES_DEFAULT FALSE ) ELSE() @@ -688,7 +766,6 @@ FUNCTION(TRIBITS_CTEST_DRIVER) # INCLUDE("${TRIBITS_PROJECT_ROOT}/CTestConfig.cmake") - SET(CMAKE_CACHE_CLEAN_FILE "${CTEST_BINARY_DIRECTORY}/CMakeCache.clean.txt") SET(CTEST_USE_LAUNCHERS 1) # For coverage dashboards, send results to specialized dashboard if @@ -860,13 +937,13 @@ FUNCTION(TRIBITS_CTEST_DRIVER) IF (NOT CTEST_ENABLE_MODIFIED_PACKAGES_ONLY) MESSAGE( "\n***" - "\n*** Determining what packages to enable based what was set in ${PROJECT_NAME}_PACKAGES ..." + "\n*** Determining what packages to enable based what was set in ${PROJECT_NAME}_PACKAGES by the user ..." "\n***\n") ENABLE_USER_SELECTED_PACKAGES() ELSE() MESSAGE( "\n***" - "\n*** Determining what packages to enable based on what changed ..." + "\n*** Determining what packages to enable based on what changed (and failed last CI iteration) ..." "\n***\n") ENABLE_ONLY_MODIFIED_PACKAGES() SET(${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES ON) @@ -884,11 +961,13 @@ FUNCTION(TRIBITS_CTEST_DRIVER) SET(${PROJECT_NAME}_ENABLE_EXAMPLES ON) SET(${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES ON) SET(DO_PROCESS_MPI_ENABLES FALSE) # Should not be needed but CMake is messing up - TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES() # Sets ${PROJECT_NAME}_NUM_ENABLED_PACKAGES + TRIBITS_ADJUST_AND_PRINT_PACKAGE_DEPENDENCIES() + # Above sets ${PROJECT_NAME}_NUM_ENABLED_PACKAGES - SELECT_FINAL_SET_OF_PACKAGES_TO_PROCESS() + SELECT_FINAL_SET_OF_PACKAGES_TO_DIRECTLY_TEST() + # Above sets ${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST - TRIBITS_PRINT_ENABLED_PACKAGE_LIST( + TRIBITS_PRINT_ENABLED_PACKAGES_LIST_FROM_VAR( ${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST "\nFinal set of packages to be explicitly processed by CTest/CDash" ON FALSE) MESSAGE( @@ -979,302 +1058,22 @@ FUNCTION(TRIBITS_CTEST_DRIVER) MESSAGE("\nSkipping submitted subproject dependencies XML file on request!") ENDIF() - MESSAGE( "\n***" - "\n*** Loop through ${PROJECT_NAME} packages to configure, build, and test ..." + "\n*** Configure, build, test, and submit results for ${PROJECT_NAME} packages:" "\n***") - SET(${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE) - SET(${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES) + SET(CMAKE_CACHE_CLEAN_FILE "${CTEST_BINARY_DIRECTORY}/CMakeCache.clean.txt") SET(${PROJECT_NAME}_FAILED_PACKAGES) - SET(PACKAGE_IDX 0) - - FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) - - MESSAGE("") - MESSAGE("${PACKAGE_IDX}) Processing current package ${TRIBITS_PACKAGE}:" - " libs='${${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}}'," - " tests='${${TRIBITS_PACKAGE}_ENABLE_TESTS}'") - MESSAGE("") - - SET_PROPERTY(GLOBAL PROPERTY SubProject ${TRIBITS_PACKAGE}) - SET_PROPERTY(GLOBAL PROPERTY Label ${TRIBITS_PACKAGE}) - - # - # A) Configure the package and its dependent packages - # - - MESSAGE("Configuring TRIBITS_PACKAGE='${TRIBITS_PACKAGE}'") - - # Create CONFIGURE_OPTIONS for this TRIBITS_PACKAGE - SET( CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}" - "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}" - "-D${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON" - "-D${PROJECT_NAME}_ENABLE_TESTS:BOOL=${${TRIBITS_PACKAGE}_ENABLE_TESTS}" - "-D${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS:STRING=${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS}" - "-D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON" - "-D${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=${${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES}" - ) - IF (NOT CTEST_GENERATE_DEPS_XML_OUTPUT_FILE) - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE:FILEPATH=") - ENDIF() - IF (NOT "${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}" STREQUAL "") - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE:BOOL=${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}") - ENDIF() - IF (NOT MPI_EXEC_MAX_NUMPROCS STREQUAL 0) - LIST(APPEND CONFIGURE_OPTIONS - "-DMPI_EXEC_MAX_NUMPROCS:STRING=${MPI_EXEC_MAX_NUMPROCS}") - ENDIF() - IF (CTEST_DO_COVERAGE_TESTING) - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_ENABLE_COVERAGE_TESTING:BOOL=ON") - ENDIF() - IF (${PROJECT_NAME}_EXTRAREPOS_FILE STREQUAL "NONE") - SET(EXTRAREOS_FILE_PASSED "") - ELSE() - SET(EXTRAREOS_FILE_PASSED "${${PROJECT_NAME}_EXTRAREPOS_FILE}") - ENDIF() - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_EXTRAREPOS_FILE:STRING=${EXTRAREOS_FILE_PASSED}") - LIST(APPEND CONFIGURE_OPTIONS # See TRIBITS_SETUP_PACKAGES - "-D${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES:BOOL=ON") - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE:STRING=${${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}") - IF (DEFINED ${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE) - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_ENABLE_${${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE}:BOOL=") - SET(${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE) - ENDIF() - FOREACH(FAILED_PACKAGE ${${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES}) - LIST(APPEND CONFIGURE_OPTIONS - "-D${PROJECT_NAME}_ENABLE_${FAILED_PACKAGE}:BOOL=OFF") - ENDFOREACH() - SET(CONFIGURE_OPTIONS ${CONFIGURE_OPTIONS} - ${EXTRA_SYSTEM_CONFIGURE_OPTIONS} ${EXTRA_CONFIGURE_OPTIONS}) - LIST(APPEND CONFIGURE_OPTIONS # Package enable must be at the very end to override other stuff! - "-D${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}:BOOL=ON" ) - MESSAGE("\nCONFIGURE_OPTIONS = '${CONFIGURE_OPTIONS}'") - - # Remember this package so we can set its enable to "" next time - SET(${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE "${TRIBITS_PACKAGE}") - - # - # B) Configure the package and its dependent packages - # - - IF (NOT CTEST_DEPENDENCY_HANDLING_UNIT_TESTING) - - CTEST_CONFIGURE( - BUILD "${CTEST_BINARY_DIRECTORY}" - OPTIONS "${CONFIGURE_OPTIONS}" # New option! - RETURN_VALUE CONFIGURE_RETURN_VAL - ) - - MESSAGE("Generating the file '${CMAKE_CACHE_CLEAN_FILE}' ...") - TRIBITS_STRIP_COMMENTS_FROM_CMAKE_CACHE_FILE( - "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" - "${CMAKE_CACHE_CLEAN_FILE}" - ) - - # If the configure failed, add the package to the list - # of failed packages - IF (NOT "${CONFIGURE_RETURN_VAL}" EQUAL "0") - MESSAGE("${TRIBITS_PACKAGE} FAILED to configure") - LIST(APPEND ${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES ${TRIBITS_PACKAGE}) - LIST(APPEND ${PROJECT_NAME}_FAILED_PACKAGES ${TRIBITS_PACKAGE}) - ELSE() - MESSAGE("${TRIBITS_PACKAGE}: Configure passed!") - # load target properties and test keywords - CTEST_READ_CUSTOM_FILES(BUILD "${CTEST_BINARY_DIRECTORY}") - # Overridde from this file! - INCLUDE("${TRIBITS_PROJECT_ROOT}/CTestConfig.cmake") - ENDIF() - - IF (EXISTS ${CMAKE_CACHE_CLEAN_FILE}) - SET(CTEST_NOTES_FILES "${CTEST_NOTES_FILES_WO_CACHE};${CMAKE_CACHE_CLEAN_FILE}") - ELSE() - SET(CTEST_NOTES_FILES "${CTEST_NOTES_FILES_WO_CACHE}") - ENDIF() - - SET(REPO_VERSION_FILE "${CTEST_BINARY_DIRECTORY}/${PROJECT_NAME}RepoVersion.txt") - IF (EXISTS "${REPO_VERSION_FILE}") - SET(CTEST_NOTES_FILES "${REPO_VERSION_FILE};${CTEST_NOTES_FILES}") - ENDIF() - - PRINT_VAR(CTEST_NOTES_FILES) - - # Submit configure results and the notes to the dashboard - IF (CTEST_DO_SUBMIT) - MESSAGE("\nSubmitting configure and notes ...") - TRIBITS_CTEST_SUBMIT( PARTS configure notes ) - ENDIF() - ENDIF() - - # - # C) If configure passed then try the build. Otherwise, move on to - # to the next package. - # - - IF ("${CONFIGURE_RETURN_VAL}" EQUAL "0" AND - NOT CTEST_DEPENDENCY_HANDLING_UNIT_TESTING AND - NOT CTEST_CONFIGURATION_UNIT_TESTING - ) - - # Start by trying to build just the libraries for the current package - - SET( CTEST_BUILD_TARGET ${TRIBITS_PACKAGE}_libs ) - MESSAGE("\nBuilding target: '${CTEST_BUILD_TARGET}' ...\n") - CTEST_BUILD( - BUILD "${CTEST_BINARY_DIRECTORY}" - RETURN_VALUE BUILD_LIBS_RETURN_VAL - NUMBER_ERRORS BUILD_LIBS_NUM_ERRORS - APPEND - ) - MESSAGE("Build return: RETURN_VALUE=${BUILD_LIBS_RETURN_VAL}," - " NUMBER_ERRORS=${BUILD_LIBS_NUM_ERRORS}") - - # Determine if the build failed or not. - - SET(BUILD_LIBS_SUCCESS FALSE) - IF ("${BUILD_LIBS_NUM_ERRORS}" EQUAL "0") - MESSAGE("${TRIBITS_PACKAGE}: Libs build passed!") - SET(BUILD_LIBS_SUCCESS TRUE) - ENDIF() - # Above: Since make -i is used BUILD_LIBS_RETURN_VAL might be 0, but - # if there are errors the build should fail, so both - # BUILD_LIBS_RETURN_VAL and BUILD_LIBS_NUM_ERRORS should be 0 for a - # good build and for the all target to be built. - - # Submit the library build results to the dashboard - - IF (CTEST_DO_SUBMIT) - TRIBITS_CTEST_SUBMIT( PARTS build ) - ENDIF() - - # If the build of the libraries passed, then go on the build - # the tests/examples and run them. - - IF (BUILD_LIBS_SUCCESS) - - SET(BUILD_OR_TEST_FAILED FALSE) - - # Build the ALL target, but append the results to the last build.xml - SET(CTEST_BUILD_TARGET) - MESSAGE("\nBuild ALL target for '${TRIBITS_PACKAGE}' ...\n") - CTEST_BUILD( - BUILD "${CTEST_BINARY_DIRECTORY}" - RETURN_VALUE BUILD_ALL_RETURN_VAL - NUMBER_ERRORS BUILD_ALL_NUM_ERRORS - APPEND - ) - MESSAGE("Build all: BUILD_ALL_NUM_ERRORS='${BUILD_ALL_NUM_ERRORS}'," - "BUILD_ALL_RETURN_VAL='${BUILD_ALL_RETURN_VAL}'" ) - - IF (NOT "${BUILD_ALL_NUM_ERRORS}" EQUAL "0") - MESSAGE("${TRIBITS_PACKAGE}: All build FAILED!") - SET(BUILD_OR_TEST_FAILED TRUE) - ELSE() - MESSAGE("${TRIBITS_PACKAGE}: All build passed!") - ENDIF() - - # Submit the build for all target - IF (CTEST_DO_SUBMIT) - TRIBITS_CTEST_SUBMIT( PARTS build ) - ENDIF() - - IF (CTEST_DO_TEST) - # Remove the LastTestsFailed log so we can detect if there are any - # failed tests. - SET(TEST_TMP_DIR "${CTEST_BINARY_DIRECTORY}/Testing/Temporary") - FILE(GLOB logfiles "${TEST_TMP_DIR}/LastTestsFailed*.log") - FOREACH(logfile ${logfiles}) - FILE(REMOVE "${logfile}") - ENDFOREACH() - # Run the tests that match the ${TRIBITS_PACKAGE} name - MESSAGE("\nRunning test for package '${TRIBITS_PACKAGE}'" - " (parallel level ${CTEST_PARALLEL_LEVEL}) ...\n") - CTEST_TEST( - BUILD "${CTEST_BINARY_DIRECTORY}" - PARALLEL_LEVEL "${CTEST_PARALLEL_LEVEL}" - INCLUDE_LABEL "^${TRIBITS_PACKAGE}$" - #NUMBER_FAILED TEST_NUM_FAILED - ) - # See if a 'LastTestsFailed*.log' file exists to determine if there - # are failed tests - FILE(GLOB FAILED_TEST_LOG_FILE "${TEST_TMP_DIR}/LastTestsFailed*.log") - IF (FAILED_TEST_LOG_FILE) - MESSAGE("${TRIBITS_PACKAGE}: File '${FAILED_TEST_LOG_FILE}'" - " exists so there were failed tests!") - SET(BUILD_OR_TEST_FAILED TRUE) - ENDIF() - # 2009/12/05: ToDo: We need to add an argument to CTEST_TEST(...) - # called something like 'NUMBER_FAILED numFailedTests' to allow us - # to detect when the tests have filed. - #IF (TEST_NUM_FAILED GREATER 0) - # SET(BUILD_OR_TEST_FAILED TRUE) - #ENDIF() - IF (CTEST_DO_SUBMIT) - TRIBITS_CTEST_SUBMIT( PARTS Test ) - ENDIF() - ENDIF() - - IF (CTEST_DO_COVERAGE_TESTING) - MESSAGE("\nRunning coverage for package '${TRIBITS_PACKAGE}' ...\n") - CTEST_COVERAGE( - BUILD "${CTEST_BINARY_DIRECTORY}" - LABELS ${TRIBITS_PACKAGE} ${TRIBITS_PACKAGE}Libs ${TRIBITS_PACKAGE}Exes - ) - IF (CTEST_DO_SUBMIT) - TRIBITS_CTEST_SUBMIT( PARTS Coverage ) - ENDIF() - ENDIF() - - IF (CTEST_DO_MEMORY_TESTING) - MESSAGE("\nRunning memory testing for package '${TRIBITS_PACKAGE}' ...\n") - PRINT_VAR(CTEST_MEMORYCHECK_COMMAND) - PRINT_VAR(CTEST_MEMORYCHECK_COMMAND_OPTIONS) - PRINT_VAR(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE) - CTEST_MEMCHECK( - BUILD "${CTEST_BINARY_DIRECTORY}" - PARALLEL_LEVEL "${CTEST_PARALLEL_LEVEL}" - INCLUDE_LABEL "^${TRIBITS_PACKAGE}$") - IF (CTEST_DO_SUBMIT) - TRIBITS_CTEST_SUBMIT( PARTS MemCheck ) - ENDIF() - ENDIF() - - IF (BUILD_OR_TEST_FAILED) - LIST(APPEND ${PROJECT_NAME}_FAILED_PACKAGES ${TRIBITS_PACKAGE}) - ENDIF() - - ELSE() - - MESSAGE("FAILED library build for package '${TRIBITS_PACKAGE}'") - LIST(APPEND ${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES ${TRIBITS_PACKAGE}) - LIST(APPEND ${PROJECT_NAME}_FAILED_PACKAGES ${TRIBITS_PACKAGE}) - - ENDIF() + IF (${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) - ENDIF() + TRIBITS_CTEST_ALL_AT_ONCE() - IF (CTEST_DO_SUBMIT) - MESSAGE("\nSubmit the update file that will trigger the notification email ...\n") - TRIBITS_CTEST_SUBMIT( PARTS update ) - ENDIF() - - MATH(EXPR PACKAGE_IDX "${PACKAGE_IDX}+1") + ELSE() - ENDFOREACH(TRIBITS_PACKAGE) + TRIBITS_CTEST_PACKAGE_BY_PACKAGE() - IF(${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES) - MESSAGE( - "\nFinal set packages that failed to configure or have the libraries build:" - " '${${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES}'") ENDIF() IF(${PROJECT_NAME}_FAILED_PACKAGES) @@ -1286,8 +1085,6 @@ FUNCTION(TRIBITS_CTEST_DRIVER) # iteration since these packages must be enabled FILE(WRITE "${FAILED_PACKAGES_FILE_NAME}" "${${PROJECT_NAME}_FAILED_PACKAGES}\n") - MESSAGE("\nDone with the incremental building and testing of ${PROJECT_NAME} packages!\n") - REPORT_QUEUED_ERRORS() STRING(REPLACE "submit.php" diff --git a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake index f2c0dad46a6a..bc11f265e065 100644 --- a/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake +++ b/cmake/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake @@ -572,34 +572,49 @@ MACRO(ENABLE_ONLY_MODIFIED_PACKAGES) ENDIF() ENDFOREACH() - FOREACH(TRIBITS_PACKAGE ${FAILING_PACKAGES_LIST}) - IF ("${${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}}" STREQUAL "") - IF ( - ${TRIBITS_PACKAGE}_TESTGROUP STREQUAL "PT" - OR - ( - ${TRIBITS_PACKAGE}_TESTGROUP STREQUAL "ST" - AND - ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE - ) - ) - MESSAGE("Enabling previously failing package: ${TRIBITS_PACKAGE}") - SET(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} ON) + IF (FAILING_PACKAGES_LIST STREQUAL "ALL_PACKAGES") + MESSAGE("Enabling previously failing ALL_PACKAGES") + SET(${PROJECT_NAME}_ENABLE_ALL_PACKAGES ON) + ELSE() + FOREACH(TRIBITS_PACKAGE ${FAILING_PACKAGES_LIST}) + IF ("${${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}}" STREQUAL "") + IF ( + ${TRIBITS_PACKAGE}_TESTGROUP STREQUAL "PT" + OR + ( + ${TRIBITS_PACKAGE}_TESTGROUP STREQUAL "ST" + AND + ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE + ) + ) + MESSAGE("Enabling previously failing package: ${TRIBITS_PACKAGE}") + SET(${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE} ON) + ELSE() + MESSAGE("NOT enabling previously failing ST package: ${TRIBITS_PACKAGE}") + ENDIF() ELSE() - MESSAGE("NOT enabling previously failing ST package: ${TRIBITS_PACKAGE}") + MESSAGE("Not enabling explicitly disabled previously" + " failing package: ${TRIBITS_PACKAGE}") ENDIF() - ELSE() - MESSAGE("Not enabling explicitly disabled previously" - " failing package: ${TRIBITS_PACKAGE}") - ENDIF() - ENDFOREACH() + ENDFOREACH() + ENDIF() # # D) Print the final status # - TRIBITS_PRINT_ENABLED_SE_PACKAGE_LIST( - "\nDirectly modified or failing non-disabled packages that need to be tested" ON FALSE) + IF (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) + IF (NOT ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE) + MESSAGE(FATAL_ERROR + "Error, failing 'ALL_PACKAGES' only allowed with all-at-once mode!") + ENDIF() + MESSAGE("\nDirectly modified or failing non-disabled packages that need" + " to be tested: ALL_PACKAGES") + ELSE() + TRIBITS_PRINT_ENABLED_SE_PACKAGE_LIST( + "\nDirectly modified or failing non-disabled packages that need to be tested" + ON FALSE ) + ENDIF() ENDMACRO() @@ -624,9 +639,9 @@ ENDMACRO() # Remove packages that are only implicitly enabled but don't have tests # enabled. # -MACRO(SELECT_FINAL_SET_OF_PACKAGES_TO_PROCESS) +MACRO(SELECT_FINAL_SET_OF_PACKAGES_TO_DIRECTLY_TEST) - SET(${PROJECT_NAME}_PACKAGES_TO_PROCESS) + SET(${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST) FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES}) @@ -643,13 +658,11 @@ MACRO(SELECT_FINAL_SET_OF_PACKAGES_TO_PROCESS) ENDIF() IF(PROCESS_THE_PACKAGE) - APPEND_SET(${PROJECT_NAME}_PACKAGES_TO_PROCESS ${TRIBITS_PACKAGE}) + APPEND_SET(${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST ${TRIBITS_PACKAGE}) ENDIF() ENDFOREACH() - SET(${PROJECT_NAME}_PACKAGES ${${PROJECT_NAME}_PACKAGES_TO_PROCESS}) - ENDMACRO() @@ -803,3 +816,684 @@ MACRO(CTEST_UPDATE_WRAPPER) SET(UPDATE_RETURN_VAL ${CTEST_UPDATE_RETURN_VAL}) ENDIF() ENDMACRO() + + +# +# Helper macros to pass through common CMake configure arguments used by both +# package-by-pacakge approach and all-at-once approach +# + +MACRO(TRIBITS_FWD_CMAKE_CONFIG_ARGS_0) + SET( CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}" + "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}" + "-D${PROJECT_NAME}_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON" +"-D${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS:STRING=${${PROJECT_NAME}_WARNINGS_AS_ERRORS_FLAGS}" + "-D${PROJECT_NAME}_ALLOW_NO_PACKAGES:BOOL=ON" + "-D${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=${${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES}" + ) + IF (NOT CTEST_GENERATE_DEPS_XML_OUTPUT_FILE) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_DEPS_XML_OUTPUT_FILE:FILEPATH=") + ENDIF() + IF (NOT "${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}" STREQUAL "") + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE:BOOL=${${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE}") + ENDIF() + IF (NOT MPI_EXEC_MAX_NUMPROCS STREQUAL 0) + LIST(APPEND CONFIGURE_OPTIONS + "-DMPI_EXEC_MAX_NUMPROCS:STRING=${MPI_EXEC_MAX_NUMPROCS}") + ENDIF() + IF (CTEST_DO_COVERAGE_TESTING) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_COVERAGE_TESTING:BOOL=ON") + ENDIF() + IF (${PROJECT_NAME}_EXTRAREPOS_FILE STREQUAL "NONE") + SET(EXTRAREOS_FILE_PASSED "") + ELSE() + SET(EXTRAREOS_FILE_PASSED "${${PROJECT_NAME}_EXTRAREPOS_FILE}") + ENDIF() + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_EXTRAREPOS_FILE:STRING=${EXTRAREOS_FILE_PASSED}") + LIST(APPEND CONFIGURE_OPTIONS # See TRIBITS_SETUP_PACKAGES + "-D${PROJECT_NAME}_IGNORE_MISSING_EXTRA_REPOSITORIES:BOOL=ON") + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE:STRING=${${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE}") +ENDMACRO() + + +MACRO(TRIBITS_FWD_CMAKE_CONFIG_ARGS_1) + SET(CONFIGURE_OPTIONS ${CONFIGURE_OPTIONS} + ${EXTRA_SYSTEM_CONFIGURE_OPTIONS} ${EXTRA_CONFIGURE_OPTIONS}) +ENDMACRO() + + +# Remove the all of the LastTestsFailed*.log files so we can determine if any +# tests have failed. +MACRO(TRIBITS_REMOVE_LAST_TEST_FAILED_LOG_FILE) + # Remove the LastTestsFailed log so we can detect if there are any + # failed tests. + SET(TEST_TMP_DIR "${CTEST_BINARY_DIRECTORY}/Testing/Temporary") + SET(LAST_TESTS_FILED_LOG_FILE_GLOB "${TEST_TMP_DIR}/LastTestsFailed*.log") + FILE(GLOB logfiles "${LAST_TESTS_FILED_LOG_FILE_GLOB}") + FOREACH(logfile ${logfiles}) + FILE(REMOVE "${logfile}") + ENDFOREACH() +ENDMACRO() + + +# Sets the var FAILED_TEST_LOG_FILE if the file is found +MACRO(TRIBITS_FIND_LAST_TEST_FAILED_LOG_FILE) + FILE(GLOB FAILED_TEST_LOG_FILE "${LAST_TESTS_FILED_LOG_FILE_GLOB}") +ENDMACRO() + + +# Set mapping of labels to subprojects for CDash +MACRO(TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING) + IF (${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES) + FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST}) + CTEST_ADD_SUBPROJECT(${TRIBITS_PACKAGE} LABELS ${TRIBITS_PACKAGE}) + ENDFOREACH() + ENDIF() +ENDMACRO() + + +# Get names of failed packages from failed tests +FUNCTION(TRIBITS_GET_FAILED_PACKAGES_FROM_FAILED_TESTS + LAST_TESTS_FAILED_FILE FAILED_PACKAGES_OUT + ) + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} + "${${PROJECT_NAME}_TRIBITS_DIR}/ci_support/get-tribits-packages-from-last-tests-failed.py" + "--deps-xml-file=${CTEST_BINARY_DIRECTORY}/${${PROJECT_NAME}_PACKAGE_DEPS_XML_FILE_NAME}" + "--last-tests-failed-file=${LAST_TESTS_FAILED_FILE}" + OUTPUT_VARIABLE FAILED_PACKAGES + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + SET(${FAILED_PACKAGES_OUT} "${FAILED_PACKAGES}" PARENT_SCOPE) +ENDFUNCTION() + + +# +# Drive the configure, build, test, and submit package-by-package +# +# Sets ${PROJECT_NAME}_FAILED_PACKAGES as an indication if there are any +# failures. +# + +MACRO(TRIBITS_CTEST_PACKAGE_BY_PACKAGE) + + MESSAGE( + "\n***" + "\n*** Loop through ${PROJECT_NAME} packages to configure, build, and test ..." + "\n***") + + SET(${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE) + SET(${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES) + SET(PACKAGE_IDX 0) + + FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST}) + + MESSAGE("") + MESSAGE("${PACKAGE_IDX}) Processing current package ${TRIBITS_PACKAGE}:" + " libs='${${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}}'," + " tests='${${TRIBITS_PACKAGE}_ENABLE_TESTS}'") + MESSAGE("") + + SET_PROPERTY(GLOBAL PROPERTY SubProject ${TRIBITS_PACKAGE}) + SET_PROPERTY(GLOBAL PROPERTY Label ${TRIBITS_PACKAGE}) + + # + # A) Configure the package and its dependent packages + # + + MESSAGE("Configuring TRIBITS_PACKAGE='${TRIBITS_PACKAGE}'") + + # Create CONFIGURE_OPTIONS for this TRIBITS_PACKAGE + TRIBITS_FWD_CMAKE_CONFIG_ARGS_0() + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_TESTS:BOOL=${${TRIBITS_PACKAGE}_ENABLE_TESTS}") + IF (DEFINED ${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_${${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE}:BOOL=") + SET(${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE) + ENDIF() + FOREACH(FAILED_PACKAGE ${${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES}) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_${FAILED_PACKAGE}:BOOL=OFF") + ENDFOREACH() + TRIBITS_FWD_CMAKE_CONFIG_ARGS_1() + LIST(APPEND CONFIGURE_OPTIONS # Package enable must be at the very end to override other stuff! + "-D${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}:BOOL=ON" ) + MESSAGE("\nCONFIGURE_OPTIONS = '${CONFIGURE_OPTIONS}'") + + # Remember this package so we can set its enable to "" next time + SET(${PROJECT_NAME}_LAST_CONFIGURED_PACKAGE "${TRIBITS_PACKAGE}") + + # + # B) Configure the package and its dependent packages + # + + IF (NOT CTEST_DEPENDENCY_HANDLING_UNIT_TESTING) + + CTEST_CONFIGURE( + BUILD "${CTEST_BINARY_DIRECTORY}" + OPTIONS "${CONFIGURE_OPTIONS}" # New option! + RETURN_VALUE CONFIGURE_RETURN_VAL + ) + + MESSAGE("Generating the file '${CMAKE_CACHE_CLEAN_FILE}' ...") + TRIBITS_STRIP_COMMENTS_FROM_CMAKE_CACHE_FILE( + "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" + "${CMAKE_CACHE_CLEAN_FILE}" + ) + + # If the configure failed, add the package to the list + # of failed packages + IF (NOT "${CONFIGURE_RETURN_VAL}" EQUAL "0") + MESSAGE("${TRIBITS_PACKAGE} FAILED to configure") + LIST(APPEND ${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES ${TRIBITS_PACKAGE}) + LIST(APPEND ${PROJECT_NAME}_FAILED_PACKAGES ${TRIBITS_PACKAGE}) + ELSE() + MESSAGE("${TRIBITS_PACKAGE}: Configure passed!") + # load target properties and test keywords + CTEST_READ_CUSTOM_FILES(BUILD "${CTEST_BINARY_DIRECTORY}") + # Overridde from this file! + INCLUDE("${TRIBITS_PROJECT_ROOT}/CTestConfig.cmake") + ENDIF() + + IF (EXISTS ${CMAKE_CACHE_CLEAN_FILE}) + SET(CTEST_NOTES_FILES "${CTEST_NOTES_FILES_WO_CACHE};${CMAKE_CACHE_CLEAN_FILE}") + ELSE() + SET(CTEST_NOTES_FILES "${CTEST_NOTES_FILES_WO_CACHE}") + ENDIF() + + SET(REPO_VERSION_FILE "${CTEST_BINARY_DIRECTORY}/${PROJECT_NAME}RepoVersion.txt") + IF (EXISTS "${REPO_VERSION_FILE}") + SET(CTEST_NOTES_FILES "${REPO_VERSION_FILE};${CTEST_NOTES_FILES}") + ENDIF() + + PRINT_VAR(CTEST_NOTES_FILES) + + # Submit configure results and the notes to the dashboard + IF (CTEST_DO_SUBMIT) + MESSAGE("\nSubmitting configure and notes ...") + TRIBITS_CTEST_SUBMIT( PARTS configure notes ) + ENDIF() + + ENDIF() + + # + # C) If configure passed then try the build. Otherwise, move on to + # to the next package. + # + + IF ("${CONFIGURE_RETURN_VAL}" EQUAL "0" AND + NOT CTEST_DEPENDENCY_HANDLING_UNIT_TESTING AND + NOT CTEST_CONFIGURATION_UNIT_TESTING + ) + + # Start by trying to build just the libraries for the current package + + SET( CTEST_BUILD_TARGET ${TRIBITS_PACKAGE}_libs ) + MESSAGE("\nBuilding target: '${CTEST_BUILD_TARGET}' ...\n") + CTEST_BUILD( + BUILD "${CTEST_BINARY_DIRECTORY}" + RETURN_VALUE BUILD_LIBS_RETURN_VAL + NUMBER_ERRORS BUILD_LIBS_NUM_ERRORS + APPEND + ) + MESSAGE("Build return: RETURN_VALUE=${BUILD_LIBS_RETURN_VAL}," + " NUMBER_ERRORS=${BUILD_LIBS_NUM_ERRORS}") + + # Determine if the build failed or not. + + SET(BUILD_LIBS_SUCCESS FALSE) + IF ("${BUILD_LIBS_NUM_ERRORS}" EQUAL "0") + MESSAGE("${TRIBITS_PACKAGE}: Libs build passed!") + SET(BUILD_LIBS_SUCCESS TRUE) + ENDIF() + # Above: Since make -i is used BUILD_LIBS_RETURN_VAL might be 0, but + # if there are errors the build should fail, so both + # BUILD_LIBS_RETURN_VAL and BUILD_LIBS_NUM_ERRORS should be 0 for a + # good build and for the all target to be built. + + # Submit the library build results to the dashboard + + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS build ) + ENDIF() + + # If the build of the libraries passed, then go on the build + # the tests/examples and run them. + + IF (BUILD_LIBS_SUCCESS) + + SET(BUILD_OR_TEST_FAILED FALSE) + + # Build the ALL target, but append the results to the last build.xml + SET(CTEST_BUILD_TARGET) + MESSAGE("\nBuild ALL target for '${TRIBITS_PACKAGE}' ...\n") + CTEST_BUILD( + BUILD "${CTEST_BINARY_DIRECTORY}" + RETURN_VALUE BUILD_ALL_RETURN_VAL + NUMBER_ERRORS BUILD_ALL_NUM_ERRORS + APPEND + ) + MESSAGE("Build all: BUILD_ALL_NUM_ERRORS='${BUILD_ALL_NUM_ERRORS}'," + "BUILD_ALL_RETURN_VAL='${BUILD_ALL_RETURN_VAL}'" ) + + IF (NOT "${BUILD_ALL_NUM_ERRORS}" EQUAL "0") + MESSAGE("${TRIBITS_PACKAGE}: All build FAILED!") + SET(BUILD_OR_TEST_FAILED TRUE) + ELSE() + MESSAGE("${TRIBITS_PACKAGE}: All build passed!") + ENDIF() + + # Submit the build for all target + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS build ) + ENDIF() + + IF (CTEST_DO_TEST) + + TRIBITS_REMOVE_LAST_TEST_FAILED_LOG_FILE() + # Run the tests that match the ${TRIBITS_PACKAGE} name + MESSAGE("\nRunning test for package '${TRIBITS_PACKAGE}'" + " (parallel level ${CTEST_PARALLEL_LEVEL}) ...\n") + CTEST_TEST( + BUILD "${CTEST_BINARY_DIRECTORY}" + PARALLEL_LEVEL "${CTEST_PARALLEL_LEVEL}" + INCLUDE_LABEL "^${TRIBITS_PACKAGE}$" + #NUMBER_FAILED TEST_NUM_FAILED + ) + # See if a 'LastTestsFailed*.log' file exists to determine if there + # are failed tests + TRIBITS_FIND_LAST_TEST_FAILED_LOG_FILE() + IF (FAILED_TEST_LOG_FILE) + MESSAGE("${TRIBITS_PACKAGE}: File '${FAILED_TEST_LOG_FILE}'" + " exists so there were failed tests!") + SET(BUILD_OR_TEST_FAILED TRUE) + ENDIF() + # 2009/12/05: ToDo: We need to add an argument to CTEST_TEST(...) + # called something like 'NUMBER_FAILED numFailedTests' to allow us + # to detect when the tests have filed. + #IF (TEST_NUM_FAILED GREATER 0) + # SET(BUILD_OR_TEST_FAILED TRUE) + #ENDIF() + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS Test ) + ENDIF() + ENDIF() + + IF (CTEST_DO_COVERAGE_TESTING) + MESSAGE("\nRunning coverage for package '${TRIBITS_PACKAGE}' ...\n") + CTEST_COVERAGE( + BUILD "${CTEST_BINARY_DIRECTORY}" + LABELS ${TRIBITS_PACKAGE} ${TRIBITS_PACKAGE}Libs ${TRIBITS_PACKAGE}Exes + ) + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS Coverage ) + ENDIF() + ENDIF() + + IF (CTEST_DO_MEMORY_TESTING) + MESSAGE("\nRunning memory testing for package '${TRIBITS_PACKAGE}' ...\n") + PRINT_VAR(CTEST_MEMORYCHECK_COMMAND) + PRINT_VAR(CTEST_MEMORYCHECK_COMMAND_OPTIONS) + PRINT_VAR(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE) + CTEST_MEMCHECK( + BUILD "${CTEST_BINARY_DIRECTORY}" + PARALLEL_LEVEL "${CTEST_PARALLEL_LEVEL}" + INCLUDE_LABEL "^${TRIBITS_PACKAGE}$") + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS MemCheck ) + ENDIF() + ENDIF() + + IF (BUILD_OR_TEST_FAILED) + LIST(APPEND ${PROJECT_NAME}_FAILED_PACKAGES ${TRIBITS_PACKAGE}) + ENDIF() + + ELSE() + + MESSAGE("FAILED library build for package '${TRIBITS_PACKAGE}'") + LIST(APPEND ${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES ${TRIBITS_PACKAGE}) + LIST(APPEND ${PROJECT_NAME}_FAILED_PACKAGES ${TRIBITS_PACKAGE}) + + ENDIF() + + ENDIF() + + IF (CTEST_DO_SUBMIT) + MESSAGE("\nSubmit the update file that will trigger the notification email ...\n") + TRIBITS_CTEST_SUBMIT( PARTS update ) + ENDIF() + + MATH(EXPR PACKAGE_IDX "${PACKAGE_IDX}+1") + + ENDFOREACH(TRIBITS_PACKAGE) + + IF(${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES) + MESSAGE( + "\nFinal set packages that failed to configure or have the libraries build:" + " '${${PROJECT_NAME}_FAILED_LIB_BUILD_PACKAGES}'") + ENDIF() + + MESSAGE("\nDone with the incremental building and testing of ${PROJECT_NAME} packages!\n") + +ENDMACRO() + + +# +# Drive the configure, build, test, and submit all at once for all of the +# enabled packages. +# +# Sets ${PROJECT_NAME}_FAILED_PACKAGES as an indication if there are any +# failures. +# + +MACRO(TRIBITS_CTEST_ALL_AT_ONCE) + + MESSAGE( + "\n***" + "\n*** Configure, build, test and submit results all-at-once for all enabled packages ..." + "\n***") + + # + # A) Set up mapping of labels to subprojects and gather configure arguments + # + + TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING() + + MESSAGE("") + MESSAGE("Configuring ...") + MESSAGE("") + + # Create CONFIGURE_OPTIONS + TRIBITS_FWD_CMAKE_CONFIG_ARGS_0() + IF (${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES:BOOL=TRUE" ) + ENDIF() + IF (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_ALL_PACKAGES=ON" + ) + ELSE() + FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST}) + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_${TRIBITS_PACKAGE}=ON" + ) + ENDFOREACH() + ENDIF() + LIST(APPEND CONFIGURE_OPTIONS + "-D${PROJECT_NAME}_ENABLE_TESTS:BOOL=ON") + TRIBITS_FWD_CMAKE_CONFIG_ARGS_1() + MESSAGE("\nCONFIGURE_OPTIONS = '${CONFIGURE_OPTIONS}'") + + # + # B) Configure the package and its dependent packages + # + + IF (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING) + + MESSAGE("Skipping actual ctest_configure() because" + " CTEST_DEPENDENCY_HANDLING_UNIT_TESTING='${CTEST_DEPENDENCY_HANDLING_UNIT_TESTING}'!" + ) + SET(AAO_CONFIGURE_PASSED TRUE) + + ELSE() + + CTEST_CONFIGURE( + BUILD "${CTEST_BINARY_DIRECTORY}" + OPTIONS "${CONFIGURE_OPTIONS}" # New option! + RETURN_VALUE CONFIGURE_RETURN_VAL + ) + + MESSAGE("Generating the file '${CMAKE_CACHE_CLEAN_FILE}' ...") + TRIBITS_STRIP_COMMENTS_FROM_CMAKE_CACHE_FILE( + "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" + "${CMAKE_CACHE_CLEAN_FILE}" + ) + + IF (NOT "${CONFIGURE_RETURN_VAL}" EQUAL "0") + MESSAGE("Configure FAILED!") + SET(AAO_CONFIGURE_PASSED FALSE) + ELSE() + MESSAGE("Configure PASSED!") + SET(AAO_CONFIGURE_PASSED TRUE) + # Load target properties and test keywords + CTEST_READ_CUSTOM_FILES(BUILD "${CTEST_BINARY_DIRECTORY}") + # Overridde from this file! + INCLUDE("${TRIBITS_PROJECT_ROOT}/CTestConfig.cmake") + ENDIF() + + SET(CTEST_NOTES_FILES "${CTEST_NOTES_FILES_WO_CACHE}") + + IF (EXISTS ${CMAKE_CACHE_CLEAN_FILE}) + LIST(APPEND CTEST_NOTES_FILES "${CMAKE_CACHE_CLEAN_FILE}") + ENDIF() + + SET(REPO_VERSION_FILE "${CTEST_BINARY_DIRECTORY}/${PROJECT_NAME}RepoVersion.txt") + IF (EXISTS "${REPO_VERSION_FILE}") + LIST(APPEND CTEST_NOTES_FILES "${REPO_VERSION_FILE}") + ENDIF() + + PRINT_VAR(CTEST_NOTES_FILES) + + # Submit configure results and the notes to the dashboard + IF (CTEST_DO_SUBMIT) + MESSAGE("\nSubmitting configure and notes ...") + TRIBITS_CTEST_SUBMIT( PARTS configure notes ) + ENDIF() + + ENDIF() + + # + # C) Do the build + # + + IF (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING AND AAO_CONFIGURE_PASSED) + + MESSAGE("Skipping build because" + " CTEST_DEPENDENCY_HANDLING_UNIT_TESTING='${CTEST_DEPENDENCY_HANDLING_UNIT_TESTING}'!" + ) + + ELSEIF (AAO_CONFIGURE_PASSED) + + MESSAGE("") + MESSAGE("Building all targets ...") + MESSAGE("") + + CTEST_BUILD( + BUILD "${CTEST_BINARY_DIRECTORY}" + RETURN_VALUE BUILD_ALL_RETURN_VAL + NUMBER_ERRORS BUILD_ALL_NUM_ERRORS + ) + MESSAGE("Build output: BUILD_ALL_NUM_ERRORS='${BUILD_ALL_NUM_ERRORS}'," + "BUILD_ALL_RETURN_VAL='${BUILD_ALL_RETURN_VAL}'" ) + + IF (NOT "${BUILD_ALL_NUM_ERRORS}" EQUAL "0") + MESSAGE("Build FAILED!") + ELSE() + MESSAGE("Build PASSED!") + ENDIF() + + # Submit the build for all target + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS build ) + ENDIF() + + ELSE() + + MESSAGE("") + MESSAGE("Skipping build because configure failed!") + MESSAGE("") + + ENDIF() + + # + # D) Run tests + # + + IF (NOT CTEST_DO_TEST) + + MESSAGE("") + MESSAGE("Skipping tests because CTEST_DO_TEST='${CTEST_DO_TEST}'!") + MESSAGE("") + + ELSEIF (NOT AAO_CONFIGURE_PASSED) + + MESSAGE("") + MESSAGE("Skipping tests because configure failed!") + MESSAGE("") + + ELSEIF (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING AND AAO_CONFIGURE_PASSED) + + MESSAGE("Skipping testing because" + " CTEST_DEPENDENCY_HANDLING_UNIT_TESTING='${CTEST_DEPENDENCY_HANDLING_UNIT_TESTING}'!" + ) + + ELSE() + + # NOTE: We always run the tests if the configure passed no matter if there + # are build failures because the only way that we can detect what packages + # have build failures is to see what packages have test failures. + + TRIBITS_REMOVE_LAST_TEST_FAILED_LOG_FILE() + + # Run the tests + MESSAGE("") + MESSAGE("\nRunning tests (parallel level ${CTEST_PARALLEL_LEVEL}) ...\n") + MESSAGE("") + + CTEST_TEST( + BUILD "${CTEST_BINARY_DIRECTORY}" + PARALLEL_LEVEL "${CTEST_PARALLEL_LEVEL}" + ) + + # See if a 'LastTestsFailed*.log' file exists to determine if there are + # failed tests. + TRIBITS_FIND_LAST_TEST_FAILED_LOG_FILE() + IF (FAILED_TEST_LOG_FILE) + MESSAGE("File '${FAILED_TEST_LOG_FILE}' exists so there were non-passing tests!") + SET(BUILD_OR_TEST_FAILED TRUE) + ELSE() + MESSAGE("File '${FAILED_TEST_LOG_FILE}' does NOT exist so all tests passed!") + ENDIF() + + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS Test ) + ENDIF() + + ENDIF() + + # + # E) Gather coverage results + # + + IF (NOT CTEST_DO_COVERAGE_TESTING) + + MESSAGE("") + MESSAGE("Skipping converage tests because CTEST_DO_COVERAGE_TESTING='${CTEST_DO_COVERAGE_TESTING}'!") + MESSAGE("") + + ELSEIF (NOT AAO_CONFIGURE_PASSED) + + MESSAGE("") + MESSAGE("Skipping coverage tests because configure failed!") + MESSAGE("") + + ELSEIF (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING AND AAO_CONFIGURE_PASSED) + + MESSAGE("Skipping coverage testing because" + " CTEST_DEPENDENCY_HANDLING_UNIT_TESTING='${CTEST_DEPENDENCY_HANDLING_UNIT_TESTING}'!" + ) + + ELSE() + + # NOTE: We always gather the coverage results if the configure passed + # independent if there was any build or test failures. The coverage stats + # may not be very valid if there are build or test failures but there is + # no harm and showing the coverage based on tests that actually run (even + # if they fail). + + MESSAGE("\nGathering coverage results ...\n") + CTEST_COVERAGE( + BUILD "${CTEST_BINARY_DIRECTORY}" + ) + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS Coverage ) + ENDIF() + + ENDIF() + + # + # F) Do memory testing + # + + IF (NOT CTEST_DO_MEMORY_TESTING) + + MESSAGE("") + MESSAGE("Skipping memory testing because CTEST_DO_MEMORY_TESTING='${CTEST_DO_MEMORY_TESTING}'!") + MESSAGE("") + + ELSEIF (NOT AAO_CONFIGURE_PASSED) + + MESSAGE("") + MESSAGE("Skipping memory tests because configure failed!") + MESSAGE("") + + ELSEIF (CTEST_DEPENDENCY_HANDLING_UNIT_TESTING AND AAO_CONFIGURE_PASSED) + + MESSAGE("Skipping memory testing because" + " CTEST_DEPENDENCY_HANDLING_UNIT_TESTING='${CTEST_DEPENDENCY_HANDLING_UNIT_TESTING}'!" + ) + + ELSE() + + # NOTE: We always gather the memory results if the configure passed + # independent if there was any build or test failures. The memory stats + # may not be very valid if there are build or test failures but there is + # no harm and showing the memory based on tests that actually run (even + # if they fail). + + MESSAGE("\nRunning memory tests ...\n") + PRINT_VAR(CTEST_MEMORYCHECK_COMMAND) + PRINT_VAR(CTEST_MEMORYCHECK_COMMAND_OPTIONS) + PRINT_VAR(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE) + CTEST_MEMCHECK( + BUILD "${CTEST_BINARY_DIRECTORY}" + ) + IF (CTEST_DO_SUBMIT) + TRIBITS_CTEST_SUBMIT( PARTS MemCheck ) + ENDIF() + + ENDIF() + + # + # G) Determine final pass/fail by gathering list of failing packages + # + + IF (NOT AAO_CONFIGURE_PASSED) + IF (${PROJECT_NAME}_ENABLE_ALL_PACKAGES) + # Special value "ALL_PACAKGES" so that it will trigger enabling all + # packages on the next CI iteration! + SET(${PROJECT_NAME}_FAILED_PACKAGES ALL_PACKAGES) + ELSE() + # Specific packages were selected to be tested so fail all of them! + SET(${PROJECT_NAME}_FAILED_PACKAGES ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST}) + ENDIF() + ELSEIF (FAILED_TEST_LOG_FILE) + TRIBITS_GET_FAILED_PACKAGES_FROM_FAILED_TESTS("${FAILED_TEST_LOG_FILE}" + ${PROJECT_NAME}_FAILED_PACKAGES ) + ELSE() + # If no tests failed, then there are no failed packages! + SET(${PROJECT_NAME}_FAILED_PACKAGES) + ENDIF() + # ToDo: Optionally determine pass/fail based + + MESSAGE("\nDone with the all-at-once configure, build, test, ans submit of ${PROJECT_NAME} packages!\n") + +ENDMACRO() diff --git a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst index a8258fb238d7..962bfa33efed 100644 --- a/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst +++ b/cmake/tribits/doc/build_ref/TribitsBuildReferenceBody.rst @@ -6,6 +6,8 @@ .. _TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(): https://tribits.org/doc/TribitsDevelopersGuide.html#tribits-tpl-find-include-dirs-and-libraries +.. _TRIBITS_CTEST_DRIVER(): https://tribits.org/doc/TribitsDevelopersGuide.html#tribits-ctest-driver + Getting set up to use CMake =========================== @@ -2742,10 +2744,11 @@ release mode, i.e. ``_ENABLE_DEVELOPMENT_MODE==OFF``.) Dashboard submissions ===================== -You can use the TriBITS scripting code to submit package-by-package build, -test, coverage, memcheck results to the project's CDash dashboard. +All TriBITS projects have built-in support for submitting configure, build, +and test results to CDash using the custom ``dashbaord`` target. -First, configure as normal but add the build and test parallel levels with:: +First, configure as normal but add cache vars for the the build and test +parallel levels with:: -DCTEST_BUILD_FLAGS=-j4 -DCTEST_PARALLEL_LEVEL=4 @@ -2755,83 +2758,34 @@ with:: $ make dashboard This invokes the advanced TriBITS CTest scripts to do an experimental build -for all of the packages that you have explicitly enabled. The packages that -are implicitly enabled due to package dependencies are not directly processed -by the experimental_build_test.cmake script. - -There are a number of options that you can set in the environment to control -what this script does. This set of options can be found by doing:: - - $ grep 'SET_DEFAULT_AND_FROM_ENV(' \ - $TRIBITS_DIR/ctest_driver/TribitsCTestDriverCore.cmake - -Currently, the variables can be set include:: - - SET_DEFAULT_AND_FROM_ENV(_IGNORE_MISSING_EXTRA_REPOSITORIES ...) - SET_DEFAULT_AND_FROM_ENV(_PRE_REPOSITORIES ...) - SET_DEFAULT_AND_FROM_ENV(_EXTRA_REPOSITORIES ...) - SET_DEFAULT_AND_FROM_ENV(CTEST_SOURCE_NAME ) - SET_DEFAULT_AND_FROM_ENV(CTEST_CONFIGURATION_UNIT_TESTING OFF) - SET_DEFAULT_AND_FROM_ENV(CTEST_TEST_TYPE Experimental) - SET_DEFAULT_AND_FROM_ENV(_TRACK "${_TRACK_DEFAULT}") - SET_DEFAULT_AND_FROM_ENV(CTEST_SITE ${CTEST_SITE_DEFAULT}) - SET_DEFAULT_AND_FROM_ENV(CTEST_DASHBOARD_ROOT "") - SET_DEFAULT_AND_FROM_ENV(BUILD_TYPE NONE) - SET_DEFAULT_AND_FROM_ENV(_VERBOSE_CONFIGURE OFF) - SET_DEFAULT_AND_FROM_ENV(COMPILER_VERSION UNKNOWN) - SET_DEFAULT_AND_FROM_ENV(CTEST_BUILD_NAME - SET_DEFAULT_AND_FROM_ENV(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) - SET_DEFAULT_AND_FROM_ENV(CTEST_WIPE_CACHE TRUE) - SET_DEFAULT_AND_FROM_ENV(CTEST_CMAKE_GENERATOR ${DEFAULT_GENERATOR}) - SET_DEFAULT_AND_FROM_ENV(CTEST_DO_UPDATES TRUE) - SET_DEFAULT_AND_FROM_ENV(CTEST_GENERATE_DEPS_XML_OUTPUT_FILE FALSE) - SET_DEFAULT_AND_FROM_ENV(CTEST_UPDATE_ARGS "") - SET_DEFAULT_AND_FROM_ENV(CTEST_UPDATE_OPTIONS "") - SET_DEFAULT_AND_FROM_ENV(CTEST_BUILD_FLAGS "-j2") - SET_DEFAULT_AND_FROM_ENV(CTEST_BUILD_FLAGS "") - SET_DEFAULT_AND_FROM_ENV(CTEST_DO_BUILD TRUE) - SET_DEFAULT_AND_FROM_ENV(CTEST_DO_TEST TRUE) - SET_DEFAULT_AND_FROM_ENV(MPI_EXEC_MAX_NUMPROCS 0) - SET_DEFAULT_AND_FROM_ENV(CTEST_PARALLEL_LEVEL 1) - SET_DEFAULT_AND_FROM_ENV(_WARNINGS_AS_ERRORS_FLAGS "") - SET_DEFAULT_AND_FROM_ENV(CTEST_DO_COVERAGE_TESTING FALSE) - SET_DEFAULT_AND_FROM_ENV(CTEST_COVERAGE_COMMAND gcov) - SET_DEFAULT_AND_FROM_ENV(CTEST_DO_MEMORY_TESTING FALSE) - SET_DEFAULT_AND_FROM_ENV(CTEST_MEMORYCHECK_COMMAND - "${CTEST_MEMORYCHECK_COMMAND_DEFAULT}") - SET_DEFAULT_AND_FROM_ENV(CTEST_MEMORYCHECK_COMMAND_OPTIONS "") - SET_DEFAULT_AND_FROM_ENV(CTEST_GENERATE_OUTER_DEPS_XML_OUTPUT_FILE TRUE) - SET_DEFAULT_AND_FROM_ENV(CTEST_SUBMIT_CDASH_SUBPROJECTS_DEPS_FILE TRUE) - SET_DEFAULT_AND_FROM_ENV(CTEST_DO_SUBMIT TRUE) - SET_DEFAULT_AND_FROM_ENV(_ENABLE_SECONDARY_TESTED_CODE OFF) - SET_DEFAULT_AND_FROM_ENV(_ENABLE_SECONDARY_STABLE_CODE OFF) - SET_DEFAULT_AND_FROM_ENV(_ADDITIONAL_PACKAGES "") - SET_DEFAULT_AND_FROM_ENV(_EXCLUDE_PACKAGES "") - SET_DEFAULT_AND_FROM_ENV(_BRANCH "${_BRANCH_DEFAULT}") - SET_DEFAULT_AND_FROM_ENV(_ENABLE_DEVELOPMENT_MODE - "${_ENABLE_DEVELOPMENT_MODE_DEFAULT}") - SET_DEFAULT_AND_FROM_ENV(_REPOSITORY_LOCATION ...) - SET_DEFAULT_AND_FROM_ENV(_PACKAGES "") - SET_DEFAULT_AND_FROM_ENV(_EXTRAREPOS_FILE ...) - SET_DEFAULT_AND_FROM_ENV(_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE ...) - SET_DEFAULT_AND_FROM_ENV(CTEST_ENABLE_MODIFIED_PACKAGES_ONLY OFF) - SET_DEFAULT_AND_FROM_ENV(CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES ...) - SET_DEFAULT_AND_FROM_ENV(_DISABLE_ENABLED_FORWARD_DEP_PACKAGES ...) - SET_DEFAULT_AND_FROM_ENV(TRIBITS_2ND_CTEST_DROP_SITE "") - SET_DEFAULT_AND_FROM_ENV(TRIBITS_2ND_CTEST_DROP_LOCATION "") - SET_DEFAULT_AND_FROM_ENV(CTEST_DEPENDENCY_HANDLING_UNIT_TESTING FALSE) - SET_DEFAULT_AND_FROM_ENV(CTEST_UPDATE_RETURN_VAL 0) - SET_DEFAULT_AND_FROM_ENV(_SOURCE_DIRECTORY ${CTEST_SOURCE_DIRECTORY}) - SET_DEFAULT_AND_FROM_ENV(CTEST_DROP_SITE_COVERAGE ...) - SET_DEFAULT_AND_FROM_ENV(CTEST_DROP_LOCATION_COVERAGE ...) - -For details on what all of these options do, look at the file -``TribitsCTestDriverCore.cmake`` (more detailed documentation will come in -time). The value of all of these variables is printed out when the ``make -dashboard`` target is run. From there, one can change and tweak these -options. To see the defaults, just run with ``CTEST_DO_SUBMIT=FALSE`` and one -can see the values used without actually doing the submit. Just grep for the -names of the variables in the STDOUT for ``make dashboard``. +for all of the packages that you have explicitly enabled. (The packages that +are implicitly enabled due to package dependencies are not directly +processed.) + +NOTE: This generates a lot of output, so it is tyically better to pipe this to +a file with:: + + $ make dashboard &> make.dashboard.out + +and then watch that file in another terminal with:: + + $ tail -f make.dashboard.out + +There are a number of options that you can set in the cache and/or in the +environment to control what this script does. For the full set of options, +see `TRIBITS_CTEST_DRIVER()`_. More detains can be found by examining the +file:: + + core/ctest_driver/TribitsCTestDriverCore.cmake + +under the TriBITS version being used. To see the full list of options, and +their default values, one can run with:: + + $ env CTEST_DO_SUBMIT=FALSE CTEST_DEPENDENCY_HANDLING_UNIT_TESTING=TRUE \ + make dashboard + +This will print the options with their default values and then do a sort of +mock running of the CTest driver script and point out what is is doing. For an example of variables one might want to tweak, to run an experimental build and in the process change the build, use:: @@ -2845,26 +2799,34 @@ printed at the end of STDOUT). It is useful to set ``CTEST_BUILD_NAME`` to some unique name to make it easier to find your results in the CDash dashboard. -A number of the defaults set in ``TribitsCTestDriverCore.cmake`` are -overridden from ``experimental_build_test.cmake`` (such as -``CTEST_TEST_TYPE=Experimental``) so you will want to look at -``experimental_build_test.cmake`` to see how these are changed. The script -``experimental_build_test.cmake`` sets reasonable values for these options in -order to use the `make dashboard` target in iterative development for -experimental builds. +Note that the ``dashboard`` target is not directly related to the built-in +CMake ``Experimental*`` targets that run standard dashboards with CTest +without the custom TriBItS CTest driver. The CTest driver run with the +``dashboard`` target is more appropriate for the TriBITS-based project + and provides more control over what gets tested and submitted. + +The configure, builds, and submits are either done package-by-package or +all-at-once as controlled by the varaible ``_CTEST_DO_ALL_AT_ONCE``. +This can be set in the CMake cache when configuring the project using:: + + -D_CTEST_DO_ALL_AT_ONCE=TRUE + +or when running the ``dashboard`` target with:: + + $ env _CTEST_DO_ALL_AT_ONCE=TRUE make dashbaord. -The target ``dashboard`` is not directly related to the built-in CMake targets -'Experimental*' that run standard dashboards with CTest without the custom -package-by-package driver in ``TribitsCTestDriverCore.cmake``. The -package-by-package extended CTest driver is more appropriate for the -TriBITS-based project . +Using the ``dashboard`` target, one can also run coverage and memory testing +and submit to CDash as described below. Once you configure with ``-D_ENABLE_COVERAGE_TESTING=ON``, the environment variable ``CTEST_DO_COVERAGE_TESTING=TRUE`` is automatically set -by the target 'dashboard' so you don't have to set this yourself. +by the target ``dashboard`` so you don't have to set this yourself. Then when +you run the ``dashboard`` target, it will automatically submit converage +results to CDash as well. Doing a memory check with Valgrind requires that you set -``CTEST_DO_MEMORY_TESTING=TRUE`` with the 'env' command as:: +``CTEST_DO_MEMORY_TESTING=TRUE`` with the 'env' command when running the +``dashboard`` target as:: $ env CTEST_DO_MEMORY_TESTING=TRUE make dashboard @@ -2880,10 +2842,10 @@ with:: make dashboard The CMake cache variable ``_DASHBOARD_CTEST_ARGS`` can be set on the -cmake configure line in order to pass additional arguments to 'ctest -S' when -invoking the package-by-package CTest driver. For example:: +cmake configure line in order to pass additional arguments to ``ctest -S`` +when invoking the package-by-package CTest driver. For example:: - -D _DASHBOARD_CTEST_ARGS="-VV" + -D_DASHBOARD_CTEST_ARGS="-VV" will set verbose output with CTest. @@ -2913,12 +2875,14 @@ and ``TRIBITS_2ND_CTEST_DROP_SITE`` would be used for ``CTEST_DROP_SITE``. This is a common use case when upgrading to a new CDash installation or testing new features for CDash before impacting the existing CDash site. -Note that if one kills the ``make dashboard`` target before it completes, then -one must reconfigure from scratch in order to get the build directory back -into the same state before the command was run. This is because the -``dashboard`` target must first reconfigure the project with no enabled +Finally, note in package-by-package mode +(i.e. ``_CTEST_DO_ALL_AT_ONCE=FALSE``) that if one kills the ``make +dashboard`` target before it completes, then one must reconfigure from scratch +in order to get the build directory back into the same state before the +command was run. This is because the ``dashboard`` target in +package-by-package mode must first reconfigure the project with no enabled packages before it does the package-by-package configure/build/test/submit which enables each package one at a time. After the package-by-package configure/build/test/submit cycles are complete, then the project is -reconfigured with the original set of package enables and returning to the +reconfigured with the original set of package enables and returned to the original configure state. diff --git a/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst b/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst index 7ceed93541b1..f3dcf07961b6 100644 --- a/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst +++ b/cmake/tribits/doc/developers_guide/TribitsDevelopersGuide.rst @@ -7726,6 +7726,7 @@ a given TriBITS project are: * `${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND`_ * `${PROJECT_NAME}_CPACK_SOURCE_GENERATOR`_ +* `${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE`_ * `${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES`_ * `${PROJECT_NAME}_ELEVATE_ST_TO_PT`_ * `${PROJECT_NAME}_ENABLE_CPACK_PACKAGING`_ @@ -7795,6 +7796,24 @@ These options are described below. instead of in the base-level ``CMakeLists.txt`` file so that it goes along with rest of the project-specific CPack packaging options. +.. _${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE: + +**${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE** + + The variable ``${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE`` determines if the + CTest driver scripts using `TRIBITS_CTEST_DRIVER()`_ configure, build, test + and submit results to CDash all-at-once for all of the packages being tested + or if instead is done package-by-package. Currently, the default is set to + ``FALSE`` for the package-by-package mode (for historical reasons) but the + default can be set to ``TRUE`` by setting: + + SET(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT "TRUE") + + in the project's `/ProjectName.cmake`_ file. (This default must + be changed in the ``/ProjectName.cmake`` file and **NOT** the + `/CMakeLists.txt`_ file because the latter is not directly + processed in CTest -S driver scripts using ``TRIBITS_CTEST_DRIVER()``.) + .. _${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES: **${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES** diff --git a/cmake/tribits/examples/TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake b/cmake/tribits/examples/TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake index d1cae33293aa..44d474fecf9c 100644 --- a/cmake/tribits/examples/TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake +++ b/cmake/tribits/examples/TribitsExampleProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake @@ -11,8 +11,8 @@ SET( EXTRA_CONFIGURE_OPTIONS "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_Fortran_COMPILER=gfortran" - "-DTriBITS_ENABLE_Fortran=ON" - "-DTriBITS_TRACE_ADD_TEST=ON" + "-DTribitsExProj_ENABLE_Fortran=ON" + "-DTribitsExProj_TRACE_ADD_TEST=ON" ) SET(CTEST_TEST_TYPE Continuous)