Skip to content

Commit

Permalink
Add error check and test for asserting correct order of PRE and POST …
Browse files Browse the repository at this point in the history
…extra repos (SQUASH ME) (TriBITS TriBITSPub#73)
  • Loading branch information
Roscoe A. Bartlett committed Jun 2, 2015
1 parent 1491d93 commit b0e3e4b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ TRIBITS_ADD_ADVANCED_TEST( TribitsProcessExtraRepositoriesList_UnitTests
-D${PROJECT_NAME}_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}
-P "${CMAKE_CURRENT_SOURCE_DIR}/TribitsProcessExtraRepositoriesList_UnitTests.cmake"
PASS_REGULAR_EXPRESSION_ALL
"Final UnitTests Result: num_run = 142"
"Final UnitTests Result: num_run = 143"
"Final UnitTests Result: PASSED"
)

Expand Down
22 changes: 19 additions & 3 deletions test/core/TribitsProcessExtraRepositoriesList_UnitTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ FUNCTION(UNITTEST_TRIBITS_PARSE_EXTRAREPO_PACKSTAT)
UNITTEST_COMPARE_CONST( HASPKGS "HASPACKAGES")
UNITTEST_COMPARE_CONST( PREPOST "POST")

# ToDo: TriBITS:73: Test invalid input that causes error

ENDFUNCTION()


Expand Down Expand Up @@ -269,6 +267,24 @@ FUNCTION(UNITTEST_TRIBITS_PROCESS_EXTRAREPOS_LISTS)

# ToDo: Test error when invalid VC type is given

MESSAGE("\n***")
MESSAGE("*** Test TRIBITS_PROCESS_EXTRAREPOS_LISTS() POST before PRE")
MESSAGE("***\n")

SET(${PROJECT_NAME}_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE Nightly)
SET(MESSAGE_WRAPPER_UNIT_TEST_MODE TRUE)
GLOBAL_SET(MESSAGE_WRAPPER_INPUT)

TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES(
repo0_name "" GIT "[email protected]:repo0" POST Continuous
repo1_name "some/sub/dir" SVN "[email protected]:repo1" PRE Nightly
)

TRIBITS_PROCESS_EXTRAREPOS_LISTS()

UNITTEST_COMPARE_CONST(MESSAGE_WRAPPER_INPUT
"FATAL_ERROR;Error, the 'PRE' extra repo 'repo1_name'; specified in the PACKSTAT field 'PRE' came directly after; a 'POST' extra repo! All 'PRE' extra repos must be listed before all; 'POST' extra repos!")

# ToDo: Test that all PRE repos come before all POST repos

ENDFUNCTION()
Expand Down Expand Up @@ -569,4 +585,4 @@ UNITTEST_TRIBITS_PROCESS_EXTRAREPOS_LISTS_OLD_REPOTYPE()
UNITTEST_TRIBITS_GET_AND_PROCESS_EXTRA_REPOSITORIES_LISTS()

# Pass in the number of expected tests that must pass!
UNITTEST_FINAL_RESULT(142)
UNITTEST_FINAL_RESULT(143)
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ MACRO(TRIBITS_PROCESS_EXTRAREPOS_LISTS)
SET(${PROJECT_NAME}_PRE_REPOSITORIES_DEFAULT)
SET(${PROJECT_NAME}_EXTRA_REPOSITORIES_DEFAULT)

SET(PROCESSED_POST_EXTRAREPO FALSE)

FOREACH(EXTRAREPO_IDX RANGE ${${PROJECT_NAME}_LAST_EXTRAREPO_IDX})

# B.1) Extract the fields for the current extrarepo row
Expand Down Expand Up @@ -406,6 +408,17 @@ MACRO(TRIBITS_PROCESS_EXTRAREPOS_LISTS)
PRINT_VAR(ADD_EXTRAREPO)
ENDIF()

# Assert that PRE repos never come after a POST repo
IF (NOT PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "POST")
SET(PROCESSED_POST_EXTRAREPO TRUE)
ELSEIF (PROCESSED_POST_EXTRAREPO AND EXTRAREPO_PREPOST STREQUAL "PRE")
MESSAGE_WRAPPER(FATAL_ERROR "Error, the 'PRE' extra repo '${EXTRAREPO_NAME}'"
" specified in the PACKSTAT field '${EXTRAREPO_PACKSTAT}' came directly after"
" a 'POST' extra repo! All 'PRE' extra repos must be listed before all"
" 'POST' extra repos!"
)
ENDIF()

# B.3) Add the extrarepo to the list if the classification matches

IF (ADD_EXTRAREPO)
Expand Down

0 comments on commit b0e3e4b

Please sign in to comment.