10

It is difficult to find information on this because of two reasons:

  • Boost provides a unit test library. I am not referring to this, but have no means of communicating that to Google
  • Building Boost from source involves the custom build system, b2. Its help flag does not mention anything about tests.

I would like to know if boost contains any tests for testing itself. For example many excellent open source libraries and applications have make check or make check-all or make test targets, but I cannot try that here because boost does not use make.

Steven Lu
  • 41,389
  • 58
  • 210
  • 364
  • I found a lead [here](https://gcc.gnu.org/testing/testing-boost.html), which tipped me off to search for `regression`, and even though no `regression.cpp` was found in `boost_1_58_0/status/`, I found many python files inside `boost_1_58_0/tools/build/test/`. – Steven Lu May 17 '15 at 21:39
  • 1
    I'm voting to close this question as off-topic because OP is asking a question about an open-source library that can be answered trivially by looking at the source code. Lack of any effort on OP's part. – jwismar May 17 '15 at 21:43
  • 4
    The source code is 500+MB, sir. It does the world some good to have easily accessible answers. – Steven Lu May 17 '15 at 21:44
  • Indeed. It took 2 minutes to download, 2 minutes to unzip, and 30 seconds to locate the tools/build/test directory. – jwismar May 17 '15 at 21:48
  • Well.. I still have no idea how to use the contents of that directory. Various documentation to be found refers `bjam` which has since been replaced with `b2`. – Steven Lu May 17 '15 at 21:49
  • http://www.boost.org/build/doc/html/bbv2/faq/names.html – jwismar May 17 '15 at 21:57
  • 4
    @jwismar Since when are trivial questions off-topic on SO? Even stuff like [this](http://stackoverflow.com/questions/121162/what-does-the-explicit-keyword-in-c-mean) is the rank seven of "best [tag:c++] questions" despite [good documentation](http://en.cppreference.com/w/cpp/language/explicit) at hand. – Baum mit Augen May 17 '15 at 22:05
  • 3
    This trivial question can be answered trivially but the answer is not readily accessible. If that is somehow off-topic, then so be it. I regret nothing. – Steven Lu May 17 '15 at 22:14
  • @Baum-mi-augen I know, I wasn't happy with "Off Topic" either, but there aren't any other good options. – jwismar May 17 '15 at 22:22
  • 1
    Thank you @StevenLu for asking this question, and taking the heat on our behalf. It was good service to the community. Boost's documentation is written for those who already know everything about it, so it's mostly useless for novices. And despite having used Boost for years, today was the first time I had to build it from source. Without your question and the accepted answer, I am not sure how I could find the one-liner to run all the tests in one go. In other words, how to do the equivalent of `make test`. – gd1 May 16 '21 at 13:03

2 Answers2

15

If you run b2 from the test directory of a given library, it will run the tests for that library.

If you run b2 from the top level status directory of your boost folder, it will run the tests for all libraries.

Marshall Clow
  • 15,972
  • 2
  • 29
  • 45
  • 2
    As Boost Testing Manager I can say this is the correct answer. – GrafikRobot May 18 '15 at 20:13
  • Does this try to build any libraries not yet build? also do I have to specify desired properties (like full or minmal build / architecture and address model) again or is it enough if I specify them when building boost? – MikeMB Feb 14 '18 at 11:08
  • If you don't specify the properties, it will use the defaults. – Marshall Clow Feb 15 '18 at 14:06
  • How is this supposed to work when cross compiling eg for android? b2 is build to run on the host pc, but the tests have to be executed on the android device – Declan Mar 22 '19 at 15:38
0

This appears to be an up-to-date page that talks about running the testing suite within the boost libraries.

http://www.boost.org/build/doc/html/bbv2/builtins/testing.html

It's a bit too long to quote at length.

jwismar
  • 12,164
  • 3
  • 32
  • 44
  • This article appears to assume a great deal of knowledge specific to the boost project itself, well, the Boost.Build system in particular. I'm at my Linux command line, and... well, all I can glean from it is that maybe I can run `b2` with some target (I'll guess the `unit-test` target?) in certain directories in the source tree. Or perhaps the build tree. – Steven Lu May 17 '15 at 22:07
  • The linked page describes how to write unit test rules within Jamfiles. It has nothing about how to run unit tests for Boost libraries, what OP actually asked. You've blamed OP in the lack of any effort, but have not gotten to even understand of what OP was asking. – Alex Che Mar 03 '23 at 16:01