Testing#
How to build, run, filter, and debug tests day-to-day. For test discovery configuration (naming matchers, negative tests, the test harness), see Testing Reference.
Building and running tests#
To build and run in one step:
clibra test --preset debug
You can also add --no-build to avoid rebuilding before running tests,
which is the default.
cmake --build --preset debug --target all-tests
ctest --preset debug --output-on-failure
Filtering and running specific tests#
Tests are grouped into categories by type:
clibra test --type unit
clibra test --type integration
clibra test --type regression
clibra test --filter "myfeature.*"
ctest -L unit
ctest -L integration
ctest -L regression
ctest -R hfsm-utest # single test by name
ctest -R "myfeature.*" # pattern match
Debugging failing tests#
clibra test --stop-on-failure
clibra test --rerun-failed
CTest suppresses output by default:
ctest --output-on-failure
ctest -V # verbose
ctest -VV # extra verbose (shows exact commands)
Blessing test outputs#
If your tests compare output against known-good references, pass
BLESS=1 to update all blessed outputs at once:
BLESS=1 ctest # bless all tests
BLESS=1 ctest -L regression # bless regression tests only
LIBRA passes this environment variable through to each test process. There is no mechanism to bless a single test’s output.