[CMake] CxxTest failure output running unit tests

Tron Thomas tron.thomas at verizon.net
Sun Dec 7 17:44:21 EST 2008


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.

Bill Hoffman wrote:
> Tron Thomas wrote:
>> Hey Bill,
>> The command listed below looks like it is something that would be 
>> issued from a command line in a terminal, and not something that 
>> would be recognized as a valid operation within a CMake script.
>> How does this command help CMake to configure unit tests for verbose 
>> output?
>>
>
> I guess it does not help.
>
> What do you suggest?
>
> -Bill
>



More information about the CMake mailing list