-
Notifications
You must be signed in to change notification settings - Fork 31
Description
I would like to talk about enabling testing in Beman repos
History
This discussion now has a bit of a history:
- The introduction of unconditional
include(CTest): Define thetestbuild target more often #91 - To
enable_testing()+CTestUseLaunchers: Support the use of CTest launchers #109 - Back to
include(CTest): Unconditional test target #153 - (River added:) Do only include(CTest) if dashboard is needed #60
And finally I stumbled into the issue updating beman.scope: Update CMakeLists, prepare for packaging #31
I think the above fully hash out the issue, and this now comes down to a direct discussion between the handful of us who care way too much about the intersection of CMake and CTest.
Discussion
For the reasons discussed in @purpleKarrot's PR and my comment on beman.scope, unconditional test targets via include(CTest) are not workable in the general case. They do not exist on all generators, and they can be misleading even in cases where they do exist.
The generalize-able and fully understood behavior is that if you try to run tests and the tests have not been built, the command should fail by one mechanism or another. The intent of the user is to run the tests provided by the project, and if they didn't build the tests they shouldn't be told a test run passed. Moreover, the mechanism for running tests is ctest, the target driven approach is entirely superfluous.
The only remaining question in my mind is if the cornucopia of other targets dragged in by include(CTest) is desirable for Beman. My answer to this is No. At best they annoyingly overflow target lists, at worst they borderline violate [CMAKE.PASSIVE_PROJECTS].
Proposal
I want to switch Exemplar and the other Beman projects back to the approach used in #109. I'm uncertain if this decision is worthy of the Beman standard. I would want it as something even less than a recommendation, just, "this is how we do it in Beman because a decision needed to be made".
I do not think the other approaches are invalid always, or even in bad taste, but I don't think they meet Beman's particular use case.