Code Coverage¶
The script run_coverage.sh
offers a way to test the code coverage
of the XGrammar library.
To run the coverage test, please follow these steps:
In
config.cmake
, set the variableXGRAMMAR_ENABLE_COVERAGE
toON
.Compile the XGrammar library with the configured settings.
Run the script
run_coverage.sh
in the root directory of the XGrammar library.
After running the script, you will find the coverage report in the
coverage_report
directory.
Please note that code coverage tools are merely aids to help identify which parts of the code have not been tested. However, pursuing 100% code coverage is not advisable. It can actually have negative consequences.