Filters
Applying mutation testing onto existing large project might be overwhelming at first since Mull would generate a lot of mutants.
Mull provides several filters enabling precise control over what is being mutated.
File Path
Section titled “File Path”File path filter allows selection of which files to enable or disable. This is useful in cases when you want to start incrementally with handful of modules, or to ignore irrelevant files such as third-party modules.
To enable this filter add the needed flags to the config, e.g.:
excludePaths: - .*testutil.* - .*third-party.*Alternatively, enable a single module, e.g. encoder.c and encoder.h:
includePaths: - .*encoder.*Manual Filters
Section titled “Manual Filters”In some cases even a single file may produce too many mutants, or there might be a case when a mutant can’t be easily killed by the test suite.
In such cases, you may disable certain parts of the code via manual annotations, such as mull-on/mull-off or more precise ones mull-ignore or mull-ignore-next:
// disable all mutations from mull-off till mull-on// mull-offint ignore_all(int a, int b) { return a + b;}// mull-on
// disable cxx_add_to_sub from mull-off till mull-on// mull-off: cxx_add_to_subint ignore_some(int a, int b, int c) { return a + b - c;}// mull-on
// disable all mutations till the end of file// mull-offint ignore_till_eof(int a, int b, int c) { return a + b - c;}See more examples in the Disable mutants with annotations guide.
Git Diff
Section titled “Git Diff”This filter is especially useful in the CI context when you only want to generate mutants for the code relevant to a pull request.
To enable it, simply add the following to the config:
gitDiffRef: maingitProjectRoot: .See more examples in the Diff-based mutations guide.
Coverage
Section titled “Coverage”Code coverage is another useful filter, it is often makes sense to only generate mutants for the code which is actually reachable during a test run.
The coverage filter can be enabled indirectly: simply enable profiling during compilation and Mull will do the rest.
clang-22 \ -fpass-plugin=/usr/lib/mull-ir-frontend-22 \ -g -grecord-command-line \ -fprofile-instr-generate -fcoverage-mapping \ main.cSee CMake Integration: fmtlib guide for an example.