From 4354ed081b356dd9d6f7be2e100b032cadaeccac Mon Sep 17 00:00:00 2001 From: "Roscoe A. Bartlett" Date: Sat, 4 Jun 2022 18:36:03 -0600 Subject: [PATCH] Produce CDash URLs to all builds and nonpassing tests for same repo version (#483) This makes it easy to click on links to these other CDash URLs to see what is happening with all of the builds for the same repo version. The main target is for the GitHub Actions drivers for TriBITS testing. This makes it easy to get at those results. As part of this, I also renamed the function tribits_get_build_url_and_write_to_file() to tribits_get_cdash_build_url() and removed the ability to write to a file. (We just don't need that anymore and it is trivial to write a string to a file.) --- .github/workflows/tribits_testing.yml | 7 +- test/ctest_driver/CTestDriverUnitTests.cmake | 38 +++ .../TribitsExampleMetaProject/CMakeLists.txt | 26 ++ .../TribitsExampleProject/CMakeLists.txt | 19 +- .../ctest_driver/TribitsCTestDriverCore.cmake | 78 ++++- .../TribitsGetCDashUrlsInsideCTestS.cmake | 283 +++++++++++++++++- 6 files changed, 422 insertions(+), 29 deletions(-) diff --git a/.github/workflows/tribits_testing.yml b/.github/workflows/tribits_testing.yml index 600a222a4..7f64e6e2c 100644 --- a/.github/workflows/tribits_testing.yml +++ b/.github/workflows/tribits_testing.yml @@ -93,6 +93,9 @@ jobs: - name: URL to results on CDash run: | cd .. - echo "Result on CDash are posted at:" + echo "See results posted on CDash:" + echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo - cat tribits-build/BUILD/CDashBuildUrl.txt + cat tribits-build/BUILD/CDashResults.txt + echo + echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" diff --git a/test/ctest_driver/CTestDriverUnitTests.cmake b/test/ctest_driver/CTestDriverUnitTests.cmake index ee6d5b8df..d8d19f89a 100644 --- a/test/ctest_driver/CTestDriverUnitTests.cmake +++ b/test/ctest_driver/CTestDriverUnitTests.cmake @@ -53,6 +53,42 @@ include(TribitsReadTagFile) include(TribitsGetCDashUrlsInsideCTestS) +function(unittest_tribits_get_cdash_revision_builds_url) + + message("\n***") + message("*** Testing tribits_get_cdash_revision_builds_url()") + message("***\n") + + tribits_get_cdash_revision_builds_url( + CDASH_SITE_URL "somesite.com/my-cdash" + PROJECT_NAME goodProject + GIT_REPO_SHA1 "abc123" + CDASH_REVISION_BUILDS_URL_OUT cdashRevesionBuildsUrlOut + ) + unittest_compare_const(cdashRevesionBuildsUrlOut + "somesite.com/my-cdash/index.php?project=goodProject&filtercount=1&showfilters=1&field1=revision&compare1=61&value1=abc123") + +endfunction() + + +function(unittest_tribits_get_cdash_revision_nonpassing_tests_url) + + message("\n***") + message("*** Testing tribits_get_cdash_revision_nonpassing_tests_url()") + message("***\n") + + tribits_get_cdash_revision_nonpassing_tests_url( + CDASH_SITE_URL "somesite.com/my-cdash" + PROJECT_NAME goodProject + GIT_REPO_SHA1 "abc123" + CDASH_REVISION_NONPASSING_TESTS_URL_OUT cdashRevisionNonpassingTestsUrlOut + ) + unittest_compare_const(cdashRevisionNonpassingTestsUrlOut + "somesite.com/my-cdash/queryTests.php?project=goodProject&filtercount=2&showfilters=1&filtercombine=and&field1=revision&compare1=61&value1=abc123&field2=status&compare2=62&value2=passed") + +endfunction() + + function(unittest_tribits_read_ctest_tag_file) message("\n***") @@ -158,6 +194,8 @@ endfunction() unittest_initialize_vars() # Run the unit test functions +unittest_tribits_get_cdash_revision_builds_url() +unittest_tribits_get_cdash_revision_nonpassing_tests_url() unittest_tribits_read_ctest_tag_file() unittest_tribits_get_cdash_site_from_drop_site_and_location() unittest_tribits_get_cdash_index_php_from_drop_site_and_location() diff --git a/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt b/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt index 17a553913..15e465a5a 100644 --- a/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt +++ b/test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt @@ -98,6 +98,19 @@ set(TribitsExampleMetaProject_COMMON_CONFIG_ARGS ########################################################################################## + set(cdash_build_url_expected_regex + "https://testing[.]sandia[.]gov/cdash/index[.]php[?]project=TribitsExampleMetaProject&filtercount=3&showfilters=1&filtercombine=and&field1=site&compare1=61&value1=CustomSite&field2=buildname&compare2=61&value2=CTestDriver_TribitsExMetaProj_clone_default_branch_remote&field3=buildstamp&compare3=61&value3=[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-Continuous" ) + # NOTE: Above, we have to repeat [0-9] 8 times and 4 times for the regex for + # the number of digits in the buildstarttime. CMake regex does not support + # \d{8}-\d{4} :-( + + set(cdash_revisions_builds_url_expected_regex + "https://testing[.]sandia[.]gov/cdash/index.php[?]project=TribitsExampleMetaProject&filtercount=1&showfilters=1&field1=revision&compare1=61&value1=863461e3035d24c632e175c087761e83db28bdc3") + + set(cdash_revisions_nonpassing_tests_expected_regex + "https://testing[.]sandia[.]gov/cdash/queryTests.php[?]project=TribitsExampleMetaProject&filtercount=2&showfilters=1&filtercombine=and&field1=revision&compare1=61&value1=863461e3035d24c632e175c087761e83db28bdc3&field2=status&compare2=62&value2=passed" ) + + tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_remote OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 @@ -111,11 +124,19 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_re ${COMMON_ENV_ARGS} TribitsExMetaProj_ENABLE_SECONDARY_TESTED_CODE=TRUE CTEST_BUILD_NAME=CTestDriver_TribitsExMetaProj_clone_default_branch_remote + CTEST_SITE=CustomSite ${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" + "Results will be submitted on CDash at the following links:" + "Link to this build's results on CDash:" + "${cdash_build_url_expected_regex}" + "Link to all builds for this repo version on CDash:" + "${cdash_revisions_builds_url_expected_regex}" + "Link to all nonpassing tests for all builds for this repo version on CDash:" + "${cdash_revisions_nonpassing_tests_expected_regex}" "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]+" @@ -315,6 +336,11 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_re # * Makes sure some git commit SHA1s are shown in 'Old/New revision of # repository' printouts from ctest_update(). # + # * Checks that CDash URLs that get produced, including for all builds with + # * the same repo version. (This check has to be here since the base + # * project repo must have a .git/ directory and we must know the exact SHA1 + # * of that repo for the test, which we don in this case.) + # # NOTE: The reason that so many tests are done in a single ctest test is the # cost of the initial configure which checks the compilers which is very # expensive. The other runs use diff --git a/test/ctest_driver/TribitsExampleProject/CMakeLists.txt b/test/ctest_driver/TribitsExampleProject/CMakeLists.txt index 602b6e4a9..420e11581 100644 --- a/test/ctest_driver/TribitsExampleProject/CMakeLists.txt +++ b/test/ctest_driver/TribitsExampleProject/CMakeLists.txt @@ -1264,7 +1264,8 @@ function(generate_aao_tests) # CONFIGURE_OPTIONS list is checked to make sure that it does not change # without being noticed. Follow-on tests will not check all of that. - set(cdash_url_expected_regex + + set(cdash_build_url_expected_regex "https://cdash[.]site[.]com/cdash/index[.]php[?]project=CustomTribitsExProj&filtercount=3&showfilters=1&filtercombine=and&field1=site&compare1=61&value1=My%20Site&field2=buildname&compare2=61&value2=TriBITS_CTestDriver_AAOP_CDASH_URL&field3=buildstamp&compare3=61&value3=[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-Custom%20CDash%20Group" ) # NOTE: Above, we have to repeat [0-9] 8 times and 4 times for the regex for # the number of digits in the buildstarttime. CMake regex does not support @@ -1285,7 +1286,7 @@ function(generate_aao_tests) CTEST_DASHBOARD_ROOT=PWD ${AAO_COMMON_ENV_ARGS} CTEST_PARALLEL_LEVEL=3 - CTEST_DO_SUBMIT=OFF # Never submit this + CTEST_DO_SUBMIT=OFF # Never submit this (see below note) CTEST_SITE="My Site" CTEST_DROP_SITE="cdash.site.com" CTEST_PROJECT_NAME="CustomTribitsExProj" @@ -1299,17 +1300,19 @@ function(generate_aao_tests) "NONE does not exist, skipping extra repositories" "Final set of enabled packages: SimpleCxx 1" "Final set of enabled SE packages: SimpleCxx 1" - "Results will be submitted to CDash at:" + "Results will be submitted on CDash at the following links:" + "Link to this build's results on CDash:" + "${cdash_build_url_expected_regex}" "File '' does NOT exist so all tests passed" - "See results submitted to CDash at:" - "${cdash_url_expected_regex}" + "See results submitted on CDash at the following links:" "TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSED" ALWAYS_FAIL_ON_NONZERO_RETURN TEST_2 - MESSAGE "Check that CDashBuildUrl.txt exists and lists the right URL." - CMND cat ARGS BUILD/CDashBuildUrl.txt + MESSAGE "Check that CDashResults.txt exists and lists the right URL." + CMND cat ARGS BUILD/CDashResults.txt PASS_REGULAR_EXPRESSION_ALL - "${cdash_url_expected_regex}" + "Link to this build's results on CDash:" + "${cdash_build_url_expected_regex}" ) # NOTE: The above test is never actually submitted to CDash, even when # ${PACKAGE_NAME}_CTEST_DRIVER_SUBMIT_TO is set. This is so we can diff --git a/tribits/ctest_driver/TribitsCTestDriverCore.cmake b/tribits/ctest_driver/TribitsCTestDriverCore.cmake index 253dea48a..04deb917a 100644 --- a/tribits/ctest_driver/TribitsCTestDriverCore.cmake +++ b/tribits/ctest_driver/TribitsCTestDriverCore.cmake @@ -323,6 +323,7 @@ include(TribitsCTestDriverCoreHelpers) # * `Determining what testing-related actions are performed (tribits_ctest_driver())`_ # * `Determining how the results are displayed on CDash (tribits_ctest_driver())`_ # * `Specifying where the results go to CDash (tribits_ctest_driver())`_ +# * `Links to results on CDash (tribits_ctest_driver())`_ # * `Determining what TriBITS repositories are included (tribits_ctest_driver())`_ # * `All-at-once versus package-by-package mode (tribits_ctest_driver())`_ # * `Multiple ctest -S invocations (tribits_ctest_driver())`_ @@ -1166,6 +1167,63 @@ include(TribitsCTestDriverCoreHelpers) # not be performed. For more details, see `TRIBITS_2ND_CTEST_DROP_SITE`_ and # `TRIBITS_2ND_CTEST_DROP_LOCATION`_. # +# .. _Links to results on CDash (tribits_ctest_driver()): +# +# **Links to results on CDash (tribits_ctest_driver()):** +# +# Links to where the results will be posted on CDash are printed to STDOUT +# before it performs any actions and at end after all of the actions and +# submits have been completed. +# +# The results are printed to STDOUT in a section that looks like:: +# +# Link to this build's results on CDash: +# +# +# +# Link to all builds for this repo version on CDash: +# +# +# +# Link to all nonpassing tests for all builds for this repo version on CDash: +# +# +# +# The URL ```` is created from the buildname, site, and +# buildstartime fields which is known from the TAG file created by CTest. +# This allows access the results for this particular build on CDash by just +# clicking that link. +# +# The URL ```` provides a link to a CDash +# ``index.php`` query that includes all of the builds with the same base Git +# repo SHA1. This allows comparing the results of this build for other builds +# for this same version of the base Git repository. +# +# The URL ```` gives a link to a CDash +# ``queryTests.php`` query for all of the nonpassing tests for all of the +# builds with this same base project Git repo SHA1. This allows comparing +# test failures across all of the builds for the same base project Git repo +# version. +# +# NOTE: The links ```` and +# ```` are only provided if the base +# project Git repo has the ``.git/`` subdirectory and if ``git log`` +# successfully returns the SHA1 for that base Git repo. +# +# NOTE: The links ```` and +# ```` only consider the Git SHA1 of the +# base project Git repo. For multi-repo projects (see `Multi-Repository +# Support`_), you may get results for builds with different subrepo versions +# and therefore may be comparing apples and oranges. (Projects that commit a +# ``SubRepoVersion.txt`` file to their base Git repo or use Git +# Submodules will have unique base project Git repo SHA1s for different +# versions of the project's repos.) +# +# In addition, a text file ``CDashResults.txt`` will be written in the build +# directory that contains this same CDash link information shown above. This +# allows a process to cat the file ``CDashResults.txt`` to get links to the +# results on CDash. +# # .. _Determining what TriBITS repositories are included (tribits_ctest_driver()): # # **Determining what TriBITS repositories are included (tribits_ctest_driver()):** @@ -2093,10 +2151,15 @@ function(tribits_ctest_driver) ctest_start(${CTEST_START_ARGS}) tribits_remember_if_configure_attempted() - tribits_get_build_url_and_write_to_file(CDASH_BUILD_URL - "${CTEST_BINARY_DIRECTORY}/CDashBuildUrl.txt") - tribits_print_cdash_url("Results will be submitted to CDash at:" - "${CDASH_BUILD_URL}") + + tribits_get_cdash_results_string_and_write_to_file( + CDASH_RESULTS_STRING_OUT CDASH_RESULTS_STRING + CDASH_RESULTS_FILE_OUT "${CTEST_BINARY_DIRECTORY}/CDashResults.txt" ) + message("Results will be submitted on CDash at the following links:\n\n" + "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" + "${CDASH_RESULTS_STRING}\n" + "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" + ) message( "\n***" @@ -2370,8 +2433,11 @@ function(tribits_ctest_driver) report_queued_errors() - tribits_print_cdash_url("See results submitted to CDash at:" - "${CDASH_BUILD_URL}") + message("\nSee results submitted on CDash at the following links:\n\n" + "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n" + "${CDASH_RESULTS_STRING}\n" + "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" + ) if ((NOT UPDATE_FAILED) AND ("${${PROJECT_NAME}_FAILED_PACKAGES}" STREQUAL "")) message( diff --git a/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake b/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake index a72a760f4..04166830c 100644 --- a/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake +++ b/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake @@ -43,16 +43,280 @@ include(TribitsParseArgumentsHelpers) include(TribitsReadTagFile) -# @FUNCTION: tribits_get_build_url_and_write_to_file() +################################################################################ # -# Construct the build URL on CDash given the site name, buildname, and -# buildstamp (take from the TAG file) from inside of a running ctest -S +# This module contains functions for constructing CDash URLs to build and test +# results from inside of a CTest -S script. +# +################################################################################ + + +# @FUNCTION: tribits_get_cdash_results_string_and_write_to_file() +# +# Calls `tribits_get_cdash_results_urls_string()`_ and then writes the CDash +# URLs to a file. +# +# Usage:: +# +# tribits_get_cdash_results_string_and_write_to_file( +# [CDASH_RESULTS_STRING_OUT ] +# [CDASH_RESULTS_FILE_OUT ] +# ) +# +function(tribits_get_cdash_results_string_and_write_to_file) + # Parse args + cmake_parse_arguments( PARSE_ARGV 0 + PARSE "" "" # prefix, options, one_value_keywords + "CDASH_RESULTS_STRING_OUT;CDASH_RESULTS_FILE_OUT" # multi_value_keywords + ) + tribits_check_for_unparsed_arguments(PARSE) + tribits_assert_parse_arg_zero_or_one_value(PARSE CDASH_RESULTS_STRING_OUT + CDASH_RESULTS_FILE_OUT ) + # Get and set CDash results URL + tribits_get_cdash_results_urls_string(cdashResultsString) + if (PARSE_CDASH_RESULTS_STRING_OUT) + set(${PARSE_CDASH_RESULTS_STRING_OUT} "${cdashResultsString}" PARENT_SCOPE) + endif() + if (PARSE_CDASH_RESULTS_FILE_OUT) + file(WRITE "${PARSE_CDASH_RESULTS_FILE_OUT}" "${cdashResultsString}") + endif() +endfunction() + + +# @FUNCTION: tribits_get_cdash_results_urls_string() +# +# Call `tribits_get_cdash_results_urls()`_ and then construct a CDash URLs +# string fit for printing. +# +# Usage:: +# +# tribits_get_cdash_results_urls_string( +# +# ) +# +# Construct the build and test URLs on CDash given the site name, buildname, +# and buildstamp (taken from the TAG file) from inside of a running ctest -S # program and optionally write it to a file as well. # +function(tribits_get_cdash_results_urls_string cdashResultsUrlsStringOut) + tribits_get_cdash_results_urls( + CDASH_BUILD_URL_OUT cdashBuildUrl + CDASH_REVISION_BUILDS_URL_OUT cdashRevisionBuildsUrl + CDASH_REVISION_NONPASSING_TESTS_URL_OUT cdashRevisionNonpassingTestsUrl + ) + tribits_generate_cdash_results_string_from_urls( + CDASH_BUILD_URL "${cdashBuildUrl}" + CDASH_REVISION_BUILDS_URL "${cdashRevisionBuildsUrl}" + CDASH_REVISION_NONPASSING_TESTS_URL "${cdashRevisionNonpassingTestsUrl}" + CDASH_RESULTS_STRING_OUT cdashResultsUrlsString + ) + set(${cdashResultsUrlsStringOut} "${cdashResultsUrlsString}" PARENT_SCOPE) +endfunction() + + +# @FUNCTION: tribits_generate_cdash_results_string_from_urls() +# +# Generate the CDash results URL string given the individual URLs. +# +# Usage:: +# +# tribits_generate_cdash_results_string_from_urls( +# CDASH_BUILD_URL "" +# [CDASH_REVISION_BUILDS_URL ""] +# [CDASH_REVISION_NONPASSING_TESTS_URL ""] +# CDASH_RESULTS_STRING_OUT +# ) +# +# Takes the URLs returned from `tribits_get_cdash_results_urls()`_ and +# generates a string out of them which is set in the return var +# ````. +# +function(tribits_generate_cdash_results_string_from_urls) + # Parse args + cmake_parse_arguments(PARSE_ARGV 0 + PARSE "" "" # prefix, options, one_value_keywords + # multi_value_keywords + "CDASH_BUILD_URL;CDASH_REVISION_BUILDS_URL;CDASH_REVISION_NONPASSING_TESTS_URL;CDASH_RESULTS_STRING_OUT" + ) + tribits_check_for_unparsed_arguments() + tribits_assert_parse_arg_one_value(PARSE CDASH_BUILD_URL + CDASH_RESULTS_STRING_OUT) + tribits_assert_parse_arg_zero_or_one_value(PARSE CDASH_REVISION_BUILDS_URL + CDASH_REVISION_NONPASSING_TESTS_URL) + # Construct CDash results URLs string + set(cdashResultsString "") + string(APPEND cdashResultsString + "Link to this build's results on CDash:\n" + "\n" + " ${PARSE_CDASH_BUILD_URL}\n") + if (PARSE_CDASH_REVISION_BUILDS_URL) + string(APPEND cdashResultsString + "\nLink to all builds for this repo version on CDash:\n" + "\n" + " ${PARSE_CDASH_REVISION_BUILDS_URL}\n") + endif() + if (PARSE_CDASH_REVISION_NONPASSING_TESTS_URL) + string(APPEND cdashResultsString + "\nLink to all nonpassing tests for all builds for this repo version on CDash:\n" + "\n" + " ${PARSE_CDASH_REVISION_NONPASSING_TESTS_URL}\n") + endif() + # Set output + set(${PARSE_CDASH_RESULTS_STRING_OUT} ${cdashResultsString} PARENT_SCOPE) +endfunction() + + +# @FUNCTION: tribits_get_cdash_results_urls() +# +# Construct the build and test URLs on CDash given the site name, buildname, +# and buildstamp (taken from the TAG file) from inside of a running ctest -S +# program and optionally write it to a file as well. +# +# Usage:: +# +# tribits_get_cdash_results_urls( +# CDASH_BUILD_URL_OUT +# [CDASH_REVISION_BUILDS_URL_OUT ] +# [CDASH_REVISION_NONPASSING_TESTS_URL_OUT ] +# ) +# +# Here, the CDash URLs are constructed the following CMake variables already +# set in a ``ctest -S`` process: +# +# * ``CTEST_DROP_SITE`` +# * ``CTEST_DROP_LOCATION`` (``submit.php`` is replaced with ``index.php``) +# * ``CTEST_PROJECT_NAME`` +# * ``CTEST_SITE`` +# * ``CTEST_BUILD_NAME`` +# * ``CTEST_BINARY_DIRECTORY`` +# * ``CTEST_SOURCE_DIRECTORY`` +# +# and other information derived from that. +# +# The buildstamp is read in from the file +# ``${CTEST_BINARY_DIRECTORY}/Testing/TAG``. +# +# If available, the revision SHA1 is obtained from the git repo at +# ``CTEST_SOURCE_DIRECTORY`` if the directory +# ``${CTEST_SOURCE_DIRECTORY}/.git`` exists. If the base project source +# directory is not a git reposistory, then ```` and +# ````, if requested, will be set to +# empty. +# +# Note that the CDash URLs will have ``https://`` added to the beginning so +# that GitHub Actions and other systems will put in a hyperlink to them. +# +function(tribits_get_cdash_results_urls) + # Parse args + cmake_parse_arguments(PARSE_ARGV 0 + PARSE "" "" # prefix, options, one_value_keywords + # multi_value_keywords + "CDASH_BUILD_URL_OUT;CDASH_REVISION_BUILDS_URL_OUT;CDASH_REVISION_NONPASSING_TESTS_URL_OUT" + ) + tribits_check_for_unparsed_arguments(PARSE) + tribits_assert_parse_arg_one_value(PARSE CDASH_BUILD_URL_OUT) + tribits_assert_parse_arg_zero_or_one_value(PARSE CDASH_REVISION_BUILDS_URL_OUT + CDASH_REVISION_NONPASSING_TESTS_URL_OUT) + # Get the info + tribits_get_cdash_build_url(cdashBuildUrl) + tribits_git_repo_sha1("${CTEST_SOURCE_DIRECTORY}" gitRepoSha1 + FAILURE_MESSAGE_OUT gitRepoSha1FailureMsg) + if (gitRepoSha1) + tribits_get_cdash_site_from_drop_site_and_location( + CTEST_DROP_SITE "${CTEST_DROP_SITE}" + CTEST_DROP_LOCATION "${CTEST_DROP_LOCATION}" + CDASH_SITE_URL_OUT cdashSiteUrl + ) + tribits_get_cdash_revision_builds_url( + CDASH_SITE_URL "${cdashSiteUrl}" + PROJECT_NAME "${CTEST_PROJECT_NAME}" + GIT_REPO_SHA1 "${gitRepoSha1}" + CDASH_REVISION_BUILDS_URL_OUT cdashRevisionBuildsUrl + ) + tribits_get_cdash_revision_nonpassing_tests_url( + CDASH_SITE_URL "${cdashSiteUrl}" + PROJECT_NAME "${CTEST_PROJECT_NAME}" + GIT_REPO_SHA1 "${gitRepoSha1}" + CDASH_REVISION_NONPASSING_TESTS_URL_OUT cdashRevisionNonpassingTestsUrl + ) + else() + set(cdashRevisionBuildsUrl "") + set(cdashRevisionNonpassingTestsUrl "") + endif() + # Set the outputs + set(${PARSE_CDASH_BUILD_URL_OUT} "${cdashBuildUrl}" PARENT_SCOPE) + set(${PARSE_CDASH_REVISION_BUILDS_URL_OUT} "${cdashRevisionBuildsUrl}" + PARENT_SCOPE) + set(${PARSE_CDASH_REVISION_NONPASSING_TESTS_URL_OUT} "${cdashRevisionNonpassingTestsUrl}" + PARENT_SCOPE) +endfunction() + + +# @FUNCTION: tribits_get_cdash_revision_builds_url() +# +# Get the CDash URL for all builds with the same repo version SHA1 +# # Usage:: # -# tribits_get_build_url_and_write_to_file( -# [ ] ) +# tribits_get_cdash_revision_builds_url( +# CDASH_SITE_URL +# PROJECT_NAME +# GIT_REPO_SHA1 +# CDASH_REVISION_BUILDS_URL_OUT +# ) +# +function(tribits_get_cdash_revision_builds_url) + cmake_parse_arguments(PARSE_ARGV 0 + PARSE "" "" # prefix, options, one_value_keywords + # multi_value_keywords + "CDASH_SITE_URL;PROJECT_NAME;GIT_REPO_SHA1;CDASH_REVISION_BUILDS_URL_OUT" + ) + tribits_check_for_unparsed_arguments() + tribits_assert_parse_arg_one_value(PARSE CDASH_SITE_URL PROJECT_NAME + GIT_REPO_SHA1 CDASH_REVISION_BUILDS_URL_OUT) + set(${PARSE_CDASH_REVISION_BUILDS_URL_OUT} + "${PARSE_CDASH_SITE_URL}/index.php?project=${PARSE_PROJECT_NAME}&filtercount=1&showfilters=1&field1=revision&compare1=61&value1=${PARSE_GIT_REPO_SHA1}" + PARENT_SCOPE) +endfunction() + + +# @FUNCTION: tribits_get_cdash_revision_nonpassing_tests_url() +# +# Get the CDash URL for all non-passing tests with the same repo version SHA1 +# +# Usage:: +# +# tribits_get_cdash_revision_nonpassing_tests_url( +# CDASH_SITE_URL +# PROJECT_NAME +# GIT_REPO_SHA1 +# CDASH_REVISION_NONPASSING_TESTS_URL_OUT +# ) +# +function(tribits_get_cdash_revision_nonpassing_tests_url) + cmake_parse_arguments( PARSE_ARGV 0 + PARSE "" "" # prefix, options, one_value_keywords + # multi_value_keywords + "CDASH_SITE_URL;PROJECT_NAME;GIT_REPO_SHA1;CDASH_REVISION_NONPASSING_TESTS_URL_OUT" + ) + tribits_check_for_unparsed_arguments() + tribits_assert_parse_arg_one_value(PARSE CDASH_SITE_URL PROJECT_NAME + GIT_REPO_SHA1 CDASH_REVISION_NONPASSING_TESTS_URL_OUT) + set(${PARSE_CDASH_REVISION_NONPASSING_TESTS_URL_OUT} + "${PARSE_CDASH_SITE_URL}/queryTests.php?project=${PARSE_PROJECT_NAME}&filtercount=2&showfilters=1&filtercombine=and&field1=revision&compare1=61&value1=${PARSE_GIT_REPO_SHA1}&field2=status&compare2=62&value2=passed" + PARENT_SCOPE) +endfunction() + + +# @FUNCTION: tribits_get_cdash_build_url() +# +# Construct the build URL on CDash given the site name, buildname, and +# buildstamp (taken from the TAG file) from inside of a running ctest -S +# program. +# +# Usage:: +# +# tribits_get_cdash_build_url() # # Here, ```` returns the CDash Build URL constructed from # the following CMake variables already set in a ``ctest -S`` process: @@ -70,10 +334,7 @@ include(TribitsReadTagFile) # beginning of it so that GitHub Actions and other systems will put in a link # to them. # -# If the file name argument ```` is non-empty, then that -# CDash URL will be written to the file as a single line. -# -function(tribits_get_build_url_and_write_to_file cdashBuildUrlOut cdashBuildUrlFile) +function(tribits_get_cdash_build_url cdashBuildUrlOut) tribits_get_cdash_index_php_from_drop_site_and_location( CTEST_DROP_SITE "${CTEST_DROP_SITE}" CTEST_DROP_LOCATION "${CTEST_DROP_LOCATION}" @@ -87,10 +348,6 @@ function(tribits_get_build_url_and_write_to_file cdashBuildUrlOut cdashBuildUr TAG_FILE "${CTEST_BINARY_DIRECTORY}/Testing/TAG" CDASH_BUILD_URL_OUT cdashBuildUrl ) - set(cdashBuildUrl "${cdashBuildUrl}") - if (cdashBuildUrlFile) - file(WRITE "${cdashBuildUrlFile}" "${cdashBuildUrl}") - endif() set(${cdashBuildUrlOut} "${cdashBuildUrl}" PARENT_SCOPE) endfunction()