How it works

Each test now has a name and a label. In CMake, all tests are numbered, so they also carry a unique number. Having defined the test label, we can now either run the entire set or run tests by their names (using regular expressions), their labels, or their numbers.

Running tests by their names (here, we run all tests with names matching feature) looks as follows:

$ ctest -R feature    Start 1: feature-a1/4 Test #1: feature-a ........................ Passed 0.11 sec    Start 2: feature-b2/4 Test #2: feature-b ........................ Passed 0.11 sec    Start 3: feature-c3/4 Test #3: feature-c ........................ Passed 0.11 sec    Start 4: feature-d4/4 Test #4: feature-d ........................ Passed 0.51 sec100% tests passed, 0 tests ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.