-
Notifications
You must be signed in to change notification settings - Fork 31
Add cmake Modules for boosttest_discover_tests
#7
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
base: develop
Are you sure you want to change the base?
Add cmake Modules for boosttest_discover_tests
#7
Conversation
I'm not sure how this is going to work. How are people going to use these modules? They aren't going to be shipped with the Boost.Test package as installed by Ideally, after |
Ultimately they should probably somehow be installed together with Boost.Test. But for now they would be in the Boost-source package and need to be copied by hand. |
034d7a3
to
4517644
Compare
I just fixed some small errors. |
Add a new CMake module `BoostTestDiscoverTests` which provides a function `boosttest_discover_tests`. This function `boosttest_discover_tests` is similar to the function `gtest_discover_tests` provided by the `GoogleTest` module (which comes with CMake). It can discover all the tests from an executable target that was built with the Unit-Test-Framework from Boost.Test and creates individual test-targets for each of it. When running these tests using CTest each test will get an individual success or failure entry in CTest's output. This function `boosttest_discover_tests` provides two different modes for discovering tests: `POST_BUILD`, which discovers the tests at build-time, and `PRE_TEST`, which discovers the tests at run-time. (The later mode is more flexible and also better supports cross-compilation scenarios.) For more information read the documentation contained in the module `BoostTestDiscoverTests.cmake`.
In case the test executable does not contain any discoverable tests (that use Boost.Test) a dummy test-target will be registered which is disabled and whose name should indicate that tests are missing.
39777ca
to
226b725
Compare
I rewrote the original implementation and made it compatible with older CMake versions. This So, at least the license should not be a problem to integrate it with Boost. @pdimov Regarding your question how these modules can be used by users of Boost.Test:
|
Hi, I've come here to add my upvote to get this functionality included. |
I created a CMake script module which implements a
boosttest_discover_tests
CMake function, similar to the one provided by CMake for GTest.It also implements the new
PRE_TEST
behavior that exists for GTest which will be released with the next CMake release (3.18).