Boost logo

Boost :

Subject: Re: [boost] CMake and Boost Build tests
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-07-26 20:39:52

>> I couldn't make the compile-fail and run-fail targets to work so I
>> just removed them from the cmake test suite. So if your thinking that
>> CMake has a ways to go to be able to offer what we expect, you're right.
> So you are saying that you cannot run a unit test with CMake that is
> meant to show a failure. Wow, what a brilliant system !

Actually cmake's support for fail tests is richer than Boost.Build's.

Here is cmake to implement simple compile fail testing where a regex on
the error messages from the compiler must be matched for the test to pass:

This cmake reads the regex from the first line of the fail test's source

There is lots of flexibility in cmake's fail test design. You can make
tests which must compile but must fail to link. You can make tests which
must complete within a certain time period. Lots of flexibility.

ctest generates XML of all the test results. That can be merged with
JUnit XML from the individual tests easily enough. And the whole lot
sent up to CDash e.g.
where fails and successes can be drilled into, and the cause figured out.


ned Productions Limited Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at