From 5da54c8e9284d6a07104df0c9496baa09ad191ec Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Tue, 27 Jul 2021 17:55:36 -0600 Subject: [PATCH] Update tribits_read_ctest_tag_file() to also read model (#154) Version of CMake 3.17 (and likely earlier) added the model in addition to group to the TAG file. --- test/ctest_driver/CMakeLists.txt | 2 +- test/ctest_driver/CTestDriverUnitTests.cmake | 14 ++++++++------ .../data/dummy_build_dir/Testing/TAG | 3 ++- .../ctest_driver/TribitsGetCTestTestXmlDir.cmake | 4 ++-- tribits/ctest_driver/TribitsReadTagFile.cmake | 16 +++++++++++++--- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/test/ctest_driver/CMakeLists.txt b/test/ctest_driver/CMakeLists.txt index bbca928b1..b7dbabf50 100644 --- a/test/ctest_driver/CMakeLists.txt +++ b/test/ctest_driver/CMakeLists.txt @@ -6,7 +6,7 @@ tribits_add_advanced_test( CTestDriverUnitTests -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: num_run = 3" "Final UnitTests Result: PASSED" ) diff --git a/test/ctest_driver/CTestDriverUnitTests.cmake b/test/ctest_driver/CTestDriverUnitTests.cmake index 05948bab4..2189bd2d7 100644 --- a/test/ctest_driver/CTestDriverUnitTests.cmake +++ b/test/ctest_driver/CTestDriverUnitTests.cmake @@ -59,16 +59,18 @@ function(unittest_read_ctest_tag_file) 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) + tribits_read_ctest_tag_file(${TAG_FILE_IN} buildStartTime cdashGroup cdashModel) - unittest_compare_const(BUILD_START_TIME_OUT + unittest_compare_const(buildStartTime "20101015-1112") - - unittest_compare_const(CDASH_TRACK_OUT - "My CDash Track") # NOTE: Spaces are important to test here! + unittest_compare_const(cdashGroup + "My CDash Group") # NOTE: Spaces are important to test here! + unittest_compare_const(cdashModel + "The Model") # NOTE: Spaces are important to test here! endfunction() + # # Execute the unit tests # @@ -86,4 +88,4 @@ message("*** Determine final result of all unit tests") message("***\n") # Pass in the number of expected tests that must pass! -unittest_final_result(2) +unittest_final_result(3) diff --git a/test/ctest_driver/data/dummy_build_dir/Testing/TAG b/test/ctest_driver/data/dummy_build_dir/Testing/TAG index b0df6bdb8..50cb259b4 100644 --- a/test/ctest_driver/data/dummy_build_dir/Testing/TAG +++ b/test/ctest_driver/data/dummy_build_dir/Testing/TAG @@ -1,2 +1,3 @@ 20101015-1112 -My CDash Track +My CDash Group +The Model diff --git a/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake b/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake index 5e1e7bc97..8de1a7eb6 100644 --- a/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake +++ b/tribits/ctest_driver/TribitsGetCTestTestXmlDir.cmake @@ -36,6 +36,6 @@ include(TribitsReadTagFile) set(TAG_FILE "${CTEST_BUILD_DIR}/Testing/TAG") -tribits_read_ctest_tag_file("${TAG_FILE}" BUILD_START_TIME CDASH_TRACK) +tribits_read_ctest_tag_file("${TAG_FILE}" buildStartTime cdashGroup cdashModel) -message("${CTEST_BUILD_DIR}/Testing/${BUILD_START_TIME}") +message("${CTEST_BUILD_DIR}/Testing/${buildStartTime}") diff --git a/tribits/ctest_driver/TribitsReadTagFile.cmake b/tribits/ctest_driver/TribitsReadTagFile.cmake index 766feb092..7a2d50894 100644 --- a/tribits/ctest_driver/TribitsReadTagFile.cmake +++ b/tribits/ctest_driver/TribitsReadTagFile.cmake @@ -2,15 +2,25 @@ include(TribitsCMakePolicies) include(Split) +# @FUNCTION: tribits_read_ctest_tag_file() # # Read in the /Testing/TAG file contents # +# Usage:: # -function(tribits_read_ctest_tag_file TAG_FILE_IN BUILD_START_TIME_OUT CDASH_TRACK_OUT) +# tribits_read_ctest_tag_file( +# ) +# +# +function(tribits_read_ctest_tag_file TAG_FILE_IN + BUILD_START_TIME_OUT CDASH_GROUP_OUT CDASH_MODEL_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) + list(GET TAG_FILE_STR_LIST 1 CDASH_GROUP) + list(GET TAG_FILE_STR_LIST 2 CDASH_MODEL) set(${BUILD_START_TIME_OUT} "${BUILD_START_TIME}" PARENT_SCOPE) - set(${CDASH_TRACK_OUT} "${CDASH_TRACK}" PARENT_SCOPE) + set(${CDASH_GROUP_OUT} "${CDASH_GROUP}" PARENT_SCOPE) + set(${CDASH_MODEL_OUT} "${CDASH_MODEL}" PARENT_SCOPE) endfunction()