[CMake] CxxTest failure output running unit tests

Philip Lowman philip at yhbt.com
Wed Dec 17 01:15:43 EST 2008


On Wed, Dec 17, 2008 at 1:01 AM, Tron Thomas <tron.thomas at verizon.net>wrote:

>  Hey Philip,
> I tried both the flag and exporting the environment variable.  Neither
> method produced the output from the test application when the test failed.
> What is needed to used this feature?
>

Tron,

You'll need to patch CVS CMake with the patch attached here.
http://public.kitware.com/Bug/view.php?id=8255


>
> Philip Lowman wrote:
>
> On Sun, Dec 7, 2008 at 5:44 PM, Tron Thomas <tron.thomas at verizon.net>wrote:
>
>> 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.
>
>
> Patch attached here:
> http://public.kitware.com/Bug/view.php?id=8255
>
> Here's a start at this that doesn't break existing behavior.  If the user
> specifies a "--output-on-failure" flag to CTest or defines the environment
> variable CTEST_OUTPUT_ON_FAILURE then when a test fails, CTest will output
> whatever the test program outputted to the screen.  Usually this should be
> the test assertion(s) that failed.  Here's an example of what it might look
> like when using CxxTest.
>
> user at ubuntu:~/src/test_cmake_cxxtest/build$ echo "export
> CTEST_OUTPUT_ON_FAILURE=1" >> ~/.bashrc
> user at ubuntu:~/src/test_cmake_cxxtest/build$ source ~/.bashrc
> user at ubuntu:~/src/test_cmake_cxxtest/build$ make test
> Running tests...
> Start processing tests
> Test project /home/user/src/test_cmake_cxxtest/build
>   1/  3 Testing unittest_addition ............   Passed
>   2/  3 Testing unittest_addition_fail .......
> *** Test Failed:
> Running 1 test
> In MyTestSuite::testAddition:
> /home/user/src/test_cmake_cxxtest/addition_failure.h:8: Error: Expected (1
> + 1 == 3), found (2 != 3)
> Failed 1 of 1 test
> Success rate: 0%
>
> ***Failed
>   3/  3 Testing unittest_subtraction .........   Passed
>
> 67% tests passed, 1 tests failed out of 3
>
> The following tests FAILED:
>       2 - unittest_addition_fail (Failed)
> Errors while running CTest
> make: *** [test] Error 8
>
>
>
> --
> Philip Lowman
>
>
>


-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081217/f8ed6b96/attachment.htm>


More information about the CMake mailing list