[CMake] CxxTest failure output running unit tests

Bill Hoffman bill.hoffman at kitware.com
Sun Dec 7 20:42:16 EST 2008


Tron Thomas wrote:
> I think I have a solution.
> It involves creating a new target that basically replaces the "test" 
> target for Makefiles or the RUN_TESTS target generated for IDE's.
> 
> I added this:
> add_custom_taget(TestAll ALL {CMAKE_TEST_COMMAND} -V)
> 
> I then have a macro define that generates all the information to create 
> a CxxTest unit test.  In that macro I include:
> add_dependencies(TestAll ${Name})
> 
> where ${Name} is an argument passed to the macro that determines the 
> name for the unit test.  This makes sure that all unit tests are built 
> before the TestAll target tries to run tests during its build phase.
> 
> All of these steps cause the unit tests to be run with verbose output, 
> which can help someone understand where problems are when tests fail.  
> It also runs these tests as part of building everything, which is also 
> what I want to happen.
> 
> It would be nice if the original "test" and RUN_TESTS targets could be 
> configured this way without having to create and additional target that 
> replaces them.
> 
But, some people like short output.   If you have lots of output with 
lots of tests it becomes really hard to see where one test starts and 
the next one ends.  So, there would have to be two different types of 
targets.  However, I think this thread is about yet another way someone 
wants the tests to work.  In this case, I think that the verbose output 
is only wanted for tests that fail.  It is not going to be possible to 
make everyone happy....

-Bill


More information about the CMake mailing list