Maybe I just don't know how to use ctest properly.

I'm trying to suppress ctest's output *except* if there is a test failure.

As such, I'm running with the following command:

    ctest --output-on-failure --quiet

According to the man page, --quiet suppresses --verbose, --extra-verbose
and --debug.

According to the man page, --output-on-failure displays anything outputted
by the test program if the test should fail.

Is there a way to get the best of both worlds? That is, suppress everything
unless there is a failure, only display the failing test's output and
ctest's output for the failing test.

Here are my various tests cases:

*1. ctest with no arguments:*

$ ctest
Test project /home/steve/src/cmake_test/.build/debug
    Start 1: foo_test
1/2 Test #1: foo_test .........................   Passed    1.86 sec
    Start 2: bar_test
2/2 Test #2: bar_test .........................***Failed    1.92 sec

50% tests passed, 1 tests failed out of 2

Total Test time (real) =   3.78 sec

The following tests FAILED:
 2 - bar_test (Failed)
Errors while running CTest



*2. ctest with quiet only*

$ ctest --quiet


*3. ctest with output-on-failure only*

$ ctest --output-on-failure
Test project /home/steve/src/cmake_test/.build/debug
    Start 1: foo_test
1/2 Test #1: foo_test .........................   Passed    1.81 sec
    Start 2: bar_test
2/2 Test #2: bar_test .........................***Failed    1.91 sec
Running 1 test case...
testing bar
/home/steve/src/cmake_test/bar/test/main.cpp(10): fatal error: in
"bar_test": critical check bar() == "123 bar" has failed [123 bar foo !=
123 bar]

*** 1 failure is detected in the test module "Master Test Suite"


50% tests passed, 1 tests failed out of 2

Total Test time (real) =   3.71 sec

The following tests FAILED:
 2 - bar_test (Failed)
Errors while running CTest


*4. ctest with both quiet and output-on-failure*

$ ctest --output-on-failure --quiet


Why no error output?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to