Skip to content

Commit

Permalink
WIP: Working on more CDash URLs (TriBITSPub#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlettroscoe committed Jun 2, 2022
1 parent 799287a commit 7a0fa11
Show file tree
Hide file tree
Showing 3 changed files with 224 additions and 13 deletions.
21 changes: 11 additions & 10 deletions test/ctest_driver/TribitsExampleProject/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -1296,20 +1297,20 @@ function(generate_aao_tests)
CTEST_BUILD_NAME=${PACKAGE_NAME}_CTestDriver_AAO${AAO_POSTFIX}_CDASH_URL
${CTEST_S_SCRIPT_ARGS}
PASS_REGULAR_EXPRESSION_ALL
"NONE does not exist, skipping extra repositories"
"Final set of enabled packages: SimpleCxx 1"
"Final set of enabled SE packages: SimpleCxx 1"
# "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:"
"File '' does NOT exist so all tests passed"
"See results submitted to CDash at:"
"${cdash_url_expected_regex}"
"TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSED"
"${cdash_build_url_expected_regex}"
# "File '' does NOT exist so all tests passed"
# "See results submitted to CDash at:"
# "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
PASS_REGULAR_EXPRESSION_ALL
"${cdash_url_expected_regex}"
"${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
Expand Down
13 changes: 11 additions & 2 deletions tribits/ctest_driver/TribitsCTestDriverCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2093,11 +2093,21 @@ function(tribits_ctest_driver)
ctest_start(${CTEST_START_ARGS})

tribits_remember_if_configure_attempted()

# ToDo: Remove this!
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}")

# ToDo: Get this working!
tribits_get_cdash_results_urls_and_write_to_file(
"${CTEST_BINARY_DIRECTORY}/CDashBuildUrl.txt"
CDASH_RESULTS_URLS_STRING_OUT CDASH_RESULTS_URLS_STRING)
message("Results will be submitted on CDash at:\n\n${CDASH_RESULTS_URLS_STRING}")

#return() # ToDo: Remove this temporary return!

message(
"\n***"
"\n*** Update the source code repositories ..."
Expand Down Expand Up @@ -2370,8 +2380,7 @@ function(tribits_ctest_driver)

report_queued_errors()

tribits_print_cdash_url("See results submitted to CDash at:"
"${CDASH_BUILD_URL}")
message("See results submitted to CDash at:\n\n${CDASH_RESULTS_URLS_STRING}")

if ((NOT UPDATE_FAILED) AND ("${${PROJECT_NAME}_FAILED_PACKAGES}" STREQUAL ""))
message(
Expand Down
203 changes: 202 additions & 1 deletion tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,211 @@
# @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

include(TribitsReadTagFile)


################################################################################
#
# 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_urls_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_urls_and_write_to_file(
# <cdashResultsUrlsFile>
# [CDASH_RESULTS_URLS_STRING_OUT <cdashResultsUrlsStringOut>] )
#
# If ``<cdashResultsUrlsStringOut>`` is non-empty, then that variable will
# contain the string of CDash results URLs that was written to the file
# <cdashResultsUrlsFile>.
#
function(tribits_get_cdash_results_urls_and_write_to_file
cdashResultsUrlsFile
)
cmake_parse_arguments( PARSE_ARGV 1
PARSE #prefix
"" #options
"" #one_value_keywords
"CDASH_RESULTS_URLS_STRING_OUT" #multi_value_keywords
)
tribits_check_for_unparsed_arguments()
print_var(PARSE_CDASH_RESULTS_URLS_STRING_OUT)
tribits_assert_parse_arg_zero_or_one_value(PARSE CDASH_RESULTS_URLS_STRING_OUT)
tribits_get_cdash_results_urls_string(cdashResultsUrlsString)
if (PARSE_CDASH_RESULTS_URLS_STRING_OUT)
set(${PARSE_CDASH_RESULTS_URLS_STRING_OUT} "${cdashResultsUrlsString}"
PARENT_SCOPE)
endif()
endfunction()


# @FUNCTION: tribits_get_cdash_results_urls_string()
#
# Calls `tribits_get_cdash_results_urls()`_ and then constructs the CDash URLs
# string fit for printing.

# 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_string(
# <cdashResultsUrlsStringOut>
# )
#
function(tribits_get_cdash_results_urls_string cdashResultsUrlsStringOut)
message(WARNING "ToDo: Implement!")
set(${cdashResultsUrlsStringOut} "ToDo: Construct cdashResultsUrlsStringOut!"
PARENT_SCOPE)
endfunction()


# @FUNCTION: tribits_generate_cdash_results_urls_string_from_parts()
#
# Generate the CDash results URL string given the individual URLs.
#
# Usage::
#
# tribits_generate_cdash_results_urls_string_from_parts(
# CDASH_BUILD_URL <cdashBuildUrl>
# [CDASH_REVISION_BUILDS_URL <cdashRevisionBuildsUrl>]
# [CDASH_REVISION_NONPASSING_TESTS_URL <cdashRevisionNonpassingTestsUrl>]
# CDASH_RESULTS_URL_STRING_OUT <cdashResultsUrlsStringOut>
# )
#
# Takes the URLs returned from `tribits_get_cdash_results_urls()`_ and
# generates a string out of them which is set in the return var
# ``<cdashResultsUrlsStringOut>``.
#
function(tribits_generate_cdash_results_urls_string_from_parts)
# Parse args
cmake_parse_arguments(
PARSE #prefix
"" #options
#one_value_keywords
"CDASH_BUILD_URL;CDASH_REVISION_BUILDS_URL;CDASH_REVISION_NONPASSING_TESTS_URL;CDASH_RESULTS_URL_STRING_OUT"
"" #multi_value_keywords
${ARGN}
)
tribits_check_for_unparsed_arguments()

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 <cdashBuildUrlOut>
# [CDASH_REVISION_BUILDS_URL_OUT <cdashRevisionBuildsUrlOut>]
# [CDASH_REVISION_NONPASSING_TESTS_URL_OUT <cdashRevisionNonpassingTestsUrlOut>]
# )
#
# 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``.
#
# The revision SHA1 is obtained from the git repo at
# ``CTEST_SOURCE_DIRECTORY`` if the directory
# ``${CTEST_SOURCE_DIRECTORY}/.git`` exists.
#
# 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_revision_builds_url()


# @FUNCTION: tribits_get_revision_failed_tests_url()


# @FUNCTION: tribits_base_repo_sha1()
















# @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
# buildstamp (taken from the TAG file) from inside of a running ctest -S
# program and optionally write it to a file as well.
#
# Usage::
Expand Down

0 comments on commit 7a0fa11

Please sign in to comment.