-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor and fix test/example enable/disable logic for packages and subpackages #268
Comments
On second thought, I don't think that the logic:
is a good idea. That will break some existing configure scripts that I think I remember seeing. (For example, the current EMPIRE script for Trilinos sets Also, there is really no need to have disables prorate like this since the test suite from one package will never implicitly enable the test suite for another package. In fact, there is nothing in TriBITS that will implicitly enable any test suite except when setting an upper-level test/example enable triggers a lower-level test/example enable. Therefore, I will just have test/example enables/disables propagate from project to parent package to subpackage. I will update the "Proposed Solution" section above for this. |
I am actually working on this as part of #510. |
…riBITSPub#510) These configurations fail to build without the fixes that come in the next commit (see TriBITSPub#510). Also, this pins down that you should only enable tests for subpackages that need tested based on explicit and forward enables (see TriBITSPub#268). I also added some configure checks for how I want the output to look mostly as part of TriBITSPub#268.
…nabless (TriBITSPub#63, TriBITSPub#268, TriBITSPub#299, TriBITSPub#510) This fixes a defect added as part of transitioning to modern CMake targets (TriBITSPub#63, TriBITSPub#299). As part of this, it also changes the behavior of TriBITS to only enable tests/examples for subpackages that are enabled on the forward sweep and not those that are enabled as part of sweeping backward to enabled upstream dependencies needed by enabled packages (see TriBITSPub#268). This is the correct thing to do and will also result in fewer tests being being built and run as part of testing downstream packages using: -D<Project>_ENABLE_<Pkg>=ON -D<Project>_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON -D<Project>_ENABLE_TESTS=ON These changes causes failing tests in the previous commit to pass. I also updated some documentation and removed some commented-out debugging code.
…riBITSPub#510) These configurations fail to build without the fixes that come in the next commit (see TriBITSPub#510). Also, this pins down that you should only enable tests for subpackages that need tested based on explicit and forward enables (see TriBITSPub#268). I also added some configure checks for how I want the output to look mostly as part of TriBITSPub#268.
…nabless (TriBITSPub#63, TriBITSPub#268, TriBITSPub#299, TriBITSPub#510) This fixes a defect added as part of transitioning to modern CMake targets (TriBITSPub#63, TriBITSPub#299). As part of this, it also changes the behavior of TriBITS to only enable tests/examples for subpackages that are enabled on the forward sweep and not those that are enabled as part of sweeping backward to enabled upstream dependencies needed by enabled packages (see TriBITSPub#268). This is the correct thing to do and will also result in fewer tests being being built and run as part of testing downstream packages using: -D<Project>_ENABLE_<Pkg>=ON -D<Project>_ENABLE_ALL_FORWARD_DEP_PACKAGES=ON -D<Project>_ENABLE_TESTS=ON These changes causes failing tests in the previous commit to pass. I also updated some documentation and removed some commented-out debugging code.
…disables (#268) ToDo: Fill in details!
This shows the behavior that is more logical for <ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF setting default for <ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
…les (#268) This makes it so that setting <ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF will set the default for its subpackages <ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
This shows the behavior that is more logical for <ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF setting default for <ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
…les (#268) This makes it so that setting <ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF will set the default for its subpackages <ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
This shows the behavior that is more logical for <ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF setting default for <ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
…les (#268) This makes it so that setting <ParentPackage>_ENABLE_[TESTS|EXAMPLES]=OFF will set the default for its subpackages <ParentPackage><Spkg>_ENABLE_[TESTS|EXAMPLES]=OFF.
Implement disable of subpackages tests/examples based on parent disables (#268)
This is not quite complete due to a defect discovered by a customer and reported in #11002 (see trilinos/Trilinos#11002 (comment)). |
PR #529 should fix this defect. |
I was confirmed in trilinos/Trilinos#11002 (comment) that the problem reported in trilinos/Trilinos#11002 (comment) is addressed in Trilinos 'develop'. Closing as complete again. |
…riBITSPub#268) I had forgotten to update some documentation for how this impacted the tribits_add_[executable_and_][test|advanced_test]() functions.
…riBITSPub#268) I had forgotten to update some documentation for how this impacted the tribits_add_[executable_and_][test|advanced_test]() functions.
@fryeguy52
Description
Currently, as described in trilinos/Trilinos#1999 (comment), there is very basic logic for the enable of tests or examples by including test and example directories using
tribits_add_test_directories()
andtribits_add_example_directories()
that looks like, for example:The problem with this is that if
${PACKAGE_NAME}_ENABLE_TESTS
isOFF
for some reason like it was turned off because of a missing upstream dependency as in trilinos/Trilinos#1999) but${PACKAGE_NAME}_ENABLE_TESTS
isON
, then the subpackages tests will be enabled and will attempt to build but then will fail.Another problem with TriBITS is that if someone enables tests for a package as:
this this will, by default, enable both tests and examples for
<PackageA>
. But if someone sets:then that will only enable the tests and not the examples for
<PackageA>
. That results in great confusion (which happened in the EMPIRE testing of Panzer and even confused me at one point).Possible solution
I think the best solution to all of these problems is to make package and subpackage test and example enables/disables behave just like every other hierarchical TriBITS variable. That is, we flow down from the project, to the package, to the subpackage and we want disables to flow down as well. That is, if you disable the tests for a given package, that should disable the tests for all of its subpackages. I would argue the same for testing at the global level as well. But an explicitly set enable/disable at a lower level should override the higher-level setting. (For example, if
<Project>_ENABLE_TESTS=OFF
but<SomePackage>_ENABLE_TESTS=ON
, then<SomePackage>_ENABLE_TESTS=ON
should be kept.)So I think what we want is the following enable logic for tests and examples (once you get to that point in the logic after all of the disables have been set due to disabled upstream dependencies being disabled).
<Project>_ENABLE_TESTS=ON|OFF
default set<Project>_ENABLE_EXAMPLES=ON|OFF
<Package>
(order does not matter):<Project>_ENABLE_TESTS=ON|OFF
default set<Package>_ENABLE_TESTS=ON|OFF
<Project>_ENABLE_EXAMPLES=ON|OFF
default set<Package>_ENABLE_EXAMPLES=ON|OFF
<Package>_ENABLE_TESTS=ON|OFF
default set<Package>_ENABLE_EXAMPLES=ON|OFF
<Package><SP>
(order does not matter):<Package>_ENABLE_TESTS=ON|OFF
default set<Package><SP>_ENABLE_TESTS=ON|OFF
<Project>_ENABLE_EXAMPLES=ON|OFF
default set<Package><SP>_ENABLE_EXAMPLES=ON|OFF
<Package><SP>_ENABLE_TESTS=ON|OFF
default set<Package><SP>_ENABLE_EXAMPLES=ON|OFF
Then only enable tests for an SE package if
${PACKAGE_NAME}_ENABLE_TESTS=ON
and only enable examples for an SE package if${PACKAGE_NAME}_ENABLE_EXAMPLES=ON
, period (where${PACKAGE_NAME}
is the name of the SE package which can either be a parent package or a subpackage). This logic works fine fortribits_add_test_directories()
andtribits_add_example_directories()
but it is a bit problematic for tests and examples that get added not in one of those directories withtribits_add_executable()
,tribits_add_test()
ortribits_add_advanced_test()
. Really there should be independent functionstribits_add_test_executable()
,tribits_add_example_executable()
,tribits_add_test()
,tribits_add_example_test()
, etc. to make this clear but that would be a major refactoring. Instead, I think we can safely maketribits_add_test()
andtribits_add_advanced_test()
only add the test if either it is in an enabled example or test directory or if${PACKAGE_NAME}_ENABLE_TESTS=ON
.Also, it would be really nice to see if subpackages tests and examples were enabled or not like:
Or, if all of the subpackages had tests or example on of the parent package did, you might just simplify this as:
which is how it looks now. Then we would only show the Test and Example enables for subpackages if they were different than for their parent setting like:
Above, the examples for the
ParameterList
subpackage are not enabled due toTeuchosParameterList_ENABLE_EXAMPLES=OFF
by some means.ToDo:
tribits_add_test()
andtribits_add_advanced_test()
as described aboveThe text was updated successfully, but these errors were encountered: