On Sun, Dec 7, 2008 at 5:44 PM, Tron Thomas <span dir="ltr"><<a href="mailto:tron.thomas@verizon.net" target="_blank">tron.thomas@verizon.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.</blockquote><div><br>Patch attached here:<br><a href="http://public.kitware.com/Bug/view.php?id=8255">http://public.kitware.com/Bug/view.php?id=8255</a><br>
<br>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.<br>
<br>user@ubuntu:~/src/test_cmake_cxxtest/build$ echo "export CTEST_OUTPUT_ON_FAILURE=1" >> ~/.bashrc<br>user@ubuntu:~/src/test_cmake_cxxtest/build$ source ~/.bashrc<br>user@ubuntu:~/src/test_cmake_cxxtest/build$ make test<br>
Running tests...<br>Start processing tests<br>Test project /home/user/src/test_cmake_cxxtest/build<br> 1/ 3 Testing unittest_addition ............ Passed<br> 2/ 3 Testing unittest_addition_fail .......<br>*** Test Failed:<br>
Running 1 test<br>In MyTestSuite::testAddition:<br>/home/user/src/test_cmake_cxxtest/addition_failure.h:8: Error: Expected (1 + 1 == 3), found (2 != 3)<br>Failed 1 of 1 test<br>Success rate: 0%<br><br>***Failed <br> 3/ 3 Testing unittest_subtraction ......... Passed<br>
<br>67% tests passed, 1 tests failed out of 3<br><br>The following tests FAILED:<br> 2 - unittest_addition_fail (Failed)<br>Errors while running CTest<br>make: *** [test] Error 8<br><br><br></div></div><br>-- <br>Philip Lowman<br>