From 5e1677e7676af2578117756473b7dcac4999087f Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 14 Feb 2019 18:23:30 -0700 Subject: [PATCH 1/5] Add generic ctest -S driver to submit to CDash This allows cloning the TriBITS repo and submitting to CDash. --- cmake/ctest/TribitsProjCTestDriver.cmake | 25 +++++++++++++++ .../ctest_genertic_gcc_serial_debug.cmake | 31 +++++++++++++++++++ .../travisci/ctest_trusty_serial_debug.cmake | 15 ++------- .../ctest_driver/TribitsCTestDriverCore.cmake | 2 +- 4 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 cmake/ctest/TribitsProjCTestDriver.cmake create mode 100644 cmake/ctest/generic_gcc/ctest_genertic_gcc_serial_debug.cmake diff --git a/cmake/ctest/TribitsProjCTestDriver.cmake b/cmake/ctest/TribitsProjCTestDriver.cmake new file mode 100644 index 000000000..02df1bab1 --- /dev/null +++ b/cmake/ctest/TribitsProjCTestDriver.cmake @@ -0,0 +1,25 @@ + +# Set the locations of things for this project +# + +SET(TRIBITS_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..") +SET(TriBITS_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../tribits") + +# +# Include the TriBITS file to get other modules included +# + +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../../tribits/ctest_driver/TribitsCTestDriverCore.cmake") + +# +# Define a caller for the TriBITS Project +# + +MACRO(TRIBITS_PROJ_CTEST_DRIVER) + SET_DEFAULT(TriBITS_REPOSITORY_LOCATION_DEFAULT + "https://github.com/TriBITSPub/TriBITS.git") + SET_DEFAULT(TriBITS_REPOSITORY_LOCATION_NIGHTLY_DEFAULT + "${TriBITS_REPOSITORY_LOCATION_DEFAULT}") + PRINT_VAR(TriBITS_REPOSITORY_LOCATION_DEFAULT) + TRIBITS_CTEST_DRIVER() +ENDMACRO() \ No newline at end of file diff --git a/cmake/ctest/generic_gcc/ctest_genertic_gcc_serial_debug.cmake b/cmake/ctest/generic_gcc/ctest_genertic_gcc_serial_debug.cmake new file mode 100644 index 000000000..e15a81e87 --- /dev/null +++ b/cmake/ctest/generic_gcc/ctest_genertic_gcc_serial_debug.cmake @@ -0,0 +1,31 @@ +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../TribitsProjCTestDriver.cmake") + +# +# Set the options specific to this build case +# + +SET(COMM_TYPE SERIAL) +SET(BUILD_TYPE DEBUG) +SET(BUILD_DIR_NAME GCC_${COMM_TYPE}_${BUILD_TYPE}) +SET(CTEST_TEST_TIMEOUT 60) + +SET_DEFAULT_AND_FROM_ENV( CTEST_BUILD_FLAGS "-j8 -k" ) + +SET_DEFAULT_AND_FROM_ENV( CTEST_PARALLEL_LEVEL "8" ) + +SET( EXTRA_CONFIGURE_OPTIONS + "-DBUILD_SHARED_LIBS:BOOL=ON" + "-DCMAKE_BUILD_TYPE=DEBUG" + "-DCMAKE_C_COMPILER=gcc" + "-DCMAKE_CXX_COMPILER=g++" + "-DCMAKE_Fortran_COMPILER=gfortran" + "-DTriBITS_TRACE_ADD_TEST=ON" + ) + +SET(CTEST_TEST_TYPE Nightly) + +# +# Run the CTest driver and submit to CDash +# + +TRIBITS_PROJ_CTEST_DRIVER() diff --git a/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake b/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake index 9e91a7101..e0a76903a 100644 --- a/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake +++ b/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake @@ -1,15 +1,4 @@ -# -# Set the locations of things for this project -# - -SET(TRIBITS_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../..") -SET(TriBITS_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../tribits") - -# -# Include the TriBITS file to get other modules included -# - -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../../../tribits/ctest_driver/TribitsCTestDriverCore.cmake") +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../TribitsProjCTestDriver.cmake") # # Set the options specific to this build case @@ -45,4 +34,4 @@ SET(CTEST_TEST_TYPE Continuous) # Run the CTest driver and submit to CDash # -TRIBITS_CTEST_DRIVER() +TRIBITS_PROJ_CTEST_DRIVER() diff --git a/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/tribits/ctest_driver/TribitsCTestDriverCore.cmake index 2c3c4b714..fd03f51b1 100644 --- a/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -1200,7 +1200,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # ``${PROJECT_NAME}_REPOSITORY_LOCATION`` # -# The location of the base git repo to clone inside of ``CTEST_UPDATE()``. +# The location of the base git repo to clone inside of ``CTEST_START()``. # The default is # ``${${PROJECT_NAME}_REPOSITORY_LOCATION_NIGHTLY_DEFAULT}`` when # ``CTEST_TEST_TYPE=Nightly`` and otherwise the default is From 2541677b32ad4e7a702737c3f576f88f34a54f75 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 19 Feb 2019 06:41:51 -0700 Subject: [PATCH 2/5] Update some README files for examples (#278) This is a start but these really need to be converted into README.md files and make more complete. --- .../examples/TribitsExampleMetaProject/README | 24 ++++++++----- tribits/examples/TribitsExampleProject/README | 34 ++++++------------- .../TribitsExampleProjectAddons/README | 31 ++++++++++------- 3 files changed, 43 insertions(+), 46 deletions(-) diff --git a/tribits/examples/TribitsExampleMetaProject/README b/tribits/examples/TribitsExampleMetaProject/README index adcd2406d..86070002e 100644 --- a/tribits/examples/TribitsExampleMetaProject/README +++ b/tribits/examples/TribitsExampleMetaProject/README @@ -2,21 +2,27 @@ # TribitsExampleMetaProject Documentation # -WARNING: WORK IN PROGRESS! This TriBITS example project will get fleshed out -more in the future to be more complete. - The project TribitsExampleMetaProject defines a TriBITS CMake project designed to provide a simple example to demonstrate how to compose a TriBITS Meta -project. +project out of one or more other TriBITS Repositories. To get started building you can create a directory structure like: ~/TribitsExampleMetaProject.base/ TribitsExampleMetaProject/ # This directory - TribitsExampleProject/ # Copied in - TribitsExampleProjectAddons/ # Copied in + TribitsExampleProject/ # Copied or cloned in + TribitsExampleProjectAddons/ # Copied or cloned in BUILDS/ - GCC-/ - MPI_DEBUG/ + SERIAL_DEBUG/ + +Then configure with: + + cd BUILDS/SERIAL_DEBUG/ + cmake -DTribitsExMetaProj_ENABLE_ALL_PACKAGES=ON \ + -DTribitsExMetaProj_ENABLE_TESTS=ON \ + ../../TribitsExampleMetaProject + +and build and test with: -ToDo: Finish documentation! + make -j4 + ctest -j4 diff --git a/tribits/examples/TribitsExampleProject/README b/tribits/examples/TribitsExampleProject/README index cd90d81d2..d11429441 100644 --- a/tribits/examples/TribitsExampleProject/README +++ b/tribits/examples/TribitsExampleProject/README @@ -2,12 +2,10 @@ # TribitsExampleProject Documentation # -WARNING: WORK IN PROGRESS! This TriBITS example project will get fleshed out -more in the future to be more complete. - The project TribitsExampleProject defines a TriBITS CMake project designed to provide a simple example to demonstrate how to use the TriBITS system to -create a build/test system for any given project. +create a CMake build, test, and deployment system using a package-based +architecture. To get started building you can create a directory structure like: @@ -15,18 +13,15 @@ To get started building you can create a directory structure like: TribitsExampleProject/ # This directory BUILDS/ GCC-/ - MPI_DEBUG/ + SERIAL_DEBUG/ You can then copy the configure file as: - cd ~/TribitsExampleProject.base/BUILDS/GCC-/BUILDS/MPI_DEBUG - cp ../../../../../../TribitsExampleProject/sampleScripts/linux-mpi-debug.sh do-configure - -You can create another directory for SERIAL_RELEASE or whatever build type you -want. + cd ~/TribitsExampleProject.base/BUILDS/GCC-/BUILDS/SERIAL_DEBUG + cp ../../../../TribitsExampleProject/sampleScripts/linux-serial-debug.sh \ + do-configure -If your system is already to set up to find the MPI compiler wrappers, you con -just configure with: +After that set, configure with: ./do-configure -DTribitsExProj_ENABLE_ALL_PACKAGES=ON @@ -34,18 +29,9 @@ and then build and test with: make -j4 && ctest -j4 -The layout of a TriBITS project is defined in the file: +The layout of a TriBITS project is described in: - TribitsExampleProject/cmake/tribits/doc/README.PROJECTS_REPOSITORIES_PACKAGES + https://tribits.org/doc/TribitsDevelopersGuide.html#tribits-project-structure Otherwise, this example TriBITS project is simple enough that it should be -enough to go on. (However, until the TribitsExampleProject is more fleshed -out, more complete examples of the usage of TriBITS can be find in the usage -of the TriBITS system by Trilinos itself.) - -For now, the main source for TriBITS is developed under the Trilinos git repo -and is snapshotted into this example project periodically. You can choose to -snapshot the TriBITS source tree as needed to update or not, it is up to you. -You may also choose not to snapshot the tribits directory and instead use -TriBITS stored in the Trilinos source tree if your project already depends on -Trilinos. +enough to get started as a template. diff --git a/tribits/examples/TribitsExampleProjectAddons/README b/tribits/examples/TribitsExampleProjectAddons/README index 2dbea72cc..31bc3d6ce 100644 --- a/tribits/examples/TribitsExampleProjectAddons/README +++ b/tribits/examples/TribitsExampleProjectAddons/README @@ -2,20 +2,25 @@ # TribitsExampleProjectAddons Documentation # -WARNING: WORK IN PROGRESS! This TriBITS example project will get fleshed out -more in the future to be more complete. +The project TribitsExampleProjectAddons defines a CMake TriBITS Repository +designed to provide a simple example to demonstrate how to use TriBITS +repositories with the TriBITS system to add on additional TriBITS CMake +packages to an existing TriBITS CMake project. -The project TribitsExampleProjectAddons defines a TriBITS CMake project -designed to provide a simple example to demonstrate how to use extra -repositories with the TriBITS system. +This is TriBITS repository is designed to be placed (cloned, copied, or +symlinked) under the TribitsExampleProject repository using the structure: -To get started building you can create a directory structure like: + TribitsExampleProject/ + TribitsExampleProjectAddons/ - ~/TribitsExampleProjectAddons.base/ - TribitsExampleProjectAddons/ # This directory - TribitsExampleProject/ # Copied in TribitsExampleProject/ dir - BUILDS/ - GCC-/ - MPI_DEBUG/ +Then configure the base TribitsExampleProject like before, except use: -ToDo: Finish documentation! + cmake -DTribtsExProj_EXTRA_REPOSITORIES=TribitsExampleProjectAddons \ + -DTribitsExProj_ENABLE_TESTS=ON \ + -DTribitsExProj_ENABLE_ALL_PACKAES=ON \ + /TribitsExampleProject + +then build and test with: + + make -j4 + ctest -j4 From 49d9c814defe2ec0019957233347c87223b04a7e Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Thu, 14 Feb 2019 13:42:11 -0700 Subject: [PATCH 3/5] tribits_ctest_driver(): Use more robust and better git commands and stronger testing (#278, TRIL-260) This commit represents a fairly significant enhancement of the handing of git repo clones and updates. Previous to this commit, CDash would not report the correct git repo SHA1 if the branch was not the default branch on the initial clone or in checking out a new branch. Also, the git commands were not robust in use cases where the current branch in a base repo or an extra repo was not on a tracking branch or the branch in the remote repo did not exist (like occurred in TRIL-260 which changing from 'atdm-develop-nightly' to 'atdm-nightly' where 'atdm-develop-nightly' got deleted in the GitHub repo). The documentation for git repo updates and been improved and streamlined. This includes a huge step forward in automated testing of the tribits_ctest_driver() function in how it does real git repo clones and updates for various use cases. To accomplish this, a new set of repos were create under https://github.com/tribits/ for the example projects/repos TribitsExampleMetaProject, TribitsExampleProject and TribitsExampleProjectAddons. There is a branch 'for-testing' in each of those repos that have known stats that are used for strong testing. Tests are set up based on a base TribitsExampleMetaProject repo/project that clones the extra repos TribitsExampleProject and TribitsExampleProjectAddons so we cover use cases in the base repo and extra repos (which are mostly decoupled). This testing helped to catch invalid logic for the extra repos (for the case where the current branch is not a tracking branch). Some of the specific things done include: * Switched from CTEST_UPDATE_COMMAND to CTEST_GIT_COMMAND (this really is git only) * Added CTEST_GIT_UPDATE_CUSTOM which calls a ctest -P script to do the improved git repo cleanup and update commands (see updated documentation). * Allow a set of CTEST_NOTES_FILES be specified by the user and correctly added to other notes files created internally and (hopefully) submitted to CDash. There are now strong unit tests for the full listing of notes files that are generated (which requires running ctest_update() to generate a few of the files). * Added TRIBITS_READ_CTEST_TAG_FILE() and TribitsGetCTestTestXmlDir.cmake (#278, #154): This is needed to be able to read XML files out of the /Testing// directory needed for (#278). This will also make it easy to generate a CDash URL without knowing the build ID. But this is not hooked in yet. It was added here with the hope to check the contents of the Notes.xml file but that file does not get generated unless you actually submit to CDash (which we can't do yet and don't want to rely on). Also added the file Add list_cdash_notes_files_in_xml_file.sh in hopes of doing this testing. * Remove the function to get the extra repo tracking branch. The old code assumed that the current branch in an extra repo was on a tacking branch. That is a bad assumption. The updated code just uses '@{u}' as the tracking branch. This was a real defect that was found through careful automated testing with real git commands. This is why we need some tests with real git commands to validate our implementation. * Updated some files in the example repos TribitsExampleMetaProject, TribitsExampleProject and TribitsExampleProjectAddons some to get these testing use cases working. Also improved the README files some more, but more is needed. --- test/core/ExamplesUnitTests/CMakeLists.txt | 2 +- test/ctest_driver/CMakeLists.txt | 37 ++ test/ctest_driver/CTestDriverUnitTests.cmake | 89 +++ .../MockCTestDriver/CMakeLists.txt | 145 ++++- .../TribitsExampleMetaProject/CMakeLists.txt | 544 ++++++++++++++++++ ...ibitsExMetaProjRepoVersion.for-testing.txt | 9 + .../TribitsExampleProject/CMakeLists.txt | 21 +- .../data/dummy_build_dir/Testing/TAG | 2 + .../list_cdash_notes_files_in_xml_file.sh | 27 + .../ctest_driver/TribitsCTestDriverCore.cmake | 427 +++++++++----- .../TribitsCTestDriverCoreHelpers.cmake | 140 +---- .../TribitsGetCTestTestXmlDir.cmake | 41 ++ tribits/ctest_driver/TribitsReadTagFile.cmake | 16 + .../tribits_ctest_update_commands.cmake | 75 +++ ...ribits_ctest_update_commands_wrapper.cmake | 28 + .../CTestConfig.cmake | 15 + .../ProjectName.cmake | 9 +- .../cmake/ExtraRepositoriesList.cmake | 6 +- .../cmake/ctest/CTestCustom.cmake.in | 5 + .../ctest/TribitsExMetaProjCTestDriver.cmake | 31 + .../general_gcc/ctest_serial_debug.cmake | 31 + 21 files changed, 1401 insertions(+), 299 deletions(-) create mode 100644 test/ctest_driver/CTestDriverUnitTests.cmake create mode 100644 test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt create mode 100644 test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.txt create mode 100644 test/ctest_driver/data/dummy_build_dir/Testing/TAG create mode 100755 test/ctest_driver/list_cdash_notes_files_in_xml_file.sh create mode 100644 tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake create mode 100644 tribits/ctest_driver/TribitsReadTagFile.cmake create mode 100644 tribits/ctest_driver/tribits_ctest_update_commands.cmake create mode 100644 tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake create mode 100644 tribits/examples/TribitsExampleMetaProject/CTestConfig.cmake create mode 100644 tribits/examples/TribitsExampleMetaProject/cmake/ctest/CTestCustom.cmake.in create mode 100644 tribits/examples/TribitsExampleMetaProject/cmake/ctest/TribitsExMetaProjCTestDriver.cmake create mode 100644 tribits/examples/TribitsExampleMetaProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake diff --git a/test/core/ExamplesUnitTests/CMakeLists.txt b/test/core/ExamplesUnitTests/CMakeLists.txt index 3787abf82..10908ec25 100644 --- a/test/core/ExamplesUnitTests/CMakeLists.txt +++ b/test/core/ExamplesUnitTests/CMakeLists.txt @@ -3158,7 +3158,7 @@ TRIBITS_ADD_ADVANCED_TEST( TribitsExampleMetaProject -DTribitsExMetaProj_ENABLE_TESTS=ON TribitsExampleMetaProject PASS_REGULAR_EXPRESSION_ALL - "Reading the list of extra repositories from cmake/ExtraRepositoriesList.cmake" + "Reading the list of extra repositories from .*cmake/ExtraRepositoriesList.cmake" "-- Adding POST extra Continuous repository TribitsExampleProject " "-- Adding POST extra Continuous repository TribitsExampleProject " "Reading list of native packages from .*/TribitsExampleMetaProject/PackagesList.cmake" diff --git a/test/ctest_driver/CMakeLists.txt b/test/ctest_driver/CMakeLists.txt index 2f8a42846..8a57f91ca 100644 --- a/test/ctest_driver/CMakeLists.txt +++ b/test/ctest_driver/CMakeLists.txt @@ -1,5 +1,42 @@ +TRIBITS_ADD_ADVANCED_TEST( CTestDriverUnitTests + OVERALL_WORKING_DIRECTORY TEST_NAME + TEST_0 CMND ${CMAKE_COMMAND} + ARGS + -DPROJECT_NAME=${PROJECT_NAME} + -D${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} + -P "${CMAKE_CURRENT_SOURCE_DIR}/CTestDriverUnitTests.cmake" + PASS_REGULAR_EXPRESSION_ALL + "Final UnitTests Result: num_run = 2" + "Final UnitTests Result: PASSED" + ) + + +TRIBITS_ADD_ADVANCED_TEST( TribitsGetCTestTestXmlDir + OVERALL_WORKING_DIRECTORY TEST_NAME + + TEST_0 CMND ${CMAKE_COMMAND} + ARGS + -DPROJECT_NAME=${PROJECT_NAME} + -D${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} + -DCTEST_BUILD_DIR="${CMAKE_CURRENT_LIST_DIR}/data/dummy_build_dir" + -P "${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver/TribitsGetCTestTestXmlDir.cmake" + PASS_REGULAR_EXPRESSION_ALL + "${CMAKE_CURRENT_LIST_DIR}/data/dummy_build_dir/Testing/20101015-1112" + ) + + ADD_SUBDIRECTORY(MockCTestDriver) + IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") ADD_SUBDIRECTORY(TribitsExampleProject) ENDIF() + +SET(${PROJECT_NAME}_ENABLE_REAL_GIT_CLONE_TESTS OFF CACHE BOOL + "If TRUE, then perform tests that do real clones of repos from GitHub.") + +IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND + ${PROJECT_NAME}_ENABLE_REAL_GIT_CLONE_TESTS + ) + ADD_SUBDIRECTORY(TribitsExampleMetaProject) +ENDIF() diff --git a/test/ctest_driver/CTestDriverUnitTests.cmake b/test/ctest_driver/CTestDriverUnitTests.cmake new file mode 100644 index 000000000..237dc8230 --- /dev/null +++ b/test/ctest_driver/CTestDriverUnitTests.cmake @@ -0,0 +1,89 @@ +# @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 + +MESSAGE("PROJECT_NAME = ${PROJECT_NAME}") +MESSAGE("${PROJECT_NAME}_TRIBITS_DIR = ${${PROJECT_NAME}_TRIBITS_DIR}") + +SET( CMAKE_MODULE_PATH + "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" + "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" + "${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver" + ) + +INCLUDE(GlobalSet) +INCLUDE(TribitsReadTagFile) +INCLUDE(UnitTestHelpers) + + +FUNCTION(UNITTEST_READ_CTEST_TAG_FILE) + + MESSAGE("\n***") + MESSAGE("*** Testing tribits_read_ctest_tag_file()") + MESSAGE("***\n") + + SET(TAG_FILE_IN "${CMAKE_CURRENT_LIST_DIR}/data/dummy_build_dir/Testing/TAG") + + TRIBITS_READ_CTEST_TAG_FILE(${TAG_FILE_IN} BUILD_START_TIME_OUT CDASH_TRACK_OUT) + + UNITTEST_COMPARE_CONST(BUILD_START_TIME_OUT + "20101015-1112") + + UNITTEST_COMPARE_CONST(CDASH_TRACK_OUT + "My CDash Track") # NOTE: Spaces are important to test here! + +ENDFUNCTION() + +# +# Execute the unit tests +# + +# Assume that all unit tests will pass by default +GLOBAL_SET(UNITTEST_OVERALL_PASS TRUE) +GLOBAL_SET(UNITTEST_OVERALL_NUMPASSED 0) +GLOBAL_SET(UNITTEST_OVERALL_NUMRUN 0) + +# Run the unit test functions +UNITTEST_READ_CTEST_TAG_FILE() + +MESSAGE("\n***") +MESSAGE("*** Determine final result of all unit tests") +MESSAGE("***\n") + +# Pass in the number of expected tests that must pass! +UNITTEST_FINAL_RESULT(2) diff --git a/test/ctest_driver/MockCTestDriver/CMakeLists.txt b/test/ctest_driver/MockCTestDriver/CMakeLists.txt index 980c9e645..5e70ea454 100644 --- a/test/ctest_driver/MockCTestDriver/CMakeLists.txt +++ b/test/ctest_driver/MockCTestDriver/CMakeLists.txt @@ -402,20 +402,27 @@ CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( # Check repo operations for an update CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( CI_TestGitUpdateCommands - ARGS Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON Trilinos_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous + ARGS + Trilinos_REPOSITORY_LOCATION=https://some-git-url/Trilinos.git + Trilinos_GIT_REPOSITORY_REMOTE=other-remote + CTEST_UPDATE_ARGS="--reference /Trilinos" + Trilinos_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous + Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON Trilinos_ADDITIONAL_PACKAGES=Stalix PASS_REGULAR_EXPRESSION_ALL + "CTEST_CHECKOUT_COMMAND=./somebasedir/git. clone -o other-remote --reference /Trilinos https://some-git-url/Trilinos[.]git" "preCopyrightTrilinos: Doing GIT update from URL 'url1:/git/preCopyrightTrilinos' to dir '.*/MockTrilinos/preCopyrightTrilinos'" - "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.clean.out." + "CTEST_GIT_UPDATE_CUSTOM=${CMAKE_COMMAND}[;]-DGIT_EXE=/somebasedir/git[;]-DREMOTE_NAME=other-remote[;]-DBRANCH=[;]-DUNIT_TEST_MODE=ON[;]-DOUTPUT_FILE=.*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/UpdateCommandsOutput.txt[;]-P[;].*/tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake" + "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]fetch[;]other-remote[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.fetch.out." + "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.clean.out." "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]reset[;]--hard[;]HEAD[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.reset.out." - "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.fetch.out." - "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]reset[;]--hard[;]tracking/branch[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.set_branch.out." + "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]reset[;]--hard[;]@{u}[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/preCopyrightTrilinos.set_branch.out." "Dakota: Doing initial GIT clone/checkout from URL 'url3:/git/Dakota' to dir 'packages/TriKota/Dakota' ..." - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clone[;]url3:/git/Dakota[;]packages/TriKota/Dakota[;]WORKING_DIRECTORY[;].*/tribits/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.clone.out" + "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clone[;]-o[;]other-remote[;]url3:/git/Dakota[;]packages/TriKota/Dakota[;]WORKING_DIRECTORY[;].*/tribits/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.clone.out" + "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]fetch[;]other-remote[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.fetch.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.clean.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]reset[;]--hard[;]HEAD[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.reset.out" - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.fetch.out" - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]reset[;]--hard[;]tracking/branch[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.set_branch.out" + "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]reset[;]--hard[;]@{u}[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Dakota.set_branch.out" "Dakota: Doing initial GIT clone/checkout from URL 'url3:/git/Dakota' to dir 'packages/TriKota/Dakota' ..." "EXECUTE_PROCESS.COMMAND[;].*/python.*[;].*/python_utils/gitdist[;]--dist-no-color[;]log[;]--pretty=format.*[;]--name-status[;]-C[;]ORIG_HEAD..HEAD[;]WORKING_DIRECTORY[;].*/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands/Updates.txt" "Adding POST extra Continuous repository preCopyrightTrilinos" @@ -432,20 +439,25 @@ CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( # Test repo operations for Trilinos_BRANCH=other-branch (#130) CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( CI_TestGitUpdateCommands_Branch - ARGS Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON Trilinos_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous - Trilinos_ADDITIONAL_PACKAGES=Stalix + ARGS + Trilinos_REPOSITORY_LOCATION=https://some-git-url/Trilinos.git + CTEST_UPDATE_ARGS="--reference /Trilinos" Trilinos_BRANCH=other-branch + Trilinos_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous + Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON + Trilinos_ADDITIONAL_PACKAGES=Stalix PASS_REGULAR_EXPRESSION_ALL - "For base repo, doing switch to branch other-branch" - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]checkout[;]-B[;]other-branch[;]--track[;]origin/other-branch[;]WORKING_DIRECTORY[;].*/MockTrilinos[;]RESULT_VARIABLE[;]GIT_CHECKOUT_RETURN_VAL[;]OUTPUT_VARIABLE[;]BRANCH_OUTPUT[;]ERROR_VARIABLE[;]BRANCH_ERROR" + "CTEST_CHECKOUT_COMMAND=./somebasedir/git. clone -b other-branch -o origin --reference /Trilinos https://some-git-url/Trilinos[.]git" + "CTEST_GIT_UPDATE_CUSTOM=${CMAKE_COMMAND}[;]-DGIT_EXE=/somebasedir/git[;]-DREMOTE_NAME=origin[;]-DBRANCH=other-branch[;]-DUNIT_TEST_MODE=ON[;]-DOUTPUT_FILE=.*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/UpdateCommandsOutput.txt[;]-P[;].*/tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake" + "For extra repos, doing switch to branch other-branch" "preCopyrightTrilinos: Doing GIT update from URL 'url1:/git/preCopyrightTrilinos' to dir '.*/MockTrilinos/preCopyrightTrilinos'" + "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/preCopyrightTrilinos.fetch.out." "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/preCopyrightTrilinos.clean.out." "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]reset[;]--hard[;]HEAD[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/preCopyrightTrilinos.reset.out." - "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/preCopyrightTrilinos.fetch.out." "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]checkout[;]-B[;]other-branch[;]--track[;]origin/other-branch[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/preCopyrightTrilinos.set_branch.out." "Dakota: Doing initial GIT clone/checkout from URL 'url3:/git/Dakota' to dir 'packages/TriKota/Dakota' ..." - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clone[;]url3:/git/Dakota[;]packages/TriKota/Dakota[;]WORKING_DIRECTORY[;].*/tribits/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/Dakota.clone.out" + "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clone[;]-b[;]other-branch[;]-o[;]origin[;]url3:/git/Dakota[;]packages/TriKota/Dakota[;]WORKING_DIRECTORY[;].*/tribits/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/Dakota.clone.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/Dakota.clean.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]reset[;]--hard[;]HEAD[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/Dakota.reset.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch/Dakota.fetch.out" @@ -459,17 +471,25 @@ CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( "Trilinos_NUM_TPLS='20'" "Skipping reading packages and TPLs for POST extra repo Dakota because marked NOPACKAGES" ) + # NOTE: Above tets with default Trilinos_GIT_REPOSITORY_REMOTE=origin which + # is important to test! # Test repo operations Trilinos_BRANCH=other-branch, Trilinos_EXTRAREPOS_BRANCH=yet-other-branch CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( CI_TestGitUpdateCommands_Branch_ExtraReposBranch - ARGS Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON Trilinos_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous + ARGS + Trilinos_REPOSITORY_LOCATION=https://some-git-url/Trilinos.git + Trilinos_BRANCH=other-branch + Trilinos_EXTRAREPOS_BRANCH=yet-other-branch + Trilinos_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous + Trilinos_ENABLE_SECONDARY_TESTED_CODE=ON Trilinos_ADDITIONAL_PACKAGES=Stalix - Trilinos_BRANCH=other-branch Trilinos_EXTRAREPOS_BRANCH=yet-other-branch PASS_REGULAR_EXPRESSION_ALL - "For base repo, doing switch to branch other-branch" - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]checkout[;]-B[;]other-branch[;]--track[;]origin/other-branch[;]WORKING_DIRECTORY[;].*/MockTrilinos[;]RESULT_VARIABLE[;]GIT_CHECKOUT_RETURN_VAL[;]OUTPUT_VARIABLE[;]BRANCH_OUTPUT[;]ERROR_VARIABLE[;]BRANCH_ERROR" + + "CTEST_CHECKOUT_COMMAND=./somebasedir/git. clone -b other-branch -o origin https://some-git-url/Trilinos[.]git" + "CTEST_GIT_UPDATE_CUSTOM=${CMAKE_COMMAND}[;]-DGIT_EXE=/somebasedir/git[;]-DREMOTE_NAME=origin[;]-DBRANCH=other-branch[;]-DUNIT_TEST_MODE=ON[;]-DOUTPUT_FILE=.*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/UpdateCommandsOutput.txt[;]-P[;].*/tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake" + "For extra repos, doing switch to branch yet-other-branch" "preCopyrightTrilinos: Doing GIT update from URL 'url1:/git/preCopyrightTrilinos' to dir '.*/MockTrilinos/preCopyrightTrilinos'" "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/preCopyrightTrilinos.clean.out." @@ -477,7 +497,7 @@ CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/preCopyrightTrilinos.fetch.out." "EXECUTE_PROCESS.COMMAND./somebasedir/git[;]checkout[;]-B[;]yet-other-branch[;]--track[;]origin/yet-other-branch[;]WORKING_DIRECTORY[;].*/MockTrilinos/preCopyrightTrilinos.OUTPUT_FILE[;].*/test/ctest_driver/MockCTestDriver/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/preCopyrightTrilinos.set_branch.out." "Dakota: Doing initial GIT clone/checkout from URL 'url3:/git/Dakota' to dir 'packages/TriKota/Dakota' ..." - "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clone[;]url3:/git/Dakota[;]packages/TriKota/Dakota[;]WORKING_DIRECTORY[;].*/tribits/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/Dakota.clone.out" + "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clone[;]-b[;]yet-other-branch[;]-o[;]origin[;]url3:/git/Dakota[;]packages/TriKota/Dakota[;]WORKING_DIRECTORY[;].*/tribits/examples/MockTrilinos[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/Dakota.clone.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]clean[;]-fdx[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/Dakota.clean.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]reset[;]--hard[;]HEAD[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/Dakota.reset.out" "EXECUTE_PROCESS.COMMAND[;]/somebasedir/git[;]fetch[;]origin[;]TIMEOUT[;]600[;]WORKING_DIRECTORY[;].*/MockTrilinos/packages/TriKota/Dakota[;]OUTPUT_FILE[;].*/TriBITS_MockCTestDriver_CI_TestGitUpdateCommands_Branch_ExtraReposBranch/Dakota.fetch.out" @@ -967,3 +987,92 @@ CREATE_CTEST_DEPENDENCY_HANDLING_TEST_CASE( # ToDo: Test ??? + + +# +# Test tribits_ctest_update_commands_wrapper.cmake +# + + +TRIBITS_ADD_ADVANCED_TEST( CTestDriver_tribits_ctest_update_commands_wrapper_named_branch + OVERALL_WORKING_DIRECTORY TEST_NAME + OVERALL_NUM_MPI_PROCS 1 + + TEST_0 + CMND "${CMAKE_COMMAND}" + ARGS + -DGIT_EXE=/some-dir/git + -DREMOTE_NAME=my-remote + -DBRANCH=my-branch + -DUNIT_TEST_MODE=ON + -DOUTPUT_FILE=UpdateCommandsOutput.txt + -P ${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver/tribits_ctest_update_commands_wrapper.cmake + ALWAYS_FAIL_ON_NONZERO_RETURN + PASS_REGULAR_EXPRESSION_ALL + "cmake -P tribits_ctest_update_commands_wrapper.cmake" + "-- OUTPUT_FILE=UpdateCommandsOutput.txt" + "tribits_ctest_update_commands_wrapper.cmake return: 0" + + TEST_1 + CMND cat ARGS UpdateCommandsOutput.txt + ALWAYS_FAIL_ON_NONZERO_RETURN + PASS_REGULAR_EXPRESSION_ALL + "cmake -P tribits_ctest_update_commands.cmake:" + "-- GIT_EXE=/some-dir/git" + "-- REMOTE_NAME=my-remote" + "-- BRANCH=my-branch" + "-- UNIT_TEST_MODE=ON" + "Running: /some-dir/git fetch my-remote" + "execute_process[(]COMMAND[;]/some-dir/git[;]fetch[;]my-remote[)]" + "Running: /some-dir/git clean -fdx" + "execute_process[(]COMMAND[;]/some-dir/git[;]clean[;]-fdx[)]" + "Running: /some-dir/git reset --hard HEAD" + "execute_process[(]COMMAND[;]/some-dir/git[;]reset[;]--hard[;]HEAD[)]" + "Running: /some-dir/git checkout -B my-branch --track my-remote/my-branch" + "execute_process[(]COMMAND[;]/some-dir/git[;]checkout[;]-B[;]my-branch[;]--track[;]my-remote/my-branch[)]" + "Git Update PASSED!" + + ) + + +TRIBITS_ADD_ADVANCED_TEST( CTestDriver_tribits_ctest_update_commands_wrapper_default_branch + OVERALL_WORKING_DIRECTORY TEST_NAME + OVERALL_NUM_MPI_PROCS 1 + + TEST_0 + CMND "${CMAKE_COMMAND}" + ARGS + -DGIT_EXE=/some-dir/git + -DREMOTE_NAME=origin + -DBRANCH= + -DUNIT_TEST_MODE=ON + -DOUTPUT_FILE=UpdateCommandsOutput.txt + -P ${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver/tribits_ctest_update_commands_wrapper.cmake + ALWAYS_FAIL_ON_NONZERO_RETURN + PASS_REGULAR_EXPRESSION_ALL + "cmake -P tribits_ctest_update_commands_wrapper.cmake" + "-- OUTPUT_FILE=UpdateCommandsOutput.txt" + "tribits_ctest_update_commands_wrapper.cmake return: 0" + + TEST_1 + CMND cat ARGS UpdateCommandsOutput.txt + ALWAYS_FAIL_ON_NONZERO_RETURN + PASS_REGULAR_EXPRESSION_ALL + "cmake -P tribits_ctest_update_commands.cmake:" + "-- GIT_EXE=/some-dir/git" + "-- REMOTE_NAME=origin" + "-- BRANCH=" + "-- UNIT_TEST_MODE=ON" + "Running: /some-dir/git fetch origin" + "execute_process[(]COMMAND[;]/some-dir/git[;]fetch[;]origin[)]" + "Running: /some-dir/git clean -fdx" + "execute_process[(]COMMAND[;]/some-dir/git[;]clean[;]-fdx[)]" + "Running: /some-dir/git reset --hard HEAD" + "execute_process[(]COMMAND[;]/some-dir/git[;]reset[;]--hard[;]HEAD[)]" + "Running: /some-dir/git reset --hard @{u}" + "execute_process[(]COMMAND[;]/some-dir/git[;]reset[;]--hard[;]@{u}[)]" + "Git Update PASSED!" + + ) + + diff --git a/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt b/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt new file mode 100644 index 000000000..39859b688 --- /dev/null +++ b/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt @@ -0,0 +1,544 @@ +# @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 + + +############################################################################### +# +# Strong automated testing of TribitsCTestDriverCore.cmake and 'dashboard' +# target using real TribitsExampleMetaProject including cloning git repos +# +############################################################################### + +# +# Set up common vars/args for all direct CTest Driver tests +# + +SET(TribitsExMetaProj_DIR "${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleMetaProject") + +SET(COMMON_ENV_ARGS + # Set back to default in case set in env + CTEST_TEST_TYPE= + TribitsExMetaProj_PACKAGES= + CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES= + CTEST_ENABLE_MODIFIED_PACKAGES_ONLY=OFF + TribitsExMetaProj_PRE_REPOSITORIES= + TribitsExMetaProj_EXTRA_REPOSITORIES= + CTEST_BUILD_FLAGS=-j2 + CTEST_PARALLEL_LEVEL=1 + # Other args + TribitsExMetaProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} + CTEST_DO_SUBMIT=OFF + ) + +SET(CTEST_S_SCRIPT_ARGS + ${CMAKE_CTEST_COMMAND} -V -S + ${TribitsExMetaProj_DIR}/cmake/ctest/general_gcc/ctest_serial_debug.cmake + ) + +# +# Set up arguments for direct configures of TribitsExampleMetaProject to test +# the 'dashboard' target. +# + +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../../core/ExamplesUnitTests/GetCompilerPassthroughArgs.cmake") + +SET(TribitsExampleMetaProject_COMMON_CONFIG_ARGS + ${COMMON_ENV_ARGS_PASSTHROUGH} + -DTribitsExMetaProj_ENABLE_Fortran=${${PROJECT_NAME}_ENABLE_Fortran} + ${CTEST_DROP_SITE_CONFIG_ARGS} + ) + +########################################################################################## +# +# Test TRIBITS_CTEST_DRIVER() using real git clones +# +# NOTE: To get these tests to work on some systems, one may need to switch +# away from 'https://github.com/' to using 'git@github.com:' using: +# +# export TribitsExMetaProj_GIT_URL_REPO_BASE=git@github.com:tribits/ +# +# before configuring. +# +########################################################################################## + + +TRIBITS_ADD_ADVANCED_TEST( CTestDriver_TribitsExMetaProj_clone_default_branch_remote + OVERALL_WORKING_DIRECTORY TEST_NAME + OVERALL_NUM_MPI_PROCS 1 + + TEST_0 + MESSAGE "Run ctest driver with intial clone of the repos on the default branch 'master' and remote 'origin'" + CMND env + ARGS + CTEST_DASHBOARD_ROOT=PWD + ${COMMON_ENV_ARGS} + TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE + CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_default_branch_remote + ${CTEST_S_SCRIPT_ARGS} + PASS_REGULAR_EXPRESSION_ALL + "CTEST_NOTES_FILES=''" + "First perform the initial checkout: .*/git. clone -o origin .*github.com.tribits/TribitsExampleMetaProject.git" + "Perform checkout in directory: .*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote" + "Calling CTEST_UPDATE[(][)] to update base source repo '.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/TribitsExampleMetaProject" + "Old revision of repository is: [a-z0-9]+" + "New revision of repository is: [a-z0-9]+" + "CTEST_UPDATE[(][.][.][.][)] returned '0'" + "cmake -P tribits_ctest_update_commands[.]cmake" + "Git Update PASSED!" + "TribitsExampleProject: Doing initial GIT clone/checkout from URL '.*github[.]com.tribits/TribitsExampleProject.git' to dir 'TribitsExampleProject' [.][.][.]" + "Cloning into 'TribitsExampleProject'[.][.][.]" + "TribitsExampleProjectAddons: Doing initial GIT clone/checkout from URL '.*github[.]com.tribits/TribitsExampleProjectAddons.git' to dir 'TribitsExampleProjectAddons' [.][.][.]" + "Cloning into 'TribitsExampleProjectAddons'[.][.][.]" + "CTEST_NOTES_FILES_WO_CACHE='.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/BUILD/UpdateCommandsOutput.txt'" + "Configure PASSED!" + "CTEST_NOTES_FILES='.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/BUILD/TribitsExMetaProjRepoVersion.txt[;].*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/BUILD/UpdateCommandsOutput.txt[;].*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/BUILD/CMakeCache.clean.txt'" + "Build PASSED!" + "100% tests passed, 0 tests failed out of 11" + "Addon1 .*=.*.* sec[*]proc [(]1 test[)]" + "MixedLang .* =.*.* sec[*]proc [(]1 test[)]" + "SimpleCxx .*=*.* sec[*]proc [(]2 tests[)]" + "WithSubpackages .*=*.* sec[*]proc [(]6 tests[)]" + "WrapExternal .*=*.* sec[*]proc [(]1 test[)]" + "File '' does NOT exist so all tests passed!" + "TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_1 + MESSAGE "Check that base repo has correct remote" + CMND git ARGS remote -v + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "origin.*.*github[.]com.tribits/TribitsExampleMetaProject[.]git" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_2 + MESSAGE "Check that base repo is on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*master" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_3 + MESSAGE "Check that one of the extra repos has correct remote" + CMND git ARGS remote -v + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "origin.*.*github[.]com.tribits/TribitsExampleProject[.]git" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_4 + MESSAGE "Check that one of the extra repos in on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*master" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_5 + MESSAGE "Run ctest driver with an update changing to the branch 'for-testing'" + CMND env + ARGS + CTEST_DASHBOARD_ROOT=PWD + ${COMMON_ENV_ARGS} + CTEST_START_WITH_EMPTY_BINARY_DIRECTORY=FALSE + CTEST_WIPE_CACHE=FALSE + TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE + TribitsExMetaProj_BRANCH=for-testing + CTEST_NOTES_FILES=${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleMetaProject/README + CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_default_branch_remote + ${CTEST_S_SCRIPT_ARGS} + PASS_REGULAR_EXPRESSION_ALL + "-- ENV_CTEST_NOTES_FILES='.*/tribits/examples/TribitsExampleMetaProject/README'" + "-- CTEST_NOTES_FILES='.*/tribits/examples/TribitsExampleMetaProject/README'" + "-- ENV_TribitsExMetaProj_BRANCH='for-testing'" + "-- TribitsExMetaProj_BRANCH='for-testing'" + "Calling CTEST_UPDATE[(][)] to update base source repo '.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/TribitsExampleMetaProject" + "Old revision of repository is: [a-z0-9]+" + "New revision of repository is: 56877b3b3dd06f41dfb27cedcedc2693aafaef03" + "CTEST_UPDATE[(][.][.][.][)] returned '[0-9]+'" + "cmake -P tribits_ctest_update_commands[.]cmake" + "Running: .*/git checkout -B for-testing --track origin/for-testing" + "Switched to a new branch 'for-testing'" + "Branch '*for-testing'* set up to track remote branch '*for-testing'* from '*origin'*." + "Git Update PASSED!" + "For extra repos, doing switch to branch for-testing" + "TribitsExampleProject: Doing GIT update from URL '.*github[.]com.tribits/TribitsExampleProject[.]git' to dir '.*/TribitsExampleProject' [.][.][.]" + "TribitsExampleProjectAddons: Doing GIT update from URL '.*github[.]com.tribits/TribitsExampleProjectAddons[.]git' to dir '.*/TribitsExampleProjectAddons' [.][.][.]" + "CTEST_NOTES_FILES_WO_CACHE='.*/BUILD/Updates.txt[;].*/BUILD/UpdateCommandsOutput.txt[;].*/tribits/examples/TribitsExampleMetaProject/README'" + "Configure PASSED!" + "CTEST_NOTES_FILES='.*/BUILD/TribitsExMetaProjRepoVersion.txt[;].*/BUILD/Updates.txt[;].*/BUILD/UpdateCommandsOutput.txt[;].*/tribits/examples/TribitsExampleMetaProject/README[;].*/BUILD/CMakeCache.clean.txt'" + "Build PASSED!" + "100% tests passed, 0 tests failed out of 11" + "Addon1 .*=.*.* sec[*]proc [(]1 test[)]" + "MixedLang .* =.*.* sec[*]proc [(]1 test[)]" + "SimpleCxx .*=*.* sec[*]proc [(]2 tests[)]" + "WithSubpackages .*=*.* sec[*]proc [(]6 tests[)]" + "WrapExternal .*=*.* sec[*]proc [(]1 test[)]" + "File '' does NOT exist so all tests passed!" + "TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_6 + MESSAGE "Check that base repo is on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*for-testing" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_7 + MESSAGE "Check that one of the extra repos in on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*for-testing" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_8 + MESSAGE "Make sure that the file TribitsExMetaProjRepoVersion.txt is correct" + CMND diff ARGS + "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.txt" + BUILD/TribitsExMetaProjRepoVersion.txt + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_9 + MESSAGE "Remove one of the git repos to make sure that it clones again" + CMND rm ARGS -rf TribitsExampleMetaProject/TribitsExampleProjectAddons + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_10 + MESSAGE "Reset other repos back to an earlier version so we can simulate and update" + CMND "${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/gitdist" + ARGS --dist-no-color --dist-repos=.,TribitsExampleProject reset --hard HEAD^ + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*][*][*] Base Git Repo: TribitsExampleMetaProject" + "HEAD is now at a8f6f48 Update README file [(]tribitspub/tribits#278[)]" + "[*][*][*] Git Repo: TribitsExampleProject" + "HEAD is now at 8108b6a Automatic snapshot commit from TribitsExampleProject at f5ca5b7" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_11 + MESSAGE "Run ctest driver with an on branch 'for-testing'" + CMND env + ARGS + CTEST_DASHBOARD_ROOT=PWD + ${COMMON_ENV_ARGS} + CTEST_START_WITH_EMPTY_BINARY_DIRECTORY=FALSE + CTEST_WIPE_CACHE=FALSE + TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE + TribitsExMetaProj_BRANCH=for-testing + CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_default_branch_remote + ${CTEST_S_SCRIPT_ARGS} + PASS_REGULAR_EXPRESSION_ALL + "-- CTEST_NOTES_FILES=''" + "-- ENV_TribitsExMetaProj_BRANCH='for-testing'" + "-- TribitsExMetaProj_BRANCH='for-testing'" + "Calling CTEST_UPDATE[(][)] to update base source repo '.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_default_branch_remote/TribitsExampleMetaProject" + "Old revision of repository is: a8f6f489088537176f0cab2fc189294038963ec4" + "New revision of repository is: 56877b3b3dd06f41dfb27cedcedc2693aafaef03" + "CTEST_UPDATE[(][.][.][.][)] returned '1'" + "cmake -P tribits_ctest_update_commands[.]cmake" + "HEAD is now at a8f6f48 Update README file [(]tribitspub/tribits#278[)]" + "Git Update PASSED!" + "For extra repos, doing switch to branch for-testing" + "TribitsExampleProject: Doing GIT update from URL '.*github[.]com.tribits/TribitsExampleProject[.]git' to dir '.*/TribitsExampleProject' [.][.][.]" + "TribitsExampleProjectAddons: Doing initial GIT clone/checkout from URL '.*github.com.tribits/TribitsExampleProjectAddons.git' to dir 'TribitsExampleProjectAddons' [.][.][.]" + "CTEST_NOTES_FILES_WO_CACHE='.*/BUILD/Updates.txt[;].*/BUILD/UpdateCommandsOutput.txt'" + "Configure PASSED!" + "CTEST_NOTES_FILES='.*/BUILD/TribitsExMetaProjRepoVersion.txt[;].*/BUILD/Updates.txt[;].*/BUILD/UpdateCommandsOutput.txt[;].*/BUILD/CMakeCache.clean.txt'" + "Build PASSED!" + "100% tests passed, 0 tests failed out of 11" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_12 + MESSAGE "Make sure that the file TribitsExMetaProjRepoVersion.txt is correct" + CMND diff ARGS + "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.txt" + BUILD/TribitsExMetaProjRepoVersion.txt + ALWAYS_FAIL_ON_NONZERO_RETURN + + ) + # The above test checks several things: + # + # * Tests the initial clone of all the repos from scratch on the default + # branch and remote name work. + # + # * Tests that the Updates.txt file in *NOT* created or attached as a notes + # file on the initial clone. + # + # * Makes sure some git commit SHA1s are shown in 'Old/New revision of + # repository' printouts from ctest_update(). + # + # * ??? + # + # + # NOTE: The reason that so many tests are done in a single ctest test is the + # cost of the initial configure which is very expensive. The other runs use + # CTEST_START_WITH_EMPTY_BINARY_DIRECTORY=FALSE and CTEST_WIPE_CACHE=FALSE + # to avoid this cost. + + +TRIBITS_ADD_ADVANCED_TEST( CTestDriver_TribitsExMetaProj_clone_custom_branch_remote + OVERALL_WORKING_DIRECTORY TEST_NAME + OVERALL_NUM_MPI_PROCS 1 + + TEST_0 + MESSAGE "Run ctest driver with intial clone of the repos on the default branch 'master' and remote 'origin'" + CMND env + ARGS + CTEST_DASHBOARD_ROOT=PWD + ${COMMON_ENV_ARGS} + TribitsExMetaProj_GIT_REPOSITORY_REMOTE=github + TribitsExMetaProj_BRANCH=for-testing + TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE + CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_custom_branch_remote + ${CTEST_S_SCRIPT_ARGS} + PASS_REGULAR_EXPRESSION_ALL + "CTEST_NOTES_FILES=''" + "First perform the initial checkout: .*/git. clone -b for-testing -o github .*github.com.tribits/TribitsExampleMetaProject.git" + "Perform checkout in directory: .*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote" + "Calling CTEST_UPDATE[(][)] to update base source repo '.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote/TribitsExampleMetaProject" + "Old revision of repository is: 56877b3b3dd06f41dfb27cedcedc2693aafaef03" + "New revision of repository is: 56877b3b3dd06f41dfb27cedcedc2693aafaef03" + "CTEST_UPDATE[(][.][.][.][)] returned '0'" + "cmake -P tribits_ctest_update_commands[.]cmake" + "Git Update PASSED!" + "TribitsExampleProject: Doing initial GIT clone/checkout from URL '.*github[.]com.tribits/TribitsExampleProject.git' to dir 'TribitsExampleProject' [.][.][.]" + "Cloning into 'TribitsExampleProject'[.][.][.]" + "TribitsExampleProjectAddons: Doing initial GIT clone/checkout from URL '.*github[.]com.tribits/TribitsExampleProjectAddons.git' to dir 'TribitsExampleProjectAddons' [.][.][.]" + "Cloning into 'TribitsExampleProjectAddons'[.][.][.]" + "CTEST_NOTES_FILES_WO_CACHE='.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote/BUILD/UpdateCommandsOutput.txt'" + "Configure PASSED!" + "CTEST_NOTES_FILES='.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote/BUILD/TribitsExMetaProjRepoVersion.txt[;].*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote/BUILD/UpdateCommandsOutput.txt[;].*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote/BUILD/CMakeCache.clean.txt'" + "Build PASSED!" + "100% tests passed, 0 tests failed out of 11" + "Addon1 .*=.*.* sec[*]proc [(]1 test[)]" + "MixedLang .* =.*.* sec[*]proc [(]1 test[)]" + "SimpleCxx .*=*.* sec[*]proc [(]2 tests[)]" + "WithSubpackages .*=*.* sec[*]proc [(]6 tests[)]" + "WrapExternal .*=*.* sec[*]proc [(]1 test[)]" + "File '' does NOT exist so all tests passed!" + "TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_1 + MESSAGE "Check that base repo has correct remote" + CMND git ARGS remote -v + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "github.*.*github[.]com.tribits/TribitsExampleMetaProject[.]git" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_2 + MESSAGE "Check that base repo is on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*for-testing" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_3 + MESSAGE "Check that one of the extra repos has correct remote" + CMND git ARGS remote -v + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "github.*.*github[.]com.tribits/TribitsExampleProject[.]git" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_4 + MESSAGE "Check that one of the extra repos in on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*for-testing" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_5 + MESSAGE "Check out a retarded non-tracking branch" + CMND "${${PROJECT_NAME}_TRIBITS_DIR}/python_utils/gitdist" + ARGS --dist-no-color + --dist-repos=.,TribitsExampleProject,TribitsExampleProjectAddons + checkout -b non-tracking HEAD^ + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*][*][*] Base Git Repo: TribitsExampleMetaProject" + "Switched to a new branch 'non-tracking'" + "[*][*][*] Git Repo: TribitsExampleProject" + "[*][*][*] Git Repo: TribitsExampleProjectAddons" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_6 + MESSAGE "Check that base repo is on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*non-tracking" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_7 + MESSAGE "Check that one of the extra repos in on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*non-tracking" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_8 + MESSAGE "Remote the generated RepoVersion.txt file" + CMND rm ARGS BUILD/TribitsExMetaProjRepoVersion.txt + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_9 + MESSAGE "Run ctest driver to get back on the 'for-testing' branch" + CMND env + ARGS + CTEST_DASHBOARD_ROOT=PWD + ${COMMON_ENV_ARGS} + CTEST_START_WITH_EMPTY_BINARY_DIRECTORY=FALSE + CTEST_WIPE_CACHE=FALSE + TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE + TribitsExMetaProj_GIT_REPOSITORY_REMOTE=github + TribitsExMetaProj_BRANCH=for-testing + CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_default_branch_remote + ${CTEST_S_SCRIPT_ARGS} + PASS_REGULAR_EXPRESSION_ALL + "-- ENV_TribitsExMetaProj_BRANCH='for-testing'" + "-- TribitsExMetaProj_BRANCH='for-testing'" + "Calling CTEST_UPDATE[(][)] to update base source repo '.*/TriBITS_CTestDriver_TribitsExMetaProj_clone_custom_branch_remote/TribitsExampleMetaProject" + "Old revision of repository is: a8f6f489088537176f0cab2fc189294038963ec4" + "New revision of repository is: 56877b3b3dd06f41dfb27cedcedc2693aafaef03" + "CTEST_UPDATE[(][.][.][.][)] returned '1'" + "cmake -P tribits_ctest_update_commands[.]cmake" + "HEAD is now at a8f6f48 Update README file [(]tribitspub/tribits#278[)]" + "Git Update PASSED!" + "For extra repos, doing switch to branch for-testing" + "TribitsExampleProject: Doing GIT update from URL '.*github[.]com.tribits/TribitsExampleProject[.]git' to dir '.*/TribitsExampleProject' [.][.][.]" + "TribitsExampleProjectAddons: Doing GIT update from URL '.*github.com.tribits/TribitsExampleProjectAddons.git' to dir '.*/TribitsExampleProjectAddons' [.][.][.]" + "CTEST_NOTES_FILES_WO_CACHE='.*/BUILD/Updates.txt[;].*/BUILD/UpdateCommandsOutput.txt'" + "Configure PASSED!" + "CTEST_NOTES_FILES='.*/BUILD/TribitsExMetaProjRepoVersion.txt[;].*/BUILD/Updates.txt[;].*/BUILD/UpdateCommandsOutput.txt[;].*/BUILD/CMakeCache.clean.txt'" + "Build PASSED!" + "100% tests passed, 0 tests failed out of 11" + ALWAYS_FAIL_ON_NONZERO_RETURN + # NOTE: The above use case requires the custom git commands used by + # ctest_update(). The default git commits used inside of ctest_update() + # fail in that use case (see #TRIL-260 for an example). + + TEST_10 + MESSAGE "Check that base repo is on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*for-testing" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_11 + MESSAGE "Check that one of the extra repos in on the correct branch" + CMND git ARGS branch + WORKING_DIRECTORY TribitsExampleMetaProject/TribitsExampleProject + SKIP_CLEAN_WORKING_DIRECTORY + PASS_REGULAR_EXPRESSION_ALL + "[*].*for-testing" + ALWAYS_FAIL_ON_NONZERO_RETURN + + TEST_12 + MESSAGE "Make sure that the file TribitsExMetaProjRepoVersion.txt is correct" + CMND diff ARGS + "${CMAKE_CURRENT_LIST_DIR}/data/TribitsExMetaProjRepoVersion.for-testing.txt" + BUILD/TribitsExMetaProjRepoVersion.txt + ALWAYS_FAIL_ON_NONZERO_RETURN + + # ToDo: Do the update except change the git URLs for the base and extra + # repos and make sure that it resets the git remote URL correctly. (This + # functionality is not implemented yet but it needs to be.) But this will + # fail the update because those remotes don't actually exist (but that is + # okay for the purpose of this test). + + # ToDo: Check the remote name 'github' and git remote URLs and branch name + # 'for-testing' in the cloned repos + + # ToDo: Check the TribitsExMetaProjRepoVersion.txt file + + ) + # The above test checks a few other use cases: + # + # * Initial clone on non-default branch and remote name + # + # * + # + # ??? + # + + + +# ToDo: Add a test that does a bad clone using a bad repo URL for the base repo + + + +# ToDo: Add a test that does a bad clone using a bad bad extra repo branch +# (but an okay base repo branch) + + + + + + + +# ToDo: Define the proper behavior for doing and update where the name +# ${TribitsExMetaProj_GIT_REPOSITORY_REMOTE} does not exist but the git repos +# already exist. What should be the behavior? NOTE: This should likely just +# error out as this should be an invalid use case. If you want to use +# different remote, add it external to the ctest -S script invocation. diff --git a/test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.txt b/test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.txt new file mode 100644 index 000000000..181a0b92a --- /dev/null +++ b/test/ctest_driver/TribitsExampleMetaProject/data/TribitsExMetaProjRepoVersion.for-testing.txt @@ -0,0 +1,9 @@ +*** Base Git Repo: TribitsExMetaProj +56877b3 [Tue Feb 19 09:22:43 2019 -0700] +Update more settings go get automated testing working (#278) +*** Git Repo: TribitsExampleProject +348adfa [Tue Feb 19 06:25:53 2019 -0700] +Update the README file some (tribitspub/tribits#278) +*** Git Repo: TribitsExampleProjectAddons +226a17e [Tue Feb 19 06:33:23 2019 -0700] +Update README file (tribitspub/tribits#278) diff --git a/test/ctest_driver/TribitsExampleProject/CMakeLists.txt b/test/ctest_driver/TribitsExampleProject/CMakeLists.txt index 811ff8c58..871e1fdfd 100644 --- a/test/ctest_driver/TribitsExampleProject/CMakeLists.txt +++ b/test/ctest_driver/TribitsExampleProject/CMakeLists.txt @@ -1052,7 +1052,7 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES) CMND ln ARGS -s ${TribitsExProj_DIR} . TEST_1 - MESSAGE "Run ctest driver testing everyting but no push." + MESSAGE "Run ctest -S driver" CMND env ARGS CTEST_DASHBOARD_ROOT=PWD @@ -1084,6 +1084,25 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES) "File '' does NOT exist so all tests passed" "TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED" ALWAYS_FAIL_ON_NONZERO_RETURN + #TEST_2 + # MESSAGE "Make sure the Note.xml file contains the right contents" + # CMND env + # ARGS + # TRIBITS_PROJECT_NAME=TribitsExProj + # TribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} + # CTEST_BUILD_DIR=BUILD + # "${CMAKE_CURRENT_LIST_DIR}/../list_cdash_notes_files_in_xml_file.sh" + # PASS_REGULAR_EXPRESSION_ALL + # "DUMMY_NO_MATCH" + # ALWAYS_FAIL_ON_NONZERO_RETURN + + # NOTE: Above, we can't actually grep the notes file because the Notes.xml + # file does not get created unless you submit! And the notes files for + # Updates.txt and UpdateCommandsOutput.txt will not get created unless you + # do ctest_update(). Therefore, we will need automated tests that + # actually clone and update repos in order to test the generated Notes.xml + # file. + ) # NOTE: The above test enables just one package with no upstream packages # at all. It should display just a single row on CDash. We can't detect diff --git a/test/ctest_driver/data/dummy_build_dir/Testing/TAG b/test/ctest_driver/data/dummy_build_dir/Testing/TAG new file mode 100644 index 000000000..b0df6bdb8 --- /dev/null +++ b/test/ctest_driver/data/dummy_build_dir/Testing/TAG @@ -0,0 +1,2 @@ +20101015-1112 +My CDash Track diff --git a/test/ctest_driver/list_cdash_notes_files_in_xml_file.sh b/test/ctest_driver/list_cdash_notes_files_in_xml_file.sh new file mode 100755 index 000000000..bd1f39da6 --- /dev/null +++ b/test/ctest_driver/list_cdash_notes_files_in_xml_file.sh @@ -0,0 +1,27 @@ +#!/bin/bash -e + +# +# Prints out a list of the notes files in +# /Testing//Notes.xm +# +# Usage: +# +# env \ +# TRIBITS_PROJECT_NAME= \ +# ${TRIBITS_PROJECT_NAME}_TRIBITS_DIR= \ +# CTEST_BUILD_DIR= \ +# /list_cdash_notes_files_in_xml_file.sh \ +# + +#echo "TRIBITS_PROJECT_NAME=${TRIBITS_PROJECT_NAME}" +TRIBITS_TRIBITS_DIR_NAME=${TRIBITS_PROJECT_NAME}_TRIBITS_DIR +#echo "${TRIBITS_PROJECT_NAME}_TRIBITS_DIR=${!TRIBITS_TRIBITS_DIR_NAME}" +#echo "CTEST_BUILD_DIR=${CTEST_BUILD_DIR}" + +CTEST_TESTING_XML_DIR=`cmake -DPROJECT_NAME=${TRIBITS_PROJECT_NAME} -D${TRIBITS_PROJECT_NAME}_TRIBITS_DIR=${!TRIBITS_TRIBITS_DIR_NAME} -DCTEST_BUILD_DIR=${CTEST_BUILD_DIR} -P ${!TRIBITS_TRIBITS_DIR_NAME}/ctest_driver/TribitsGetCTestTestXmlDir.cmake 2>&1` + +echo "CTEST_TESTING_XML_DIR=$CTEST_TESTING_XML_DIR" + +CTEST_NOTES_FILE="${CTEST_TESTING_XML_DIR}/Notes.xml" + +grep "``. # # The root directory to an existing source tree where the project's # `/ProjectName.cmake`_ (defining the ``PROJECT_NAME`` @@ -477,7 +479,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # default and env override is set for this during the INCLUDE() of the # module ``TribitsCTestDriverCore.cmake``. # -# ``${PROJECT_NAME}_TRIBITS_DIR`` +# ``${PROJECT_NAME}_TRIBITS_DIR=`` # # The base directory for the TriBITS system's various CMake modules, # python scripts, and other files. By default this is assumed to be @@ -488,7 +490,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DASHBOARD_ROOT: # -# ``CTEST_DASHBOARD_ROOT`` +# ``CTEST_DASHBOARD_ROOT=`` # # 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 @@ -499,7 +501,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_SOURCE_NAME: # -# ``CTEST_SOURCE_NAME`` +# ``CTEST_SOURCE_NAME=`` # # The name of the source directory. This can be SET() in the CTest -S # script before the call to ``TRIBITS_CTEST_DRIVER()`` or overridden as an @@ -507,7 +509,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_SOURCE_DIRECTORY: # -# ``CTEST_SOURCE_DIRECTORY`` +# ``CTEST_SOURCE_DIRECTORY=`` # # Built-in CTest variable that determines the location of the sources that # are used to define packages, dependencies and configure, build, and test @@ -526,7 +528,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_BINARY_DIRECTORY: # -# ``CTEST_BINARY_DIRECTORY`` +# ``CTEST_BINARY_DIRECTORY=`` # # Built-in CTest variable that determines the location of the binary tree # where output from CMake/CTest is put. This is used to set to @@ -551,7 +553,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _${PROJECT_NAME}_PACKAGES: # -# ``${PROJECT_NAME}_PACKAGES`` +# ``${PROJECT_NAME}_PACKAGES=,,...`` # # A semi-colon ';' or comma ',' separated list of packages that determines # the specific set of packages to test. If left at the default value of @@ -562,7 +564,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _${PROJECT_NAME}_ADDITIONAL_PACKAGES: # -# ``${PROJECT_NAME}_ADDITIONAL_PACKAGES`` +# ``${PROJECT_NAME}_ADDITIONAL_PACKAGES=,,...`` # # If ``${PROJECT_NAME}_PACKAGES`` is empty (and therefore # ``${PROJECT_NAME}_ENABLE_ALL_PACKAGES=ON`` is set), then additional @@ -575,7 +577,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES: # -# ``${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES`` +# ``${PROJECT_NAME}_ENABLE_ALL_FORWARD_DEP_PACKAGES=[TRUE|FALSE]`` # # If set to ``TRUE``, then all of the downstream packages from those # specified in ``${PROJECT_NAME}_PACKAGES`` will be enabled (see @@ -584,7 +586,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # ``CTEST_ENABLE_MODIFIED_PACKAGES_ONLY=TRUE`` is set in which case the # default value is ``TRUE``. # -# ``${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE`` +# ``${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE=[TRUE|FALSE]`` # # If set to ``TRUE``, then ST packages will get enabled in automated logic # in the outer determination of what packages to get tested. This value @@ -593,7 +595,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _${PROJECT_NAME}_EXCLUDE_PACKAGES: # -# ``${PROJECT_NAME}_EXCLUDE_PACKAGES`` +# ``${PROJECT_NAME}_EXCLUDE_PACKAGES=,,...`` # # A semi-colon ';' or comma ',' separated list of packages **NOT** to # enable when determining the set of packages to be tested. NOTE: Listing @@ -603,7 +605,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # in your driver script). But for the all-at-once approach this list of # package disables **IS** pass into the inner configure. # -# ``${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES`` +# ``${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=[TRUE|FALSE]`` # # If set to ``ON`` (or ``TRUE``), then if there are conflicts between # explicit enables and disables then explicit disables will override the @@ -613,7 +615,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES: # -# ``CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES`` +# ``CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES=[TRUE|FALSE]`` # # If set to ``TRUE``, then all of the upstream packages for those selected # to be explicitly tested will be processed with results posted to CDash. @@ -637,7 +639,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_ENABLE_MODIFIED_PACKAGES_ONLY: # -# ``CTEST_ENABLE_MODIFIED_PACKAGES_ONLY`` +# ``CTEST_ENABLE_MODIFIED_PACKAGES_ONLY=[TRUE|FALSE]`` # # 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 @@ -761,7 +763,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_NEW_START: # -# ``CTEST_DO_NEW_START`` +# ``CTEST_DO_NEW_START=[TRUE|FALSE]`` # # If ``TRUE``, ``ctest_start()`` is called to set up a new "dashboard" # (i.e. define a new CDash build with a unique Build Stamp defined in the @@ -769,7 +771,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # is called which allows it this ctest -S invocation to append results to # an existing CDash build. (See ???). Default ``TRUE``. # -# ``CTEST_DO_UPDATES`` +# ``CTEST_DO_UPDATES=[TRUE|FALSE]`` # # If ``TRUE``, then the source repos will be updated as specified in # `Repository Updates (TRIBITS_CTEST_DRIVER())`_. Default ``TRUE``. @@ -784,7 +786,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_START_WITH_EMPTY_BINARY_DIRECTORY: # -# ``CTEST_START_WITH_EMPTY_BINARY_DIRECTORY`` +# ``CTEST_START_WITH_EMPTY_BINARY_DIRECTORY=[TRUE|FALSE]`` # # If ``TRUE``, then if the binary directory ``${CTEST_BINARY_DIRECTORY}`` # already exists, then it will be clean out using the CTest command @@ -796,7 +798,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_CONFIGURE: # -# ``CTEST_DO_CONFIGURE`` +# ``CTEST_DO_CONFIGURE=[TRUE|FALSE]`` # # If ``TRUE``, then the selected packages will be configured. If # ``FALSE``, it is assumed that a relavent configure is already in place @@ -807,7 +809,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_WIPE_CACHE: # -# ``CTEST_WIPE_CACHE`` +# ``CTEST_WIPE_CACHE=[TRUE|FALSE]`` # # If ``TRUE``, then ``${CTEST_BINARY_DIRECTORY}/CMakeCache.txt`` and # ``${CTEST_BINARY_DIRECTORY}/CMakeFiles/`` will be deleted before @@ -817,7 +819,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_BUILD: # -# ``CTEST_DO_BUILD`` +# ``CTEST_DO_BUILD=[TRUE|FALSE]`` # # If ``TRUE``, then the selected packages will be build. If ``FALSE``, it # is assumed that a relavent build is already in place in the binary @@ -840,7 +842,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_INSTALL: # -# ``CTEST_DO_INSTALL`` +# ``CTEST_DO_INSTALL=[TRUE|FALSE]`` # # If ``TRUE``, then the 'install' target will be built to install what has # been configured and built by the build step for the all-at-once mode @@ -854,7 +856,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_TEST: # -# ``CTEST_DO_TEST`` +# ``CTEST_DO_TEST=[TRUE|FALSE]`` # # If ``TRUE``, then ``CTEST_TEST()`` will be called and test results will # be submitted to CDash. This should be set to ``FALSE`` when one wanted @@ -864,7 +866,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_PARALLEL_LEVEL: # -# ``CTEST_PARALLEL_LEVEL`` +# ``CTEST_PARALLEL_LEVEL=`` # # The parallel level passed in the ``PARALLEL_LEVEL`` argument to # ``CTEST_TEST()`` AND ``CTEST_MEMCHECK()``. The default value is ``1`` @@ -872,7 +874,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_COVERAGE_TESTING: # -# ``CTEST_DO_COVERAGE_TESTING`` +# ``CTEST_DO_COVERAGE_TESTING=[TRUE|FALSE]`` # # If ``TRUE``, then ``CTEST_COVERAGE()`` is called to collect coverage and # submit results generated from the previous ``CTEST_TEST()`` command. @@ -892,7 +894,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_MEMORY_TESTING: # -# ``CTEST_DO_MEMORY_TESTING`` +# ``CTEST_DO_MEMORY_TESTING=[TRUE|FALSE]`` # # If ``TRUE``, then ``CTEST_MEMCHECK()`` is called to run the test suite # with the memory checking tool and results submitted to CDash. @@ -916,7 +918,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_GENERATE_OUTER_DEPS_XML_OUTPUT_FILE: # -# ``CTEST_GENERATE_OUTER_DEPS_XML_OUTPUT_FILE`` +# ``CTEST_GENERATE_OUTER_DEPS_XML_OUTPUT_FILE=[TRUE|FALSE]`` # # If ``TRUE``, then ``PackageDependencies.xml`` file will be # generated in the outer CTest -S program. This file is used to help @@ -929,7 +931,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_SUBMIT_CDASH_SUBPROJECTS_DEPS_FILE: # -# ``CTEST_SUBMIT_CDASH_SUBPROJECTS_DEPS_FILE`` +# ``CTEST_SUBMIT_CDASH_SUBPROJECTS_DEPS_FILE=[TRUE|FALSE]`` # # If ``TRUE``, then CDash subprojects XML file is generated and submitted # to CDash. This file tells CDash about the subproject (i.e. TriBITS @@ -937,7 +939,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_DO_SUBMIT: # -# ``CTEST_DO_SUBMIT`` +# ``CTEST_DO_SUBMIT=[TRUE|FALSE]`` # # If ``TRUE``, then all of the results generated locally are submitted to # CDash using ``CTEST_SUBMIT()``. One can set this to ``FALSE`` when @@ -958,7 +960,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_TEST_TYPE: # -# ``CTEST_TEST_TYPE`` +# ``CTEST_TEST_TYPE=[Nightly|Continuous|Experimental]`` # # Determines the type of build. This value is passed in as the first # argument to the built-in CTest function ``CTEST_START()``. Valid values @@ -970,7 +972,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _${PROJECT_NAME}_TESTING_TRACK: # -# ``${PROJECT_NAME}_TESTING_TRACK`` +# ``${PROJECT_NAME}_TESTING_TRACK=`` # # Specifies the testing track on CDash for which results are displayed # under (i.e. the "Group" filter field on CDash). This is the value used @@ -982,7 +984,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_SITE: # -# ``CTEST_SITE`` +# ``CTEST_SITE=`` # # This is a built-in CTest variable that determines what is displayed for # the ``site`` field for the build on CDash. This specified by default by @@ -990,7 +992,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _COMPILER_VERSION: # -# ``COMPILER_VERSION`` +# ``COMPILER_VERSION=`` # # Gives the name of the compiler that is used to compose a default # `CTEST_BUILD_NAME`_. If ``CTEST_BUILD_NAME`` is explicitly set, then @@ -998,7 +1000,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_BUILD_NAME: # -# ``CTEST_BUILD_NAME`` +# ``CTEST_BUILD_NAME=`` # # This is a built-in CTest variable that determines the name of the build # on CDash. Builds that have the same ``CTEST_SITE``, @@ -1012,6 +1014,20 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # ``BUILD_DIR_NAME`` is expected to be set in each specific CTest -S # driver script. # +# .. _CTEST_NOTES_FILES: +# +# ``CTEST_NOTES_FILES=";;..."`` +# +# Built-in CTest variable that specifies a semi-colon seprated list of +# files that will get uploaded to CDash as "notes files". This function +# will also add other files as notes files as well such as the file +# ``CMakeCache.clean.txt`` (cleaned-up version of the CMakeCache.txt +# file), the file ``Updates.txt`` (lists new git commits pulled in all the +# git repos), the file ``UpdateCommandsOutput.txt`` (list of commands and +# their output which are run by ``ctest_update()`` in the base git repo), +# and the file ``${PROJECT_NAME}RepoVersion.txt`` (gives version of all +# the git repos being tested). +# # .. _Specifying where the results go to CDash (TRIBITS_CTEST_DRIVER()): # # **Specifying where the results go to CDash (TRIBITS_CTEST_DRIVER()):** @@ -1049,7 +1065,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # repos is determined using the following vars (which can be set in the CTest # -S script or overridden with env vars of the same name): # -# ``${PROJECT_NAME}_EXTRAREPOS_FILE`` +# ``${PROJECT_NAME}_EXTRAREPOS_FILE=`` # # Points to a file that lists the extra VC and TriBITS repos. If not # explicitly set, then by default it will read from the file @@ -1058,19 +1074,19 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # ``ProjectName.cmake`` file in which case no extra repos file is read in. # See `_EXTRAREPOS_FILE`_. # -# ``${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE`` +# ``${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=[Nightly|Continuous|Experimental]`` # # The category of extra repos to process from the file # ``${PROJECT_NAME}_EXTRAREPOS_FILE`` (see # `_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE`_). # -# ``${PROJECT_NAME}_PRE_REPOSITORIES`` +# ``${PROJECT_NAME}_PRE_REPOSITORIES=,,...`` # # Subset of "pre" extra repos specified in the file # ``${PROJECT_NAME}_EXTRAREPOS_FILE`` to process (see # `_PRE_REPOSITORIES`_). # -# ``${PROJECT_NAME}_EXTRA_REPOSITORIES`` +# ``${PROJECT_NAME}_EXTRA_REPOSITORIES=,,...`` # # Subset of "post" extra repos specified in the file # ``${PROJECT_NAME}_EXTRAREPOS_FILE`` to process (see @@ -1090,7 +1106,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # package-by-package, based on the vars (which can be set in the CTest -S # script and overridden by env vars): # -# ``${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE`` +# ``${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE=[TRUE|FALSE]`` # # If ``TRUE``, then single calls to ``CTEST_CONFIGURE()``, # ``CTEST_BUILD()`` and ``CTEST_TEST()`` are made for all of the packages @@ -1166,108 +1182,145 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # **Repository Updates (TRIBITS_CTEST_DRIVER()):** # # Like the rest of TriBITS, ``ctest -S`` scripts written using this function -# supports a collection of extra repositories in addition to the base git -# repository. The basic clone and update of the extra repositories requires -# all repos to use the git version control system. +# support a collection of extra repositories in addition to the base git +# repository. # -# Whether the repos are updated (or left as is) is determined by the var: +# Whether the local repos are updated (or left as is) is determined by the +# variable: # # .. _CTEST_DO_UPDATES: # -# ``CTEST_DO_UPDATES`` +# ``CTEST_DO_UPDATES=[TRUE|FALSE]`` # # If set to ``TRUE``, then each of the git repos will be cloned if they do -# not already exist at `CTEST_SOURCE_DIRECTORY` and if already present will -# be updated as described below (and will wipe out any local changes). If -# set to ``FALSE``, then the git repos will be left alone and must -# therefore already be cloned and updated at the desired state. For -# example, this should be set to ``FALSE`` when running against a local -# development repo (e.g. the `make dashboard`_ target sets this to -# ``FALSE`` automatically) or when other logic is used to setup the source -# directories. **WARNING:** If you are running against a local repo with -# local changes and you don't set to ``FALSE``, then your local uncommitted -# changes will be wiped out and the local branch will be hard reset to the -# remote tracking branch! The default value is ``TRUE``. +# not already exist and if already present will be updated as described +# below (and will wipe out any local changes). If set to ``FALSE``, then +# the git repos will be left alone and must therefore already be cloned and +# updated at the desired state. For example, this should be set to +# ``FALSE`` when running against a local development repo (e.g. the `make +# dashboard`_ target sets this to ``FALSE`` automatically) or when other +# logic is used to setup the source directories. **WARNING:** If you are +# running against a local repo with local changes and you don't set to +# ``FALSE``, then your local uncommitted changes will be wiped out and the +# local branch will be hard reset to the remote tracking branch! The +# default value is ``TRUE``. # # **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 repo that is cloned is -# determined by: +# If the base repo pointed to by ``${CTEST_SOURCE_DIRECTORY}`` is missing, it +# cloned inside of the ``CTEST_START()`` function using the custom command:: +# +# git clone [-b ${${PROJECT_NAME}_BRANCH}] \ +# -o ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} \ +# ${${PROJECT_NAME}_REPOSITORY_LOCATION} +# +# where: # # .. _${PROJECT_NAME}_REPOSITORY_LOCATION: # -# ``${PROJECT_NAME}_REPOSITORY_LOCATION`` +# ``${PROJECT_NAME}_REPOSITORY_LOCATION=`` # -# The location of the base git repo to clone inside of ``CTEST_START()``. -# The default is +# The URL of the base git repo ```` to clone inside of +# ``CTEST_START()``. The default is # ``${${PROJECT_NAME}_REPOSITORY_LOCATION_NIGHTLY_DEFAULT}`` when # ``CTEST_TEST_TYPE=Nightly`` and otherwise the default is # ``${${PROJECT_NAME}_REPOSITORY_LOCATION_DEFAULT}``. # -# The cloning of the extra git repositories are completely handled by the -# CMake/CTest code in this ``TRIBITS_CTEST_DRIVER()`` function as described -# below. +# .. _${PROJECT_NAME}_GIT_REPOSITORY_REMOTE: # -# After the base repository is cloned for the first time (by calling -# ``CTEST_UPDATE()``), the extra repositories are cloned using the following -# command:: +# ``${PROJECT_NAME}_GIT_REPOSITORY_REMOTE=`` # -# git clone -# -# where ```` is given in the -# ``${PROJECT_NAME}_EXTRAREPOS_FILE`` file. -# -# 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 according to their set up remote -# tracking branch. +# The git remote name given to the cloned repo. This is needed for robust +# git operations as described below (Default 'origin'). If a repo is +# already cloned, then a remote in the already existing repo must exist +# with this name or # -# However the branches of the code tested can be explicitly set using the -# vars: +# .. _${PROJECT_NAME}_BRANCH: # -# ``${PROJECT_NAME}_BRANCH`` +# ``${PROJECT_NAME}_BRANCH=`` # # The branch of the base repo to explicitly checkout after clone (and on -# each update). The default is -# ``${${PROJECT_NAME}_REPOSITORY_BRANCH}}``. +# each update). The value of empty "" is allowed which results in the +# default branch being checked out on clone (and the ``-b `` +# argument to be omitted from the ``git clone`` command). The default +# value determined by the variable +# ``${${PROJECT_NAME}_REPOSITORY_BRANCH}}``. The default value for +# ``${PROJECT_NAME}_REPOSITORY_BRANCH`` is empty. # -# ``${PROJECT_NAME}_REPOSITORY_BRANCH`` +# If the base repo already exists, no initial clone is performed and it is +# assumed that it is in a state to allow it to be updated as described below. # -# Defines the default for ``${PROJECT_NAME}_BRANCH``. This must be set in -# the CTest -S script (e.g. in the ``/CTestConfig.cmake`` -# file). The default if not otherwise specified is empty "". +# After the base repo is cloned, any missing extra git repositories are cloned +# using CMake/CTest code in this ``TRIBITS_CTEST_DRIVER()`` function (raw +# CTest does not support cloning a list of extra repos) using the command:: # -# ``${PROJECT_NAME}_EXTRAREPOS_BRANCH`` +# git clone [-b ${${PROJECT_NAME}_EXTRAREPO_BRANCH}] \ +# -o ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} \ +# # -# The branch that each extra VC repo that is checked out. The default -# value is set to ``${${PROJECT_NAME}_BRANCH}``. (NOTE: Checking out a -# separate branch on the extra repos from the base repo was needed for -# backward compatibility for the Trilinos project but this is not -# recommended usage and it violates the "single branch" approach for using -# `gitdist`_.) +# where: # -# 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 is performed in the call to ``CTEST_UPDATE()``, then that -# branch is checked out using the command:: +# .. _${PROJECT_NAME}_EXTRAREPOS_BRANCH: # +# ``${PROJECT_NAME}_EXTRAREPOS_BRANCH=`` +# +# The branch ```` that each extra VC repo that is +# checked out. The default value is set to ``${${PROJECT_NAME}_BRANCH}``. +# If empty "", then the ``-b `` argument is omitted from the ``git +# clone`` command. (NOTE: Checking out a separate branch on the extra +# repos from the base repo was needed for backward compatibility for the +# Trilinos project and is not recommended usage as it violates the "single +# branch" approach for using `gitdist`_.) +# +# ```` +# +# The git repo remote URL given in the file +# `${PROJECT_NAME}_EXTRAREPOS_FILE`_. +# +# When ``CTEST_DO_UPDATES=TRUE`` (after a possible initial clone), the +# function ``CTEST_UPDATE()`` is called to update the base git repo. The base +# git repo is updated with the custom git commands executed inside of the +# ``CTEST_UPDATE()`` using:: +# +# $ git fetch ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} +# $ git clean -fdx # Remove untracked ignored files +# $ git reset --hard HEAD # Clean files and set ORIG_HEAD to HEAD # $ git checkout -B ${${PROJECT_NAME}_BRANCH} \ -# --track origin/${${PROJECT_NAME}_BRANCH}` +# --track origin/${${PROJECT_NAME}_BRANCH} # Sets HEAD +# +# The above set of commands are the maximally robust way to update a git repo. +# They will correct any local state of the local repo and will put the local +# repo on the requested local tracking branch. It can handled hard-reset +# remote branches, previous tracking branch now missing, etc. The only +# requirement is that the remote repo pointed to at +# ``${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE}`` is valid and has not changed +# since the repo was first cloned. (NOTE: A future version of TriBITS may +# automate the update of this git remote.) # -# That command is robust and will pass even if the current branch is already a -# tracking branch for ``origin/${${PROJECT_NAME}_BRANCH}``. **WARNING:** This -# version of the ``git checkout -B``` command is not supported in older -# versions of git. +# If ``${PROJECT_NAME}_BRANCH`` is empty "", the last ``git checkout -B +# ...`` command is replaced with the git command:: # -# If ``${PROJECT_NAME}_EXTRAREPO_BRANCH`` is empty, then each extra repository -# is updated (even after the initial clone) using the commands:: +# $ git reset --hard @{u} # Sets HEAD # +# After the base git repo is updated inside of ``CTEST_UPDATE()`` as described +# above, each of the extra repos is updated using a similar set of git +# commands:: +# +# $ git fetch ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} # $ git clean -fdx # Remove untracked ignored files -# $ git reset --hard HEAD # Removed untracked and modified tracked files -# $ git fetch origin # Get updated commits -# $ git reset --hard @{u} # Deal with forced push +# $ git reset --hard HEAD # Clean files and set ORIG_HEAD to HEAD +# $ git checkout -B ${${PROJECT_NAME}_EXTRAREPO_BRANCH} \ +# --track origin/${${PROJECT_NAME}_EXTRAREPO_BRANCH} # Sets HEAD +# +# where if ``${PROJECT_NAME}_EXTRAREPO_BRANCH`` is empty, the last ``git +# checkout -B ...`` command replaced with:: +# +# $ git reset --hard @{u} +# +# **WARNING:** This version of the ``git checkout -B ...`` command +# is not supported in older versions of git. Therefore, a newer version of +# git is required when using named branches. # # 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 @@ -1275,34 +1328,14 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # 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 (which is needed since ``ORIG_HEAD`` -# is not set after the initial ``git clone``). This allows using the range -# ``ORIG_HEAD..HEAD`` with git diff and log commands even after the initial -# clone. The ``git fetch`` command followed by the ``git reset --hard @{u}`` -# command are used to update the local repo to match the remote tracking -# branch instead of ``git pull` or ``git fetch ; git merge @{u}``. This is -# done to deal with a possible forced push of the remote tracking branch. -# Using ``git fetch ; git reset --hard @{u}`` ensures that the local branch is -# exactly the same the remote tracking branch no matter what. -# -# If ``${PROJECT_NAME}_EXTRAREPO_BRANCH`` is non-empty, then each extra -# repository is updated (even after the initial clone) using the commands:: -# -# $ git clean -fdx # Remove untracked ignored files -# $ git reset --hard HEAD # Clean files and set ORIG_HEAD to HEAD -# $ git fetch origin # Get updated commits -# $ git checkout -B ${${PROJECT_NAME}_EXTRAREPO_BRANCH} \ -# --track origin/${${PROJECT_NAME}_EXTRAREPO_BRANCH} # Put on tracking branch -# -# These are the same commands as for the case where -# ``${PROJECT_NAME}_EXTRAREPO_BRANCH`` is empty except for the last command -# which does a checkout of the tracking branch -# ``${PROJECT_NAME}_EXTRAREPO_BRANCH``. In this case, the ``git reset --hard -# HEAD`` serves an additional purpose. It sets ``ORIG_HEAD`` to the current -# ``HEAD`` before the update of the branch. This is important because the -# command ``git checkout -B ...`` does not move ``ORIG_HEAD`` so this reset is -# needed so that the git range ``ORIG_HEAD..HEAD`` gives the changes since the -# last update. So for an update where no new commits are pulled, -# ``ORIG_HEAD..HEAD`` will return no commits. +# is not set after the initial ``git clone`` command). This allows using the +# range ``ORIG_HEAD..HEAD`` with ``git diff`` and ``git log`` commands even +# after the initial clone. (Directly after the initial clone, the range +# ``ORIG_HEAD..HEAD`` will be empty). The git commands ``git checkout -B +# /`` or ``git reset --hard @{u}`` are used to update +# the local repo to match the remote tracking branch. This is done to deal +# with a possible forced push of the remote tracking branch or even changing +# to different tracking branch (when using an explicit ```` name). # # Note that the repository updating approach described above using non-empty # ``${PROJECT_NAME}_BRANCH`` is more robust, because it can recover from a @@ -1310,9 +1343,10 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # 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 +# tracking branch. Therefore, it is recommended to always set an explicit # ``${PROJECT_NAME}_BRANCH`` to a non-null value like ``master`` or -# ``develop`` for the git repos. +# ``develop`` for the git repos, even if this branch is the default repo +# branch. # # .. _Other CTest Driver options (TRIBITS_CTEST_DRIVER()): # @@ -1323,7 +1357,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # # .. _CTEST_CMAKE_GENERATOR: # -# ``CTEST_CMAKE_GENERATOR`` +# ``CTEST_CMAKE_GENERATOR="[Unix Makefiles|Ninja|..]"`` # # Built-in CTest variable that determines the CMake generator used in the # inner configure. If an existing ``CMakeCache.txt`` file exists, then @@ -1336,7 +1370,7 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # what flags can be used in `CTEST_BUILD_FLAGS`_ since ``make`` and # ``ninja`` accept different arguments in some cases. # -# ``${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE`` +# ``${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE=[TRUE|FALSE]`` # # Puts TriBITS configure into development mode (vs. release mode) in the # outer CTest -S script. The default is provided by @@ -1344,12 +1378,12 @@ INCLUDE(${CMAKE_CURRENT_LIST_DIR}/TribitsCTestDriverCoreHelpers.cmake) # typically set in the `/Version.cmake`_ file). See # `_ENABLE_DEVELOPMENT_MODE`_. # -# ``${PROJECT_NAME}_VERBOSE_CONFIGURE`` +# ``${PROJECT_NAME}_VERBOSE_CONFIGURE=[TRUE|FALSE]`` # # Make TriBITS run in verbose mode. (Useful for debugging hard problems.) # See `_VERBOSE_CONFIGURE`_. # -# ``CTEST_CONFIGURATION_UNIT_TESTING`` +# ``CTEST_CONFIGURATION_UNIT_TESTING=[TRUE|FALSE]`` # # If set to ``TRUE``, then ``TRIBITS_CTEST_DRIVER()`` is put in unit # testing mode and does not actually drive configure, build, test, and @@ -1444,6 +1478,10 @@ FUNCTION(TRIBITS_CTEST_DRIVER) # Remove an existing CMakeCache.txt file or not SET_DEFAULT_AND_FROM_ENV( CTEST_WIPE_CACHE TRUE ) + # Extra notes files suggested by user + SET_DEFAULT_AND_FROM_ENV( CTEST_NOTES_FILES "" ) + SET(CTEST_NOTES_FILES_INPUT_BY_USER "${CTEST_NOTES_FILES}") + # Select a default generator. SELECT_DEFAULT_GENERATOR() SET_DEFAULT_AND_FROM_ENV( CTEST_CMAKE_GENERATOR ${DEFAULT_GENERATOR}) @@ -1559,6 +1597,16 @@ FUNCTION(TRIBITS_CTEST_DRIVER) STRING(REPLACE "," ";" ${PROJECT_NAME}_EXCLUDE_PACKAGES "${${PROJECT_NAME}_EXCLUDE_PACKAGES}" ) + IF(CTEST_TEST_TYPE STREQUAL "Nightly") + SET_DEFAULT_AND_FROM_ENV(${PROJECT_NAME}_REPOSITORY_LOCATION + "${${PROJECT_NAME}_REPOSITORY_LOCATION_NIGHTLY_DEFAULT}") + ELSE() + SET_DEFAULT_AND_FROM_ENV(${PROJECT_NAME}_REPOSITORY_LOCATION + "${${PROJECT_NAME}_REPOSITORY_LOCATION_DEFAULT}") + ENDIF() + + SET_DEFAULT_AND_FROM_ENV( ${PROJECT_NAME}_GIT_REPOSITORY_REMOTE "origin" ) + IF(${PROJECT_NAME}_REPOSITORY_BRANCH) SET(${PROJECT_NAME}_BRANCH_DEFAULT ${${PROJECT_NAME}_REPOSITORY_BRANCH}) ELSE() @@ -1570,14 +1618,6 @@ FUNCTION(TRIBITS_CTEST_DRIVER) SET_DEFAULT_AND_FROM_ENV( ${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE "${${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT}" ) - IF(CTEST_TEST_TYPE STREQUAL "Nightly") - SET_DEFAULT_AND_FROM_ENV(${PROJECT_NAME}_REPOSITORY_LOCATION - "${${PROJECT_NAME}_REPOSITORY_LOCATION_NIGHTLY_DEFAULT}") - ELSE() - SET_DEFAULT_AND_FROM_ENV(${PROJECT_NAME}_REPOSITORY_LOCATION - "${${PROJECT_NAME}_REPOSITORY_LOCATION_DEFAULT}") - ENDIF() - # Select the ${PROJECT_NAME} packages to enable (empty means to select all # available). This will override any disabled packages but not those # disabled by ${PROJECT_NAME}_EXCLUDE_PACKAGES. @@ -1747,24 +1787,64 @@ FUNCTION(TRIBITS_CTEST_DRIVER) SET(CREATE_VC_UPDATE_FILE FALSE) + SET(CTEST_UPDATE_COMMANDS_OUTPUT_FILE + "${CTEST_BINARY_DIRECTORY}/UpdateCommandsOutput.txt") + IF (CTEST_DO_UPDATES) SET(UPDATE_TYPE "git") MESSAGE("UPDATE_TYPE = '${UPDATE_TYPE}'") - SET(CTEST_UPDATE_COMMAND "${GIT_EXE}") - MESSAGE("CTEST_UPDATE_COMMAND='${CTEST_UPDATE_COMMAND}'") + # + # Set the initial clone command for if the local repo is missing + # + + IF (${PROJECT_NAME}_BRANCH) + SET(CHECKOUT_BRANCH_ARG "-b ${${PROJECT_NAME}_BRANCH} ") + ELSE() + SET(CHECKOUT_BRANCH_ARG) + ENDIF() + + SET( _CTEST_CHECKOUT_COMMAND + "\"${GIT_EXE}\" clone ${CHECKOUT_BRANCH_ARG}-o ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} ${CTEST_UPDATE_ARGS} ${${PROJECT_NAME}_REPOSITORY_LOCATION}" ) + MESSAGE("CTEST_CHECKOUT_COMMAND=${_CTEST_CHECKOUT_COMMAND}") IF(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}") MESSAGE("${CTEST_SOURCE_DIRECTORY} does not exist so setting up for an initial checkout") - SET( CTEST_CHECKOUT_COMMAND - "\"${GIT_EXE}\" clone ${CTEST_UPDATE_ARGS} ${${PROJECT_NAME}_REPOSITORY_LOCATION}" ) - MESSAGE("CTEST_CHECKOUT_COMMAND='${CTEST_CHECKOUT_COMMAND}'") + SET( CTEST_CHECKOUT_COMMAND "${_CTEST_CHECKOUT_COMMAND}") + # NOTE: Just to be safe, only set CTEST_CHECKOUT_COMMAND to do a clone + # if the repo does not already exist! ELSE() MESSAGE("${CTEST_SOURCE_DIRECTORY} exists so skipping the initial checkout.") SET(CREATE_VC_UPDATE_FILE TRUE) ENDIF() + # + # Set the git update command for an already cloned repo + # + + # CTest always needs the raw git command in order to do stuff like get the + # version of the repo before and after the update, even if you provide a + # custom update command. + SET(CTEST_GIT_COMMAND "${GIT_EXE}") + MESSAGE("CTEST_GIT_COMMAND=${CTEST_GIT_COMMAND}") + # NOTE: You can't put the above command "${GIT_EXE}" in quotes like + # "'${GIT_EXE}'" or "\"${GIT_EXE}\"" or it will not work and + # ctest_update() will return failed! + + # Provide a custom command to do the update + + SET(CTEST_GIT_UPDATE_CUSTOM + "${CMAKE_COMMAND}" + -DGIT_EXE=${GIT_EXE} + -DREMOTE_NAME=${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} + -DBRANCH=${${PROJECT_NAME}_BRANCH} + -DUNIT_TEST_MODE=${CTEST_DEPENDENCY_HANDLING_UNIT_TESTING} + -DOUTPUT_FILE=${CTEST_UPDATE_COMMANDS_OUTPUT_FILE} + -P ${THIS_CMAKE_CURRENT_LIST_DIR}/tribits_ctest_update_commands_wrapper.cmake + ) + MESSAGE("CTEST_GIT_UPDATE_CUSTOM=${CTEST_GIT_UPDATE_CUSTOM}") + ENDIF() # @@ -1888,9 +1968,21 @@ FUNCTION(TRIBITS_CTEST_DRIVER) MESSAGE("\nCalling CTEST_UPDATE() to update base source repo '${CTEST_SOURCE_DIRECTORY}' ...") CTEST_UPDATE_WRAPPER( SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE CTEST_UPDATE_RETURN_VAL) - MESSAGE("CTEST_UPDATE(...) returned '${CTEST_UPDATE_RETURN_VAL}'") + MESSAGE("CTEST_UPDATE(...) returned '${CTEST_UPDATE_RETURN_VAL}' [ rtn >= 0: num files; rnt == -1: error ]") + + IF ("${UPDATE_FAILED}" STREQUAL "-1") + SET(UPDATE_FAILED TRUE) + ENDIF() + + # Print the output from the git commands called in ctest_update() + IF (EXISTS "${CTEST_UPDATE_COMMANDS_OUTPUT_FILE}") + FILE(READ "${CTEST_UPDATE_COMMANDS_OUTPUT_FILE}" CTEST_UPDATE_COMMANDS_OUTPUT_STR) + MESSAGE("\n------------------------------------------------------------------------") + MESSAGE("${CTEST_UPDATE_COMMANDS_OUTPUT_STR}") + MESSAGE("------------------------------------------------------------------------\n") + ENDIF() - TRIBITS_CLONE_OR_UPDATE_ALL_REPOS(${CTEST_UPDATE_RETURN_VAL} LOC_UPDATE_FAILED) + TRIBITS_CLONE_OR_UPDATE_EXTRA_REPOS(${CTEST_UPDATE_RETURN_VAL} LOC_UPDATE_FAILED) IF (LOC_UPDATE_FAILED) SET(UPDATE_FAILED TRUE) ENDIF() @@ -2027,12 +2119,28 @@ FUNCTION(TRIBITS_CTEST_DRIVER) "\n***\n" ) - IF (EXISTS ${CTEST_BINARY_DIRECTORY}/Updates.txt) - SET(CTEST_NOTES_FILES_WO_CACHE - "${CTEST_BINARY_DIRECTORY}/Updates.txt;${CTEST_NOTES_FILES}") - ELSE() - SET(CTEST_NOTES_FILES_WO_CACHE "${CTEST_NOTES_FILES}") + # Set up a list of notes files that don't include the CMakeCache.clean.txt + # file which will change for every submit in the package-by-package modee. + + SET(CTEST_NOTES_FILES_WO_CACHE) + + SET(REPO_VERSION_FILE "${CTEST_BINARY_DIRECTORY}/${PROJECT_NAME}RepoVersion.txt") + + SET(MULTIREPO_GIT_UPDATES_FILE "${CTEST_BINARY_DIRECTORY}/Updates.txt" ) + IF (EXISTS "${MULTIREPO_GIT_UPDATES_FILE}") + LIST(APPEND CTEST_NOTES_FILES_WO_CACHE "${MULTIREPO_GIT_UPDATES_FILE}") + ENDIF() + + IF (EXISTS "${CTEST_UPDATE_COMMANDS_OUTPUT_FILE}") + LIST(APPEND CTEST_NOTES_FILES_WO_CACHE "${CTEST_UPDATE_COMMANDS_OUTPUT_FILE}" ) + ENDIF() + + # Tack on any notes files that the client might have set to the end of these + print_var(CTEST_NOTES_FILES_INPUT_BY_USER) + IF (NOT "${CTEST_NOTES_FILES_INPUT_BY_USER}" STREQUAL "") + LIST(APPEND CTEST_NOTES_FILES_WO_CACHE "${CTEST_NOTES_FILES_INPUT_BY_USER}") ENDIF() + PRINT_VAR(CTEST_NOTES_FILES_WO_CACHE) # Note: We must only do the submit after we have decided if there are any @@ -2041,6 +2149,7 @@ FUNCTION(TRIBITS_CTEST_DRIVER) IF (UPDATE_FAILED) MESSAGE("The VC update failed so submitting update and stopping ...") IF (CTEST_DO_SUBMIT) + SET(CTEST_NOTES_FILES "${CTEST_NOTES_FILES_WO_CACHE}") TRIBITS_CTEST_SUBMIT( PARTS update notes ) ENDIF() REPORT_QUEUED_ERRORS() diff --git a/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake b/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake index d0e64762a..edcb47ff8 100644 --- a/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake +++ b/tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake @@ -57,30 +57,6 @@ MACRO(EXTRAREPO_EXECUTE_PROCESS_WRAPPER) ENDMACRO() -# -# Function for getting the tracking branch -# -FUNCTION(EXTRAREPO_GET_TRACKING_BRANCH EXTRAREPO_SRC_DIR TRACKING_BRANCH_OUT) - IF (NOT CTEST_DEPENDENCY_HANDLING_UNIT_TESTING) - EXECUTE_PROCESS( - COMMAND "${GIT_EXE}" rev-parse --abbrev-ref --symbolic-full-name @{u} - WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE EP_RTN - OUTPUT_VARIABLE TRACKING_BRANCH - ) - IF (NOT EP_RTN STREQUAL "0") - MESSAGE(SEND_ERROR "Error: obtaining tracking branch for repo" - " '${EXTRAREPO_SRC_DIR}' failed!" ) - ENDIF() - ELSE() - # For unit testing purpose, just return generic tacking branch string - SET(TRACKING_BRANCH "tracking/branch") - ENDIF() - SET(${TRACKING_BRANCH_OUT} ${TRACKING_BRANCH} PARENT_SCOPE) -ENDFUNCTION() - - # # Update an existing git repo # @@ -91,9 +67,11 @@ FUNCTION(TRIBITS_UPDATE_GIT_EXTRAREPO GIT_EXE EXTRAREPO_SRC_DIR) SET(EXTRAREPO_FETCH_OUT_FILE "${CTEST_BINARY_DIRECTORY}/${EXTRAREPO_NAME_IN}.fetch.out") SET(EXTRAREPO_SET_BRANCH_OUT_FILE "${CTEST_BINARY_DIRECTORY}/${EXTRAREPO_NAME_IN}.set_branch.out") - EXTRAREPO_GET_TRACKING_BRANCH("${EXTRAREPO_SRC_DIR}" - EXTRAREPO_TRACKING_BRANCH) - #PRINT_VAR(EXTRAREPO_TRACKING_BRANCH) + SET(FETCH_CMND_ARGS + COMMAND "${GIT_EXE}" fetch ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} + TIMEOUT 600 # seconds + WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" + OUTPUT_FILE "${EXTRAREPO_FETCH_OUT_FILE}" ) SET(CLEAN_CMND_ARGS COMMAND "${GIT_EXE}" clean -fdx WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" @@ -102,27 +80,22 @@ FUNCTION(TRIBITS_UPDATE_GIT_EXTRAREPO GIT_EXE EXTRAREPO_SRC_DIR) COMMAND "${GIT_EXE}" reset --hard HEAD WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" OUTPUT_FILE "${EXTRAREPO_RESET_OUT_FILE}" ) - SET(FETCH_CMND_ARGS - COMMAND "${GIT_EXE}" fetch origin - TIMEOUT 600 # seconds - WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" - OUTPUT_FILE "${EXTRAREPO_FETCH_OUT_FILE}" ) IF (${PROJECT_NAME}_EXTRAREPOS_BRANCH) SET(SET_BRANCH_CMND_ARGS COMMAND "${GIT_EXE}" checkout -B ${${PROJECT_NAME}_EXTRAREPOS_BRANCH} - --track origin/${${PROJECT_NAME}_EXTRAREPOS_BRANCH} + --track ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE}/${${PROJECT_NAME}_EXTRAREPOS_BRANCH} WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" OUTPUT_FILE "${EXTRAREPO_SET_BRANCH_OUT_FILE}" ) ELSE () SET(SET_BRANCH_CMND_ARGS - COMMAND "${GIT_EXE}" reset --hard "${EXTRAREPO_TRACKING_BRANCH}" + COMMAND "${GIT_EXE}" reset --hard "@{u}" WORKING_DIRECTORY "${EXTRAREPO_SRC_DIR}" OUTPUT_FILE "${EXTRAREPO_SET_BRANCH_OUT_FILE}" ) ENDIF() + EXTRAREPO_EXECUTE_PROCESS_WRAPPER(${FETCH_CMND_ARGS}) EXTRAREPO_EXECUTE_PROCESS_WRAPPER(${CLEAN_CMND_ARGS}) EXTRAREPO_EXECUTE_PROCESS_WRAPPER(${RESET_CMND_ARGS}) - EXTRAREPO_EXECUTE_PROCESS_WRAPPER(${FETCH_CMND_ARGS}) EXTRAREPO_EXECUTE_PROCESS_WRAPPER(${SET_BRANCH_CMND_ARGS}) ENDFUNCTION() @@ -152,8 +125,15 @@ FUNCTION(TRIBITS_CLONE_OR_UPDATE_EXTRAREPO EXTRAREPO_NAME_IN EXTRAREPO_DIR_IN # Set the command to clone IF (${EXTRAREPO_REPOTYPE_IN} STREQUAL GIT) + IF (${PROJECT_NAME}_EXTRAREPOS_BRANCH) + SET(CHECKOUT_BRANCH_ARG -b ${${PROJECT_NAME}_EXTRAREPOS_BRANCH}) + ELSE() + SET(CHECKOUT_BRANCH_ARG) + ENDIF() SET(CLONE_CMND_ARGS - COMMAND "${GIT_EXE}" clone "${EXTRAREPO_REPOURL}" ${EXTRAREPO_DIR_IN} + COMMAND "${GIT_EXE}" clone + ${CHECKOUT_BRANCH_ARG} -o ${${PROJECT_NAME}_GIT_REPOSITORY_REMOTE} + "${EXTRAREPO_REPOURL}" ${EXTRAREPO_DIR_IN} WORKING_DIRECTORY "${${PROJECT_NAME}_SOURCE_DIRECTORY}" OUTPUT_FILE "${EXTRAREPO_CLONE_OUT_FILE}" ) ELSE() @@ -184,77 +164,22 @@ ENDFUNCTION() # -# Update the branch of the base git repo -# -FUNCTION(TRIBITS_SET_BASE_REPO_BRANCH CTEST_UPDATE_RETURN_VAL - UPDATE_FAILED_VAR_OUT - ) - - SET(GIT_CHECKOUT_RETURN_VAL "0") - - IF (${PROJECT_NAME}_BRANCH AND NOT "${CTEST_UPDATE_RETURN_VAL}" LESS "0") - - MESSAGE("For base repo, doing switch to branch ${${PROJECT_NAME}_BRANCH}") - - SET(EXECUTE_PROCESS_COMMANDS_ARGS - COMMAND ${GIT_EXE} checkout - -B ${${PROJECT_NAME}_BRANCH} --track origin/${${PROJECT_NAME}_BRANCH} - WORKING_DIRECTORY ${CTEST_SOURCE_DIRECTORY} - RESULT_VARIABLE GIT_CHECKOUT_RETURN_VAL - OUTPUT_VARIABLE BRANCH_OUTPUT - ERROR_VARIABLE BRANCH_ERROR - ) - # NOTE: Above will work smoothly even if the local branch already - # exists and/or is already on that branch. This command does not move - # ORIG_HEAD so it will not mess up the pull and update that CTest did - # for the base repo. - - IF (NOT CTEST_DEPENDENCY_HANDLING_UNIT_TESTING) - EXECUTE_PROCESS(${EXECUTE_PROCESS_COMMANDS_ARGS}) - ELSE() - MESSAGE("EXECUTE_PROCESS(${EXECUTE_PROCESS_COMMANDS_ARGS})") - SET(GIT_CHECKOUT_RETURN_VAL 0) - ENDIF() - - IF(NOT "${GIT_CHECKOUT_RETURN_VAL}" EQUAL "0") - MESSAGE("Switch to branch ${${PROJECT_NAME}_BRANCH} failed with" - " error code ${GIT_CHECKOUT_RETURN_VAL}") - QUEUE_ERROR("Switch to branch ${${PROJECT_NAME}_BRANCH} failed with" - " error code ${GIT_CHECKOUT_RETURN_VAL}") - ENDIF() - #Apparently the successful branch switch is also written to stderr. - MESSAGE("${BRANCH_ERROR}") - - ENDIF() - - IF ("${CTEST_UPDATE_RETURN_VAL}" LESS "0" OR NOT "${GIT_CHECKOUT_RETURN_VAL}" EQUAL "0") - SET(${UPDATE_FAILED_VAR_OUT} TRUE PARENT_SCOPE) - ELSE() - SET(${UPDATE_FAILED_VAR_OUT} FALSE PARENT_SCOPE) - ENDIF() - -ENDFUNCTION() - - -# -# Clone or update all of the repos and put them on right branch +# Clone or update all of the extra repos and put them on the right branch. # # NOTE: The base repo is cloned and updated by CTEST_UPDATE() before calling -# this function. This function only puts the base repo on the right branch. +# this function. This function only operators on the extra repos. # -FUNCTION(TRIBITS_CLONE_OR_UPDATE_ALL_REPOS CTEST_UPDATE_RETURN_VAL +FUNCTION(TRIBITS_CLONE_OR_UPDATE_EXTRA_REPOS CTEST_UPDATE_RETURN_VAL UPDATE_FAILED_VAR_OUT ) SET(UPDATE_FAILED FALSE) - # A) Put the base repo on the right branch - - TRIBITS_SET_BASE_REPO_BRANCH(${CTEST_UPDATE_RETURN_VAL} BASE_REPO_UPDATE_FAILED) - IF (BASE_REPO_UPDATE_FAILED) - SET(UPDATE_FAILED TRUE) - ENDIF() + # A) NOTE: The base repo is already on the right branch either due to the + # initial clone run in ctest_start() that set the branch with 'git clone -b + # ...' or it was set in the ctest_update() where it checked out the + # correct banch. # B) Clone and update the extra repos @@ -321,7 +246,6 @@ ENDMACRO() # NOTE: This macro is used to clean up the main TRIBITS_CTEST_DRIVER() # macro. # - MACRO(TRIBITS_SETUP_PACKAGES) # Here, we must point into the source tree just cloned (or updated) @@ -390,7 +314,6 @@ ENDMACRO() # # Select packages set by the input # - MACRO(ENABLE_USER_SELECTED_PACKAGES) # 1) Set the enables for packages already set with @@ -438,7 +361,6 @@ ENDMACRO() # # Select only packages that are modified or failed in the last CI iteration # - MACRO(ENABLE_ONLY_MODIFIED_PACKAGES) # @@ -607,7 +529,6 @@ ENDMACRO() # NOTE: These disables need to dominate over the above enables so this code is # after all the enable code has run # - MACRO(DISABLE_EXCLUDED_PACKAGES) FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_EXCLUDE_PACKAGES}) MESSAGE("Disabling excluded package ${TRIBITS_PACKAGE} ...") @@ -657,7 +578,6 @@ ENDMACRO() # locally. When run locally, ctest will just report aggregated times for # subprojects that have 1 or more tests. Not true for CDash. # - MACRO(TRIBITS_CTEST_DRIVER_SET_LABELS_TO_SUBPROJECTS_MAPPING) SET(CTEST_LABELS_FOR_SUBPROJECTS) FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST}) @@ -669,7 +589,6 @@ ENDMACRO() # # Select the default generator. # - MACRO(SELECT_DEFAULT_GENERATOR) # When the build tree is known and exists, use # its generator. @@ -689,7 +608,6 @@ ENDMACRO() # # Call INITIALIZE_ERROR_QUEUE once at the top of TRIBITS_CTEST_DRIVER # - MACRO(INITIALIZE_ERROR_QUEUE) SET(TRIBITS_CTEST_DRIVER_ERROR_QUEUE "") ENDMACRO() @@ -706,7 +624,6 @@ ENDMACRO() # When adding more callers of QUEUE_ERROR, just make sure that it does not # duplicate an existing/reported dashboard failure. # - MACRO(QUEUE_ERROR err_msg) SET(TRIBITS_CTEST_DRIVER_ERROR_QUEUE ${TRIBITS_CTEST_DRIVER_ERROR_QUEUE} "${err_msg}") @@ -716,7 +633,6 @@ ENDMACRO() # # Call REPORT_QUEUED_ERRORS() once at the bottom of TRIBITS_CTEST_DRIVER() # - MACRO(REPORT_QUEUED_ERRORS) IF ("${TRIBITS_CTEST_DRIVER_ERROR_QUEUE}" STREQUAL "") MESSAGE("TRIBITS_CTEST_DRIVER_ERROR_QUEUE is empty. All is well.") @@ -733,7 +649,6 @@ ENDMACRO() # Override CTEST_SUBMIT to drive multiple submits and to detect failed # submissions and track them as queued errors. # - MACRO(TRIBITS_CTEST_SUBMIT) # Cache the original CTEST_DROP_SITE and CTEST_DROP_LOCATION @@ -1015,14 +930,8 @@ MACRO(TRIBITS_CTEST_PACKAGE_BY_PACKAGE) 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) - IF (NOT CTEST_DO_CONFIGURE AND CTEST_DO_SUBMIT) MESSAGE("${TRIBITS_PACKAGE}: Skipping submitting configure" " and notes due to CTEST_DO_CONFIGURE='${CTEST_DO_CONFIGURE}'!") @@ -1383,9 +1292,8 @@ MACRO(TRIBITS_CTEST_ALL_AT_ONCE) 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}") + SET(CTEST_NOTES_FILES "${REPO_VERSION_FILE};${CTEST_NOTES_FILES}") ENDIF() PRINT_VAR(CTEST_NOTES_FILES) diff --git a/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake b/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake new file mode 100644 index 000000000..edfab6d51 --- /dev/null +++ b/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake @@ -0,0 +1,41 @@ +# +# cmake -P script to get the CTest testing XML directory +# /Testing/ given jus the directory path. +# +# Usage: +# +# cmake \ +# -DPROJECT_NAME= \ +# -D${PROJECT_NAME}_TRIBITS_DIR= \ +# -DCTEST_BUILD_DIR= \ +# -P /ctest_driver/TribitsGetCTestTestXmlDir.cmake +# +# This script reads in the /Testing/TAG to get and +# then prints the directory /Testing/ to STDOUT. +# + +IF ("${PROJECT_NAME}" STREQUAL "") + MESSAGE(FATAL_ERROR "Error, PROJECT_NAME must be set!") +ENDIF() + +IF ("${${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") + MESSAGE(FATAL_ERROR "Error, ${PROJECT_NAME}_TRIBITS_DIR must be set!") +ENDIF() + +IF ("${CTEST_BUILD_DIR}" STREQUAL "") + MESSAGE(FATAL_ERROR "Error, CTEST_BUILD_DIR must be set!") +ENDIF() + +SET( CMAKE_MODULE_PATH + "${${PROJECT_NAME}_TRIBITS_DIR}/core/utils" + "${${PROJECT_NAME}_TRIBITS_DIR}/core/package_arch" + "${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver" + ) + +INCLUDE(TribitsReadTagFile) + +SET(TAG_FILE "${CTEST_BUILD_DIR}/Testing/TAG") + +TRIBITS_READ_CTEST_TAG_FILE("${TAG_FILE}" BUILD_START_TIME CDASH_TRACK) + +MESSAGE("${CTEST_BUILD_DIR}/Testing/${BUILD_START_TIME}") diff --git a/tribits/ctest_driver/TribitsReadTagFile.cmake b/tribits/ctest_driver/TribitsReadTagFile.cmake new file mode 100644 index 000000000..673d23ef1 --- /dev/null +++ b/tribits/ctest_driver/TribitsReadTagFile.cmake @@ -0,0 +1,16 @@ +INCLUDE(TribitsCMakePolicies) +INCLUDE(Split) + + +# +# Read in the /Testing/TAG file contents +# +# +FUNCTION(TRIBITS_READ_CTEST_TAG_FILE TAG_FILE_IN BUILD_START_TIME_OUT CDASH_TRACK_OUT) + FILE(READ "${TAG_FILE_IN}" TAG_FILE_STR) + SPLIT("${TAG_FILE_STR}" "\n" TAG_FILE_STR_LIST) + LIST(GET TAG_FILE_STR_LIST 0 BUILD_START_TIME) + LIST(GET TAG_FILE_STR_LIST 1 CDASH_TRACK) + SET(${BUILD_START_TIME_OUT} "${BUILD_START_TIME}" PARENT_SCOPE) + SET(${CDASH_TRACK_OUT} "${CDASH_TRACK}" PARENT_SCOPE) +ENDFUNCTION() diff --git a/tribits/ctest_driver/tribits_ctest_update_commands.cmake b/tribits/ctest_driver/tribits_ctest_update_commands.cmake new file mode 100644 index 000000000..155c6f500 --- /dev/null +++ b/tribits/ctest_driver/tribits_ctest_update_commands.cmake @@ -0,0 +1,75 @@ +# +# cmake -P script to do and update of the base git repo. +# +# Usage: +# +# cmake [arguments] -P tribits_ctest_update_commands.cmake +# +# where the -D= arguments are shown below. +# +# The list of commands in this script completely clean out a git repo and +# create a local branch with name ${BRANCH} tracking a remote branch ${BRANCH} +# in the remote repo ${REMOTE_NAME}. This is robust no matter what the +# current state of the local git repo. The built-in git commands used by +# ctest_update() are not robust to some use cases where these commands are. +# For example, the commands are robust to the situation where the local repo +# may be tracking a remote branch that may have been deleted in the remote +# repo. The default commands used in ctest_update() (at least as of CMake +# 3.12) crash in that case. +# + +message("\ncmake -P tribits_ctest_update_commands.cmake:") +message("-- GIT_EXE=${GIT_EXE}") +message("-- REMOTE_NAME=${REMOTE_NAME}") +message("-- BRANCH=${BRANCH}") +message("-- UNIT_TEST_MODE=${UNIT_TEST_MODE}") + +set(OVERALL_SUCCESS TRUE) +set(ERROR_CODE 0) + +macro(execute_process_wrapper) + if (UNIT_TEST_MODE) + message("execute_process(${ARGN})") + else() + execute_process(${ARGN} RESULT_VARIABLE RTN_CODE) + message("RTN_CODE: ${RTN_CODE}") + IF (NOT "${RTN_CODE}" STREQUAL "0") + set(OVERALL_SUCCESS FALSE) + set(ERROR_CODE ${RTN_CODE}) + endif() + endif() +endmacro() + +macro(run_command) + string(REPLACE ";" " " CMND_STR "${ARGN}") + message("\nRunning: ${CMND_STR}") + execute_process_wrapper(COMMAND ${ARGN}) +endmacro() + +run_command( + "${GIT_EXE}" fetch ${REMOTE_NAME} ) + +run_command( + "${GIT_EXE}" clean -fdx ) + +run_command( + "${GIT_EXE}" reset --hard HEAD ) + +if (BRANCH) + run_command( + "${GIT_EXE}" checkout -B ${BRANCH} --track ${REMOTE_NAME}/${BRANCH} ) +else() + run_command( + "${GIT_EXE}" reset --hard @{u} ) +endif() + +if (OVERALL_SUCCESS) + message("\nGit Update PASSED!") +else() + message(FATAL_ERROR "Git Update FAILED!") +endif() + +# NOTE: Above, you have to use separate execute_process() commands for each +# git command or you get git errors complaining about git commands running on +# top of each other. The execute_process() implementation must not ensure +# that one command is completely finished before the next one starts. diff --git a/tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake b/tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake new file mode 100644 index 000000000..02f0f9ce3 --- /dev/null +++ b/tribits/ctest_driver/tribits_ctest_update_commands_wrapper.cmake @@ -0,0 +1,28 @@ +# +# cmake -P script that calls tribits_ctest_update_commands.cmake and sends +# STDOUT to a file. +# +# This script is required if you want to capture the output from these +# commands to a file since this is called from ctest_update() which discards +# the output (and does not send it to CDash). +# + +message("\ncmake -P tribits_ctest_update_commands_wrapper.cmake:") +message("-- OUTPUT_FILE=${OUTPUT_FILE}\n") + +execute_process( + COMMAND "${CMAKE_COMMAND}" + -DGIT_EXE=${GIT_EXE} + -DREMOTE_NAME=${REMOTE_NAME} + -DBRANCH=${BRANCH} + -DUNIT_TEST_MODE=${UNIT_TEST_MODE} + -P ${CMAKE_CURRENT_LIST_DIR}/tribits_ctest_update_commands.cmake + OUTPUT_FILE "${OUTPUT_FILE}" + ERROR_FILE "${OUTPUT_FILE}" + RESULT_VARIABLE RTN_CODE + ) +message("\ntribits_ctest_update_commands_wrapper.cmake return: ${RTN_CODE}\n") + +if (NOT "${RTN_CODE}" STREQUAL "0") + message(FATAL_ERROR "Git Update FAILED!") +endif() diff --git a/tribits/examples/TribitsExampleMetaProject/CTestConfig.cmake b/tribits/examples/TribitsExampleMetaProject/CTestConfig.cmake new file mode 100644 index 000000000..0d90615e4 --- /dev/null +++ b/tribits/examples/TribitsExampleMetaProject/CTestConfig.cmake @@ -0,0 +1,15 @@ +INCLUDE(SetDefaultAndFromEnv) + +SET(CTEST_NIGHTLY_START_TIME "04:00:00 UTC") # 10 PM MDT or 9 PM MST + +IF (NOT DEFINED CTEST_DROP_METHOD) + SET_DEFAULT_AND_FROM_ENV(CTEST_DROP_METHOD "http") +ENDIF() + +IF (CTEST_DROP_METHOD STREQUAL "http") + SET_DEFAULT_AND_FROM_ENV(CTEST_DROP_SITE "testing.sandia.gov/cdash") + SET_DEFAULT_AND_FROM_ENV(CTEST_PROJECT_NAME "TribitsExampleMetaProject") + SET_DEFAULT_AND_FROM_ENV(CTEST_DROP_LOCATION "/submit.php?project=TribitsExampleMetaProject") + SET_DEFAULT_AND_FROM_ENV(CTEST_TRIGGER_SITE "") + SET_DEFAULT_AND_FROM_ENV(CTEST_DROP_SITE_CDASH TRUE) +ENDIF() diff --git a/tribits/examples/TribitsExampleMetaProject/ProjectName.cmake b/tribits/examples/TribitsExampleMetaProject/ProjectName.cmake index b36279cf7..519098364 100644 --- a/tribits/examples/TribitsExampleMetaProject/ProjectName.cmake +++ b/tribits/examples/TribitsExampleMetaProject/ProjectName.cmake @@ -5,7 +5,14 @@ SET(PROJECT_NAME TribitsExMetaProj) SET(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT ON) # Must always have the PRE extra repo TribitsExampleProject/ or can't build -SET(${PROJECT_NAME}_EXTRAREPOS_FILE cmake/ExtraRepositoriesList.cmake +SET(${PROJECT_NAME}_EXTRAREPOS_FILE + ${CMAKE_CURRENT_LIST_DIR}/cmake/ExtraRepositoriesList.cmake CACHE FILEPATH "Set in ProjectName.cmake") SET(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE Continuous CACHE STRING "Set in ProjectName.cmake") + +# Generate RepoVersion.txt file +SET(${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT ON) + +# Do the all-at-once approach with tribits_ctest_driver() by default +SET(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT ON) diff --git a/tribits/examples/TribitsExampleMetaProject/cmake/ExtraRepositoriesList.cmake b/tribits/examples/TribitsExampleMetaProject/cmake/ExtraRepositoriesList.cmake index 041cd497d..ad0e5f551 100644 --- a/tribits/examples/TribitsExampleMetaProject/cmake/ExtraRepositoriesList.cmake +++ b/tribits/examples/TribitsExampleMetaProject/cmake/ExtraRepositoriesList.cmake @@ -1,8 +1,8 @@ -SET_DEFAULT_AND_FROM_ENV(GIT_URL_REPO_BASE git@github.com:TriBITSPub/) +SET_DEFAULT_AND_FROM_ENV(TribitsExMetaProj_GIT_URL_REPO_BASE https://github.com/tribits/) TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES( - TribitsExampleProject "" GIT ${GIT_URL_REPO_BASE}TribitsExampleProject + TribitsExampleProject "" GIT ${TribitsExMetaProj_GIT_URL_REPO_BASE}TribitsExampleProject.git "" Continuous - TribitsExampleProjectAddons "" GIT ${GIT_URL_REPO_BASE}TribitsExampleProjectAddons + TribitsExampleProjectAddons "" GIT ${TribitsExMetaProj_GIT_URL_REPO_BASE}TribitsExampleProjectAddons.git "" Continuous ) diff --git a/tribits/examples/TribitsExampleMetaProject/cmake/ctest/CTestCustom.cmake.in b/tribits/examples/TribitsExampleMetaProject/cmake/ctest/CTestCustom.cmake.in new file mode 100644 index 000000000..bf513c45e --- /dev/null +++ b/tribits/examples/TribitsExampleMetaProject/cmake/ctest/CTestCustom.cmake.in @@ -0,0 +1,5 @@ +# Allow full output to go to CDash +SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 0) +SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 0) +# WARNING! This could be a lot of output and could overwhelm CDash and the +# MySQL DB so this might not be a good idea! diff --git a/tribits/examples/TribitsExampleMetaProject/cmake/ctest/TribitsExMetaProjCTestDriver.cmake b/tribits/examples/TribitsExampleMetaProject/cmake/ctest/TribitsExMetaProjCTestDriver.cmake new file mode 100644 index 000000000..fe9f0191c --- /dev/null +++ b/tribits/examples/TribitsExampleMetaProject/cmake/ctest/TribitsExMetaProjCTestDriver.cmake @@ -0,0 +1,31 @@ +# +# Set the locations of things for this project +# + +SET(TRIBITS_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..") +SET(CTEST_SOURCE_NAME "TribitsExampleMetaProject") +INCLUDE("${TRIBITS_PROJECT_ROOT}/ProjectName.cmake") +IF (NOT "$ENV{${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") + SET(${PROJECT_NAME}_TRIBITS_DIR "$ENV{${PROJECT_NAME}_TRIBITS_DIR}") +ENDIF() +IF("${${PROJECT_NAME}_TRIBITS_DIR}" STREQUAL "") + # If not set externally, then assume this is inside of tribits example + # directory. + SET(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../..") +ENDIF() + +# +# Include the TriBITS file to get other modules included +# + +INCLUDE("${${PROJECT_NAME}_TRIBITS_DIR}/ctest_driver/TribitsCTestDriverCore.cmake") + +FUNCTION(TRIBITSEXMETAPROJ_CTEST_DRIVER) + SET_DEFAULT_AND_FROM_ENV(TribitsExMetaProj_GIT_URL_REPO_BASE + https://github.com/tribits/) + SET_DEFAULT(TribitsExMetaProj_REPOSITORY_LOCATION_DEFAULT + "${TribitsExMetaProj_GIT_URL_REPO_BASE}TribitsExampleMetaProject.git") + SET_DEFAULT(TribitsExMetaProj_REPOSITORY_LOCATION_NIGHTLY_DEFAULT + "${TribitsExMetaProj_REPOSITORY_LOCATION_DEFAULT}") + TRIBITS_CTEST_DRIVER() +ENDFUNCTION() diff --git a/tribits/examples/TribitsExampleMetaProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake b/tribits/examples/TribitsExampleMetaProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake new file mode 100644 index 000000000..f0b532a1d --- /dev/null +++ b/tribits/examples/TribitsExampleMetaProject/cmake/ctest/general_gcc/ctest_serial_debug.cmake @@ -0,0 +1,31 @@ +INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../TribitsExMetaProjCTestDriver.cmake") + +SET(COMM_TYPE SERIAL) +SET(BUILD_TYPE DEBUG) +SET(COMPILER_VERSION GCC) +SET(BUILD_DIR_NAME ${COMM_TYPE}_${BUILD_TYPE}) + +SET_DEFAULT( CTEST_BUILD_FLAGS "-j1 -i" ) +SET_DEFAULT( CTEST_PARALLEL_LEVEL "1" ) + +SET( EXTRA_CONFIGURE_OPTIONS + "-DBUILD_SHARED_LIBS:BOOL=ON" + "-DCMAKE_BUILD_TYPE=DEBUG" + "-DCMAKE_C_COMPILER=gcc" + "-DCMAKE_CXX_COMPILER=g++" + "-DCMAKE_Fortran_COMPILER=gfortran" + "-DTribitsExMetaProj_ENABLE_Fortran=ON" + "-DTribitsExMetaProj_TRACE_ADD_TEST=ON" + ) + +SET_DEFAULT_AND_FROM_ENV(TribitsExMetaProj_CMAKE_INSTALL_PREFIX "") +IF (TribitsExMetaProj_CMAKE_INSTALL_PREFIX) + SET(EXTRA_CONFIGURE_OPTIONS + "${EXTRA_CONFIGURE_OPTIONS}" + "-DCMAKE_INSTALL_PREFIX=${TribitsExMetaProj_CMAKE_INSTALL_PREFIX}" + ) +ENDIF() + +SET(CTEST_TEST_TYPE Continuous) + +TRIBITSEXMETAPROJ_CTEST_DRIVER() From 3507ab491ab6f89a9949f8935116f4734bea7f39 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 19 Feb 2019 15:18:25 -0700 Subject: [PATCH 4/5] Set TriBITS_ENABLE_REAL_GIT_CLONE_TESTS=TRUE for TravisCI testing (#278) --- cmake/ctest/travisci/ctest_trusty_serial_debug.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake b/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake index e0a76903a..bfcdf97c0 100644 --- a/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake +++ b/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake @@ -24,6 +24,7 @@ SET( EXTRA_CONFIGURE_OPTIONS "-DTriBITS_ENABLE_Fortran=ON" "-DTriBITS_CTEST_DRIVER_COVERAGE_TESTS=TRUE" "-DTriBITS_CTEST_DRIVER_MEMORY_TESTS=TRUE" + "-DTriBITS_ENABLE_REAL_GIT_CLONE_TESTS=TRUE" "-DTriBITS_TRACE_ADD_TEST=ON" "-DTriBITS_HOSTNAME=${CTEST_SITE}" ) From 76e958dfacb8e9def6bdf3f952802a7806373102 Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 19 Feb 2019 15:29:12 -0700 Subject: [PATCH 5/5] Add TriBITS_SHOW_TEST_START_END_DATE_TIME=ON for TravisCI (#278) --- cmake/ctest/travisci/ctest_trusty_serial_debug.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake b/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake index bfcdf97c0..cb4edd0e5 100644 --- a/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake +++ b/cmake/ctest/travisci/ctest_trusty_serial_debug.cmake @@ -26,6 +26,7 @@ SET( EXTRA_CONFIGURE_OPTIONS "-DTriBITS_CTEST_DRIVER_MEMORY_TESTS=TRUE" "-DTriBITS_ENABLE_REAL_GIT_CLONE_TESTS=TRUE" "-DTriBITS_TRACE_ADD_TEST=ON" + "-DTriBITS_SHOW_TEST_START_END_DATE_TIME=ON" "-DTriBITS_HOSTNAME=${CTEST_SITE}" )