forked from TriBITSPub/TriBITS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Add TRIBITS_READ_CTEST_TAG_FILE() and TribitsGetCTestTestXmlDir.…
…cmake (TriBITSPub#278, TriBITSPub#154) This is needed to be able to read XML files out of the <bulid>/Testing/<buildstarttime>/ directory needed for (TriBITSPub#278) This will also make it easy to generate a CDash URL without knowing the build ID.
- Loading branch information
1 parent
d46448c
commit 4e82eb3
Showing
6 changed files
with
176 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
20101015-1112 | ||
My CDash Track |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# cmake -P script to get the CTest testing XML directory | ||
# <build>/Testing/<buildstarttime> given jus the <bulid> directory path. | ||
# | ||
# Usage: | ||
# | ||
# cmake \ | ||
# -DPROJECT_NAME=<projectName> \ | ||
# -D${PROJECT_NAME}_TRIBITS_DIR=<tribits-dir> \ | ||
# -DCTEST_BUILD_DIR=<build-dir> \ | ||
# -P <tribits-dir>/ctest_driver/TribitsGetCTestTestXmlDir.cmake | ||
# | ||
# This script reads in the <build-dir>/Testing/TAG to get <bulidstarttime> and | ||
# then prints the directory <build>/Testing/<buildstarttime> 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}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
INCLUDE(TribitsCMakePolicies) | ||
INCLUDE(Split) | ||
|
||
|
||
# | ||
# Read in the <build>/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() |