diff --git a/test/ctest_driver/CMakeLists.txt b/test/ctest_driver/CMakeLists.txt index e4b75a620..92455ce4f 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 = 6" + "Final UnitTests Result: num_run = 9" "Final UnitTests Result: PASSED" ) diff --git a/test/ctest_driver/CTestDriverUnitTests.cmake b/test/ctest_driver/CTestDriverUnitTests.cmake index 67ab8079a..ee6d5b8df 100644 --- a/test/ctest_driver/CTestDriverUnitTests.cmake +++ b/test/ctest_driver/CTestDriverUnitTests.cmake @@ -73,6 +73,23 @@ function(unittest_tribits_read_ctest_tag_file) endfunction() +function(unittest_tribits_get_cdash_site_from_drop_site_and_location) + + message("\n***") + message("*** Testing tribits_get_cdash_site_from_drop_site_and_location()") + message("***\n") + + tribits_get_cdash_site_from_drop_site_and_location( + CTEST_DROP_SITE "some.site.com" + CTEST_DROP_LOCATION "/cdash/submit.php?project=SomeProject" + CDASH_SITE_URL_OUT cdashSiteUrl + ) + + unittest_compare_const(cdashSiteUrl "https://some.site.com/cdash") + +endfunction() + + function(unittest_tribits_get_cdash_index_php_from_drop_site_and_location) message("\n***") @@ -85,7 +102,7 @@ function(unittest_tribits_get_cdash_index_php_from_drop_site_and_location) INDEX_PHP_URL_OUT indexPhpUrl ) - unittest_compare_const(indexPhpUrl "some.site.com/cdash/index.php") + unittest_compare_const(indexPhpUrl "https://some.site.com/cdash/index.php") endfunction() @@ -142,6 +159,7 @@ unittest_initialize_vars() # Run the unit test functions 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() unittest_tribits_get_cdash_build_url_from_parts() unittest_tribits_get_cdash_build_url_from_tag_file() @@ -151,4 +169,4 @@ message("*** Determine final result of all unit tests") message("***\n") # Pass in the number of expected tests that must pass! -unittest_final_result(6) +unittest_final_result(9) diff --git a/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake b/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake index 9fc812b63..7784c7e49 100644 --- a/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake +++ b/tribits/ctest_driver/TribitsGetCDashUrlsInsideCTestS.cmake @@ -1,3 +1,45 @@ +# @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(PrintVar) +include(TribitsParseArgumentsHelpers) include(TribitsReadTagFile) @@ -125,11 +167,45 @@ function(tribits_get_cdash_index_php_from_drop_site_and_location) "" #multi_value_keywords ${ARGN} ) + tribits_get_cdash_site_from_drop_site_and_location( + CTEST_DROP_SITE ${PREFIX_CTEST_DROP_SITE} + CTEST_DROP_LOCATION ${PREFIX_CTEST_DROP_LOCATION} + CDASH_SITE_URL_OUT cdashSiteUrl ) + SET(${PREFIX_INDEX_PHP_URL_OUT} "${cdashSiteUrl}/index.php" PARENT_SCOPE) +endfunction() + + +# @FUNCTION: tribits_get_cdash_site_from_drop_site_and_location() +# +# Get the full CDash site base URL from the input CTEST_DROP_SITE and +# CTEST_DROP_LOCATION vars used in a ctest -S script. +# +# Usage:: +# +# tribits_get_cdash_site_from_drop_site_and_location( +# CTEST_DROP_SITE +# CTEST_DROP_LOCATION +# CDASH_SITE_URL_OUT +# ) +# +function(tribits_get_cdash_site_from_drop_site_and_location) + # Parse args + cmake_parse_arguments(PARSE_ARGV 0 + PREFIX #prefix + "" #options + "CTEST_DROP_SITE;CTEST_DROP_LOCATION;CDASH_SITE_URL_OUT" #one_value_keywords + "" #multi_value_keywords + ) + tribits_check_for_unparsed_arguments(PREFIX) + tribits_assert_parse_arg_one_value(PREFIX CTEST_DROP_SITE) + tribits_assert_parse_arg_one_value(PREFIX CTEST_DROP_LOCATION) + tribits_assert_parse_arg_one_value(PREFIX CDASH_SITE_URL_OUT) + # Get the full CDash site from parts string(FIND "${PREFIX_CTEST_DROP_LOCATION}" "?" endOfSubmitPhpIdx) string(SUBSTRING "${PREFIX_CTEST_DROP_LOCATION}" 0 ${endOfSubmitPhpIdx} submitPhpPart) - string(REPLACE "submit.php" "index.php" indexPhpPart "${submitPhpPart}") - set(indexPhpUrl "${PREFIX_CTEST_DROP_SITE}${indexPhpPart}") - SET(${PREFIX_INDEX_PHP_URL_OUT} "${indexPhpUrl}" PARENT_SCOPE) + string(REPLACE "/submit.php" "" endCDashUrl "${submitPhpPart}") + set(cdashSiteUrl "${PREFIX_CTEST_DROP_SITE}${endCDashUrl}") + set(${PREFIX_CDASH_SITE_URL_OUT} "https://${cdashSiteUrl}" PARENT_SCOPE) endfunction()