Skip to content

Commit

Permalink
Fix mapping of labels to subprojects (#183)
Browse files Browse the repository at this point in the history
I had to create a new macro
TRIBITS_CTEST_DRIVER_SET_LABELS_TO_SUBPROJECTS_MAPPING() that is only used by
the outer CTest Driver code.  That macro onlly sets
CTEST_LABELS_FOR_SUBPROJECTS to the exact set of packages to be explictly
tested.  That is needed to limit the number of rows that shows up on CDash.

I also simplified the macro TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING() which
is now only used by the inner CMake configure and only matters when running
ctest locally.  In this case, there is no reason to limit the set of
subprojects defined because ctest will only show lines for
subproejcts/packages that have 1 or more tests defined.

Given that these macros only cat a CMake/CTest var
CTEST_LABELS_FOR_SUBPROJECTS I took out the inner if statement basd on
${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES since this is just setting a var
which will be ignored by older versions of CMake/CTest.

I added some strong checks to make sure that CTEST_LABELS_FOR_SUBPROJECTS is
set correctly for each test case and then submitted these cases to CDash to
confirm that the correct number of rows are showing up.

Build/Test Cases Summary
Enabled Packages:
Enabled all Packages
0) MPI_DEBUG => passed: passed=247,notpassed=0 (0.62 min)
1) SERIAL_RELEASE => passed: passed=247,notpassed=0 (0.61 min)
2) MPI_DEBUG_CMAKE-3.6.2 => passed: passed=268,notpassed=0 (0.72 min)
3) SERIAL_RELEASE_CMAKE-3.6.2 => passed: passed=268,notpassed=0 (0.65 min)
  • Loading branch information
bartlettroscoe committed Aug 7, 2017
1 parent 73a2990 commit d03fdde
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 12 deletions.
96 changes: 96 additions & 0 deletions test/ctest_driver/TribitsExampleProject/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES)
"Final set of enabled SE packages: SimpleCxx MixedLang WithSubpackagesA WithSubpackagesB WithSubpackagesC WithSubpackages WrapExternal"
"Final set of packages to be explicitly processed by CTest/CDash: SimpleCxx MixedLang WithSubpackages WrapExternal 4"
"Configure, build, test and submit results all-at-once for all enabled packages"
"CTEST_LABELS_FOR_SUBPROJECTS='SimpleCxx[;]MixedLang[;]WithSubpackages[;]WrapExternal'"
"Configuring [.][.][.]"
"CONFIGURE_OPTIONS = '-DTribitsExProj_TRIBITS_DIR=.*/tribits[;]-DCTEST_USE_LAUNCHERS:BOOL=1[;]-DTribitsExProj_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON[;]-DTribitsExProj_WARNINGS_AS_ERRORS_FLAGS:STRING=[;]-DTribitsExProj_ALLOW_NO_PACKAGES:BOOL=ON[;]-DTribitsExProj_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=ON[;]-DTribitsExProj_DEPS_XML_OUTPUT_FILE:FILEPATH=[;]-DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE:BOOL=TRUE[;]-DTribitsExProj_EXTRAREPOS_FILE:STRING=[;]-DTribitsExProj_IGNORE_MISSING_EXTRA_REPOSITORIES:BOOL=ON[;]-DTribitsExProj_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE:STRING=Continuous[;]${CONFIGURE_OPTIONS_MATCH_CTEST_USE_NEW_AAO_FEATURES}-DTribitsExProj_ENABLE_ALL_PACKAGES=ON[;]-DTribitsExProj_ENABLE_TESTS:BOOL=ON[;]-DBUILD_SHARED_LIBS:BOOL=ON[;]-DCMAKE_BUILD_TYPE=DEBUG[;]-DCMAKE_C_COMPILER=gcc[;]-DCMAKE_CXX_COMPILER=g[+][+][;]-DCMAKE_Fortran_COMPILER=gfortran[;]-DTribitsExProj_ENABLE_Fortran=ON[;]-DTribitsExProj_TRACE_ADD_TEST=ON'"
"Configure PASSED"
Expand Down Expand Up @@ -772,6 +773,51 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES)
# 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.

TRIBITS_ADD_ADVANCED_TEST( CTestDriver_AAO${AAO_POSTFIX}_ST_SimpleCxx_PASS
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0
MESSAGE "Symlink TribitsExampleProject so no need to clone (which would not work)."
CMND ln
ARGS -s ${TribitsExProj_DIR} .
TEST_1
MESSAGE "Run ctest driver testing everyting but no push."
CMND env
ARGS
CTEST_DASHBOARD_ROOT=PWD
${AAO_COMMON_ENV_ARGS}
TribitsExProj_ENABLE_SECONDARY_TESTED_CODE=TRUE
TribitsExProj_PACKAGES=SimpleCxx
CTEST_EXPLICITLY_ENABLE_IMPLICITLY_ENABLED_PACKAGES=FALSE
${CTEST_DROP_SITE_ENV_ARGS}
CTEST_BUILD_NAME=${PACKAGE_NAME}_CTestDriver_AAO${AAO_POSTFIX}_ST_SimpleCxx_PASS
${CTEST_S_SCRIPT_ARGS}
PASS_REGULAR_EXPRESSION_ALL
"NONE does not exist, skipping extra repositories"
"Setting SimpleCxx_ENABLE_TESTS=ON"
"Final set of enabled packages: SimpleCxx 1"
"Final set of enabled SE packages: SimpleCxx 1"
"Final set of non-enabled SE packages: MixedLang WithSubpackagesA WithSubpackagesB WithSubpackagesC WithSubpackages WrapExternal 6"
"Final set of packages to be explicitly processed by CTest/CDash: SimpleCxx 1"
"Configure, build, test and submit results all-at-once for all enabled packages"
"CTEST_LABELS_FOR_SUBPROJECTS='SimpleCxx'"
"Configuring [.][.][.]"
"CONFIGURE_OPTIONS = '-DTribitsExProj_TRIBITS_DIR=.*/tribits[;].+[;]${CONFIGURE_OPTIONS_MATCH_CTEST_USE_NEW_AAO_FEATURES}-DTribitsExProj_ENABLE_SimpleCxx=ON[;]-DTribitsExProj_ENABLE_TESTS:BOOL=ON[;]-DBUILD_SHARED_LIBS:BOOL=ON[;].+'"
"Configure PASSED"
"Building all targets [.][.][.]"
"Build output: BUILD_ALL_NUM_ERRORS='0',BUILD_ALL_RETURN_VAL='0'"
"Build PASSED"
"Running tests .parallel level 1."
"SimpleCxx_HelloWorldTests [.]+ +Passed"
"SimpleCxx_HelloWorldProg [.]+ +Passed"
"File '' does NOT exist so all tests passed"
"TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED"
ALWAYS_FAIL_ON_NONZERO_RETURN
)
# NOTE: The above test enables just one package with no upstream packages
# at all. It should display just a single row on CDash. We can't detect
# that here but this submits the data so we can inspect that on CDash.

TRIBITS_ADD_ADVANCED_TEST( CTestDriver_AAO${AAO_POSTFIX}_ST_PackagesSubset_PASS
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
Expand Down Expand Up @@ -800,6 +846,7 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES)
"Final set of non-enabled SE packages: WithSubpackagesB WithSubpackagesC 2"
"Final set of packages to be explicitly processed by CTest/CDash: SimpleCxx WrapExternal 2"
"Configure, build, test and submit results all-at-once for all enabled packages"
"CTEST_LABELS_FOR_SUBPROJECTS='SimpleCxx[;]WrapExternal'"
"Configuring [.][.][.]"
"CONFIGURE_OPTIONS = '-DTribitsExProj_TRIBITS_DIR=.*/tribits[;].+[;]${CONFIGURE_OPTIONS_MATCH_CTEST_USE_NEW_AAO_FEATURES}-DTribitsExProj_ENABLE_SimpleCxx=ON[;]-DTribitsExProj_ENABLE_WrapExternal=ON[;]-DTribitsExProj_ENABLE_TESTS:BOOL=ON[;]-DBUILD_SHARED_LIBS:BOOL=ON[;].+'"
"Configure PASSED"
Expand Down Expand Up @@ -1176,6 +1223,7 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES)
"Running all-at-once experimental dashboard"
"Final set of packages to be explicitly processed by CTest/CDash: SimpleCxx MixedLang WithSubpackages WrapExternal 4"
"Configure, build, test and submit results all-at-once for all enabled packages"
"CTEST_LABELS_FOR_SUBPROJECTS='SimpleCxx[;]MixedLang[;]WithSubpackages[;]WrapExternal'"
"TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED"
ALWAYS_FAIL_ON_NONZERO_RETURN
TEST_2
Expand All @@ -1188,6 +1236,53 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES)
ALWAYS_FAIL_ON_NONZERO_RETURN
)

TRIBITS_ADD_ADVANCED_TEST( CTestDriver_AAO${AAO_POSTFIX}_Dashboard_ST_SimpleCxx_PASS
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
EXCLUDE_IF_NOT_TRUE ${PROJECT_NAME}_ENABLE_Fortran
TEST_0 CMND ${CMAKE_COMMAND}
MESSAGE "Do the initial configure"
ARGS
${TribitsExampleProject_AAO_COMMON_CONFIG_ARGS}
-DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}
-DTribitsExProj_ENABLE_Fortran=ON
-DTribitsExProj_ENABLE_SimpleCxx=ON
-DTribitsExProj_ENABLE_TESTS=ON
-DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON
${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject
PASS_REGULAR_EXPRESSION_ALL
"Setting SimpleCxx_ENABLE_TESTS=ON"
"Final set of enabled SE packages: SimpleCxx 1"
"Processing enabled package: SimpleCxx [(]Libs, Tests, Examples[)]"
"Generating done"
ALWAYS_FAIL_ON_NONZERO_RETURN
TEST_1
MESSAGE "Run the dashboard target"
CMND env
ARGS
CTEST_BUILD_NAME=${PROJECT_NAME}_CTestDriver_AAO${AAO_POSTFIX}_Dashboard_ST_SimpleCxx_PASS
make dashboard
PASS_REGULAR_EXPRESSION_ALL
"Configure, build, test and submit results all-at-once for all enabled packages"
"Final set of packages to be explicitly processed by CTest/CDash: SimpleCxx 1"
"CTEST_LABELS_FOR_SUBPROJECTS='SimpleCxx'"
"TRIBITS_CTEST_DRIVER_ERROR_QUEUE is empty. All is well."
"TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED"
ALWAYS_FAIL_ON_NONZERO_RETURN
TEST_2
MESSAGE "Verify that the right set of packages are set"
CMND ${CMAKE_COMMAND} ARGS .
PASS_REGULAR_EXPRESSION_ALL
"Final set of enabled SE packages: SimpleCxx 1"
"Processing enabled package: SimpleCxx [(]Libs, Tests, Examples[)]"
"Generating done"
"Generating done"
ALWAYS_FAIL_ON_NONZERO_RETURN
)
# The above test should result in a single row on CDash for the build.
# This local checking here can't determine that but it uploads the data on
# CDash where it can be inspected.

TRIBITS_ADD_ADVANCED_TEST( CTestDriver_AAO${AAO_POSTFIX}_Dashboard_ST_PackagesSubset_PASS
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
Expand Down Expand Up @@ -1222,6 +1317,7 @@ FUNCTION(GENERATE_AAO_TESTS USE_NEW_AAO_CTEST_CDASH_FEATURES)
PASS_REGULAR_EXPRESSION_ALL
"Configure, build, test and submit results all-at-once for all enabled packages"
"Final set of packages to be explicitly processed by CTest/CDash: SimpleCxx WrapExternal 2"
"CTEST_LABELS_FOR_SUBPROJECTS='SimpleCxx[;]WrapExternal'"
"TRIBITS_CTEST_DRIVER_ERROR_QUEUE is empty. All is well."
"TRIBITS_CTEST_DRIVER: OVERALL: ALL PASSSED"
ALWAYS_FAIL_ON_NONZERO_RETURN
Expand Down
20 changes: 9 additions & 11 deletions tribits/core/package_arch/TribitsGlobalMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1971,20 +1971,18 @@ MACRO(TRIBITS_SETUP_ENV)
ENDMACRO()

#
# Set mapping of labels to subprojects (i.e. TriBITS packages) for CTest and
# CDash
# Set mapping of labels to subprojects (i.e. TriBITS packages) for local CTest
# only.
#
# NOTE: This macro is only used define mapping of labels to subprojects for
# running ctest locally. This results in summarizing the tests run for each
# subproject (TriBITS package) if any tests were run. Therefore, it is
# harmless to define the mapping for every TriBITS package. Only TriBITS
# packages will be listed in the summary if they had one or more tests run.
#

MACRO(TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING)
IF (${PROJECT_NAME}_CTEST_USE_NEW_AAO_FEATURES)
SET(CTEST_LABELS_FOR_SUBPROJECTS)
FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES})
TRIBITS_IS_PRIMARY_META_PROJECT_PACKAGE(${TRIBITS_PACKAGE} PACKAGE_IS_PMPP)
IF (PACKAGE_IS_PMPP)
LIST(APPEND CTEST_LABELS_FOR_SUBPROJECTS ${TRIBITS_PACKAGE})
ENDIF()
ENDFOREACH()
ENDIF()
SET(CTEST_LABELS_FOR_SUBPROJECTS ${${PROJECT_NAME}_PACKAGES})
ENDMACRO()


Expand Down
21 changes: 20 additions & 1 deletion tribits/ctest_driver/TribitsCTestDriverCoreHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,24 @@ MACRO(SELECT_FINAL_SET_OF_PACKAGES_TO_DIRECTLY_TEST)
ENDMACRO()


#
# Set mapping of labels to subprojects (i.e. TriBITS packages) for CDash.
#
# NOTE: Unlike for the inner CMake configure, only subprojects that are
# explicitly tested will be marked as a CDash subproject. This limits the
# rows in CDash. This does not seem to be a problem for when running ctest
# locally. When run locally, ctest will just report aggregated times for
# subprojects that have 1 or more tests. Not true for CDash.
#

MACRO(TRIBITS_CTEST_DRIVER_SET_LABELS_TO_SUBPROJECTS_MAPPING)
SET(CTEST_LABELS_FOR_SUBPROJECTS)
FOREACH(TRIBITS_PACKAGE ${${PROJECT_NAME}_PACKAGES_TO_DIRECTLY_TEST})
LIST(APPEND CTEST_LABELS_FOR_SUBPROJECTS ${TRIBITS_PACKAGE})
ENDFOREACH()
ENDMACRO()


#
# Select the default generator.
#
Expand Down Expand Up @@ -1174,7 +1192,8 @@ MACRO(TRIBITS_CTEST_ALL_AT_ONCE)
# A) Define mapping from labels to subprojects and gather configure arguments
#

TRIBITS_SET_LABELS_TO_SUBPROJECTS_MAPPING()
TRIBITS_CTEST_DRIVER_SET_LABELS_TO_SUBPROJECTS_MAPPING()
PRINT_VAR(CTEST_LABELS_FOR_SUBPROJECTS)

MESSAGE("")
MESSAGE("Configuring ...")
Expand Down

0 comments on commit d03fdde

Please sign in to comment.