Skip to content

Commit

Permalink
Implement tribits_get_cdash_index_php_from_drop_site_and_location() (T…
Browse files Browse the repository at this point in the history
…riBITSPub#154)

Need this for calling tribits_get_cdash_build_url_from_tag_file() from
tribits_ctest_driver().
  • Loading branch information
bartlettroscoe committed Aug 10, 2021
1 parent 0f983ef commit 687c1a3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/ctest_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 5"
"Final UnitTests Result: num_run = 6"
"Final UnitTests Result: PASSED"
)

Expand Down
20 changes: 19 additions & 1 deletion test/ctest_driver/CTestDriverUnitTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ function(unittest_tribits_read_ctest_tag_file)
endfunction()


function(unittest_tribits_get_cdash_index_php_from_drop_site_and_location)

message("\n***")
message("*** Testing tribits_get_cdash_index_php_from_drop_site_and_location()")
message("***\n")

tribits_get_cdash_index_php_from_drop_site_and_location(
CTEST_DROP_SITE "some.site.com"
CTEST_DROP_LOCATION "/cdash/submit.php?project=SomeProject"
INDEX_PHP_URL_OUT indexPhpUrl
)

unittest_compare_const(indexPhpUrl "some.site.com/cdash/index.php")

endfunction()


function(unittest_tribits_get_cdash_build_url_from_parts)

message("\n***")
Expand Down Expand Up @@ -128,6 +145,7 @@ global_set(UNITTEST_OVERALL_NUMRUN 0)

# Run the unit test functions
unittest_tribits_read_ctest_tag_file()
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()

Expand All @@ -136,4 +154,4 @@ message("*** Determine final result of all unit tests")
message("***\n")

# Pass in the number of expected tests that must pass!
unittest_final_result(5)
unittest_final_result(6)
21 changes: 21 additions & 0 deletions tribits/ctest_driver/TribitsGetCDashUrlFromTagFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ function(tribits_get_cdash_build_url_from_tag_file)
endfunction()


# @FUNCTION: tribits_get_cdash_index_php_from_drop_site_and_location()
#
# Get the CDash index.php URL from the input CTEST_DROP_SITE and
# CTEST_DROP_LOCATION vars used in a ctest -S script.
#
function(tribits_get_cdash_index_php_from_drop_site_and_location)
cmake_parse_arguments(
PREFIX #prefix
"" #options
"CTEST_DROP_SITE;CTEST_DROP_LOCATION;INDEX_PHP_URL_OUT" #one_value_keywords
"" #multi_value_keywords
${ARGN}
)
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)
endfunction()


# @FUNCTION: tribits_get_cdash_build_url_from_parts()
#
# Create CDash index.php URL from the build parts.
Expand Down

0 comments on commit 687c1a3

Please sign in to comment.