Skip to content

Add progress summary console logging mode for CTest

This PR adds a new CTest command line parameter --progress that causes CTest to show the test progress in one line that is updated similar to ninja shows the current compile unit being built. Test failures are printed as usual and the final summary is also printed as before. This significantly reduces the verbosity of CTest.

This is a possible implementation for #18175 (closed)

Example:

Normal ctest output:

Test project cmake-example/.build
    Start 1: moduleA-unittest:A::ctor
1/4 Test   #1: moduleA-unittest:A::ctor .......................   Passed    0.01 sec
    Start 2: moduleA-unittest:A::add_directory_content
2/4 Test   #2: moduleA-unittest:A::add_directory_content ......   Passed    0.01 sec
    Start 3: moduleA-unittest:A::for_contents
3/4 Test   #3: moduleA-unittest:A::for_contents ...............   Passed    0.01 sec
    Start 4: moduleB-unittest:B::fetch_directory_contents
4/4 Test   #4: moduleB-unittest:B::fetch_directory_contents ...   Passed    0.01 sec

100% tests passed, 0 tests failed out of 4

Label Time Summary:
a                   =   0.02 sec*proc (3 tests)
b                   =   0.01 sec*proc (1 test)
moduleA-unittest    =   0.02 sec*proc (3 tests)
moduleB-unittest    =   0.01 sec*proc (1 test)

Total Test time (real) =   0.03 sec

ctest -P output:

Test project cmake-example/.build
4/4 Test   #4: moduleB-unittest:B::fetch_directory_contents ...   Passed    0.01 sec
100% tests passed, 0 tests failed out of 4

Label Time Summary:
a                   =   0.02 sec*proc (3 tests)
b                   =   0.01 sec*proc (1 test)
moduleA-unittest    =   0.02 sec*proc (3 tests)
moduleB-unittest    =   0.01 sec*proc (1 test)

Total Test time (real) =   0.03 sec
Edited by Brad King

Merge request reports