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:

https://github.com/ned14/quickcpplib/blob/master/cmakelib/QuickCppLibMakeStandardTests.cmake#L142

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

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.
http://my.cdash.org/index.php?project=Boost.Outcome&date=2017-07-23
where fails and successes can be drilled into, and the cause figured out.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk