Skip to content

Commit

Permalink
WIP: Add (failing) tests for tests/examples disable behavior (#268)
Browse files Browse the repository at this point in the history
This shows the behavior that is more logical for
<ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF setting default for
<ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
  • Loading branch information
bartlettroscoe committed Aug 19, 2022
1 parent 72999b1 commit e90f854
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 0 deletions.
82 changes: 82 additions & 0 deletions test/core/DependencyUnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,88 @@ create_dependency_handling_test_case(
)


create_dependency_handling_test_case(
EnableEpetra_EnableThyraTpetra_EnableTests_DisableThyraTests
ARGS -DTrilinos_ENABLE_Epetra=ON -DTrilinos_ENABLE_ThyraTpetra=ON
-DTrilinos_ENABLE_TESTS=ON -DThyra_ENABLE_TESTS=OFF
PASS_REGULAR_EXPRESSION_ALL
"Disabling subpackage tests/examples based on parent package tests/examples disables ..."
"-- Setting Thyra_ENABLE_EXAMPLES=OFF because Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraTpetra_ENABLE_TESTS=OFF because parent package Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraTpetra_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"Enabling all tests and/or examples that have not been explicitly disabled because Trilinos_ENABLE_.TESTS,EXAMPLES.=ON ..."
"-- Setting Epetra_ENABLE_TESTS=ON"
"-- Setting Epetra_ENABLE_EXAMPLES=ON"
"Final set of enabled packages: Teuchos RTOp Epetra Triutils Tpetra Thyra 6"
"Final set of enabled SE packages: Teuchos RTOp Epetra Triutils Tpetra ThyraCoreLibs ThyraTpetra Thyra 8"
)


create_dependency_handling_test_case(
EnableEpetra_EnableThyraTpetra_EnableTests_DisableThyraExamples
ARGS -DTrilinos_ENABLE_Epetra=ON -DTrilinos_ENABLE_ThyraTpetra=ON
-DTrilinos_ENABLE_TESTS=ON -DThyra_ENABLE_EXAMPLES=OFF
PASS_REGULAR_EXPRESSION_ALL
"Disabling subpackage tests/examples based on parent package tests/examples disables ..."
"-- Setting ThyraTpetra_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"Enabling all tests and/or examples that have not been explicitly disabled because Trilinos_ENABLE_.TESTS,EXAMPLES.=ON ..."
"-- Setting Epetra_ENABLE_TESTS=ON"
"-- Setting Epetra_ENABLE_EXAMPLES=ON"
"-- Setting ThyraTpetra_ENABLE_TESTS=ON"
)


create_dependency_handling_test_case(
EnableEpetra_EnableThyraTpetra_EnableThyraTests_DisableThyraExamples
ARGS -DTrilinos_ENABLE_Epetra=ON -DTrilinos_ENABLE_ThyraTpetra=ON
-DThyra_ENABLE_TESTS=ON -DThyra_ENABLE_EXAMPLES=OFF
PASS_REGULAR_EXPRESSION_ALL
"Disabling subpackage tests/examples based on parent package tests/examples disables ..."
"-- Setting ThyraTpetra_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"Enabling subpackage tests/examples based on parent package tests/examples enables ..."
"-- Setting ThyraTpetra_ENABLE_TESTS=ON because parent package Thyra_ENABLE_TESTS=ON"
)


create_dependency_handling_test_case(
EnableEpetra_EnableThyraTpetra_EnableTests_DisableThyraTests_DisableThyraExamples
ARGS -DTrilinos_ENABLE_Epetra=ON -DTrilinos_ENABLE_ThyraTpetra=ON
-DTrilinos_ENABLE_TESTS=ON -DThyra_ENABLE_TESTS=OFF -DThyra_ENABLE_EXAMPLES=OFF
PASS_REGULAR_EXPRESSION_ALL
"Disabling subpackage tests/examples based on parent package tests/examples disables ..."
"-- Setting ThyraTpetra_ENABLE_TESTS=OFF because parent package Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraTpetra_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"Enabling all tests and/or examples that have not been explicitly disabled because Trilinos_ENABLE_.TESTS,EXAMPLES.=ON ..."
""
"-- Setting Epetra_ENABLE_TESTS=ON"
"-- Setting Epetra_ENABLE_EXAMPLES=ON"
FAIL_REGULAR_EXPRESSION
"-- Setting Thyra_ENABLE_EXAMPLES=OFF because Thyra_ENABLE_TESTS=OFF"
)


create_dependency_handling_test_case(
EnableEpetra_EnableThyra_EnableTests_DisableThyraTests_EnableThyraTpetraTests_EnableThyraTpetraExamples
ARGS -DTrilinos_ENABLE_Epetra=ON -DTrilinos_ENABLE_Thyra=ON
-DTrilinos_ENABLE_TESTS=ON -DThyra_ENABLE_TESTS=OFF -DThyraTpetra_ENABLE_TESTS=ON -DThyraTpetra_ENABLE_EXAMPLES=ON
PASS_REGULAR_EXPRESSION_ALL
"Disabling subpackage tests/examples based on parent package tests/examples disables ..."
"-- Setting Thyra_ENABLE_EXAMPLES=OFF because Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraCoreLibs_ENABLE_TESTS=OFF because parent package Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraEpetra_ENABLE_TESTS=OFF because parent package Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraEpetraExt_ENABLE_TESTS=OFF because parent package Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraCoreLibs_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"-- Setting ThyraEpetra_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"-- Setting ThyraEpetraExt_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
"Enabling all tests and/or examples that have not been explicitly disabled because Trilinos_ENABLE_.TESTS,EXAMPLES.=ON ..."
"-- Setting Epetra_ENABLE_TESTS=ON"
"-- Setting Epetra_ENABLE_EXAMPLES=ON"
FAIL_REGULAR_EXPRESSION
"-- Setting ThyraTpetra_ENABLE_TESTS=OFF because parent package Thyra_ENABLE_TESTS=OFF"
"-- Setting ThyraTpetra_ENABLE_EXAMPLES=OFF because parent package Thyra_ENABLE_EXAMPLES=OFF"
)


create_dependency_handling_test_case(
TestTrueFalse
ARGS -DTrilinos_ENABLE_ALL_PACKAGES=TRUE -DTrilinos_ENABLE_Zoltan=TRUE
Expand Down
50 changes: 50 additions & 0 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2212,6 +2212,56 @@ tribits_add_advanced_test( TribitsExampleProject_EnableWithSubpackagesB_EnableWi
########################################################################


tribits_add_advanced_test( TribitsExampleProject_ST_EnableSimpleCxx_EnableWithSubpackagesB_EnableTests_DisableWithsubpackagesTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
EXCLUDE_IF_NOT_TRUE ${PROJECT_NAME}_ENABLE_Fortran
XHOSTTYPE "Darwin"

TEST_0
MESSAGE "Configure while disabling WithSubPackages tests and examples"
CMND ${CMAKE_COMMAND}
ARGS
${TribitsExampleProject_COMMON_CONFIG_ARGS}
-DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}
-DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON
-DTribitsExProj_ENABLE_SimpleCxx=ON
-DTribitsExProj_ENABLE_WithSubpackagesB=ON
-DWithSubpackages_ENABLE_TESTS=OFF
-DTribitsExProj_ENABLE_TESTS=ON
-DTribitsExProj_DUMP_PACKAGE_DEPENDENCIES=ON
${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject
PASS_REGULAR_EXPRESSION_ALL
"Disabling subpackage tests/examples based on parent package tests/examples disables ..."
"-- Setting WithSubpackages_ENABLE_EXAMPLES=OFF because WithSubpackages_ENABLE_TESTS=OFF"
"-- Setting WithSubpackagesB_ENABLE_TESTS=OFF because parent package WithSubpackages_ENABLE_TESTS=OFF"
"-- Setting WithSubpackagesB_ENABLE_EXAMPLES=OFF because parent package WithSubpackages_ENABLE_EXAMPLES=OFF"
"Enabling all tests and/or examples that have not been explicitly disabled because TribitsExProj_ENABLE_.TESTS,EXAMPLES.=ON ..."
"-- Setting SimpleCxx_ENABLE_TESTS=ON"
"-- Setting SimpleCxx_ENABLE_EXAMPLES=ON"
"Processing enabled package: SimpleCxx [(]Libs, Tests, Examples[)]"
"-- Performing Test HAVE_SIMPLECXX___INT64"
"-- Performing Test HAVE_SIMPLECXX___INT64 - Failed"
"Processing enabled package: MixedLang [(]Libs[)]"
"Processing enabled package: WithSubpackages [(]A, B[)]"
"Configuring done"
"Generating done"
ALWAYS_FAIL_ON_NONZERO_RETURN

TEST_1 CMND make ARGS ${CTEST_BUILD_FLAGS}

TEST_2 CMND ${CMAKE_CTEST_COMMAND}
PASS_REGULAR_EXPRESSION_ALL
"SimpleCxx_HelloWorldTests.* [.]+ +Passed"
"SimpleCxx_HelloWorldProg.* [.]+ +Passed"
"100% tests passed, 0 tests failed out of 2"

)


########################################################################


tribits_add_advanced_test( TribitsExampleProject_ST_EnableMixedLang_EnableAllForwardDepPackages
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
Expand Down

0 comments on commit e90f854

Please sign in to comment.