boost icon indicating copy to clipboard operation
boost copied to clipboard

Do not even add the testing executables when the tests are disabled.

Open dutow opened this issue 6 years ago • 4 comments

The tests are currently targets excluded by the default target, so they aren't built.

But excluded targets are still generated, and created.

This has two results:

  • For IDE projects (like the visual studio generators), each test executable is added as a project, resulting in a long list. This is especially bad if you want to add boost-cmake using ADD_SUBDIRECTORY to your project: you most likely do not want to see those tests there. Maybe you want them on your CI, but definitely not during development.
  • These tests are also the reason why the "configure" phase of CMake takes minutes: by removing them, I reduced the project generation time of CMake to only a few seconds.

I simply reused the BUILD_TESTING option to not even include the test directories if it's not set. As you also used the off setting for some different behavior, I do not think this will be the correct/final solutions to it, but I do think that an option to disable them (and making that a default) would make the project more usable for end users.

dutow avatar Oct 06 '17 05:10 dutow

Yea, we probably need a way to control whether tests are added or not, I am not sure the best way to do that yet.

One, I would like to be able to have tests be able to run without reconfiguring cmake if the dependencies are satisfied. The is probably only useful in a standalone build where the number of tests are small.

Secondly, I would like to be able to support partial checkouts of boost for building and testing. Someone only wants to test one library, so when BUILD_TESTING=Off, the tests are still added but the test dependencies are ignored if they dont exist.

We also need to support users who will use boost through add_subdirectory and is not concerned about running boost's test suite.

For IDE users, is there some property that can be set to better organize tests when they are shown in the IDE? For developers that are using Boost with tests and an IDE, there should be a better way its presented in the GUI.

pfultz2 avatar Oct 06 '17 15:10 pfultz2

The is probably only useful in a standalone build where the number of tests are small.

Yes, I am trying to use this as a subdirectory for building boost libraries in CMake projects, and the tests took far more time up than anything else. And anytime I changed any of my CMakeLists, it ran for several minutes again. In those projects, I am not interested in the results of the boost test suite. With this change, it's just a few seconds.

For IDE users, is there some property that can be set to better organize tests when they are shown in the IDE?

USE_FOLDERS and the FOLDER property. Supports even nested structures with the usual directory separators.

We also need to support users who will use boost through add_subdirectory and is not concerned about running boost's test suite.

This can be checked by using the PARENT_DIRECTORY property.

So maybe use this "do not add the tests by default" behavior if it's a subproject?

dutow avatar Oct 06 '17 15:10 dutow

I'm very interested in not running tests by default. Most libraries that I've used have an explicit target like make check for this.

My use case is for cross compiling.

Any progress on this?

ricejasonf avatar Apr 24 '18 17:04 ricejasonf

I'm very interested in not running tests by default. Most libraries that I've used have an explicit target like make check for this.

Thats the exactly how this works. However, the targets are still added, but not to the all target, which lets you run the tests without reconfiguring cmake(like what most projects do).

The issue:

  • it can be slow for MSVC to configure all the tests
  • All the tests fill up the IDE even when they aren't ran
  • Users may not want to run boost tests with their own tests when using integrated builds

Any progress on this?

I think the solution is to use an ENABLE_TESTS property perhaps with a default value from CMAKE_ENABLE_TESTS variable.

pfultz2 avatar Apr 24 '18 19:04 pfultz2