@@ -88,6 +88,7 @@ To run the cmp\_tool interface test you need the [pytest](https://docs.pytest.or
```
pip3 install pytest
```
### Run tests
First, cd in the build directory:
...
...
@@ -122,7 +123,7 @@ cd <name of the build directory>
meson configure -Db_coverage=true
```
Then issue the following commands.
Then issue the following commands:
```
meson test
...
...
@@ -130,6 +131,13 @@ ninja coverage-html
```
The coverage report can be found in the `meson-logs/coveragereport` subdirectory.
To reset the coverage data, use the following command:
```
ninja clean-gcda
```
### Benchmarking
To run the compression speed test bench, follow these steps:
...
...
@@ -139,7 +147,6 @@ cd <name of the build directory>
meson test --benchmark
```
### Fuzzing
If you’re unfamiliar with fuzzing and libFuzzer, you can find a tutorial [here](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md).
To perform fuzzing with libFuzzer, AddressSanitizer, and UndefinedBehaviorSanitizer, follow these steps:
...
...
@@ -172,12 +179,20 @@ meson test fuzz_round_trip\ 10\ min --verbose
Happy fuzzing! 🚀
To reset the coverage data, use the following command:
#### Fuzzing on macOS
When fuzzing on macOS, the default clang installation does not support libFuzzer. To properly set up fuzzing on macOS, you'll need to install the LLVM toolchain using Homebrew (`brew install llvm`) and specify the correct library paths.
When running the meson setup commands, you'll need to set the `LDFLAGS` environment variable to use the Homebrew-installed version of the C++ library:
```
ninja clean-gcda
LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm/lib/c++" \
CC=$HOMEBREW_PREFIX/opt/llvm/bin/clang \
CXX=$HOMEBREW_PREFIX/opt/llvm/bin/clang++ \
meson setup builddir_fuzzing \
# other fuzzing options from above
```
This ensures the fuzzer is built using the Homebrew-installed Clang and Clang++ compilers, which support libFuzzer, and links against Clang's corresponding C++ library.
## Documentation
### External dependencies
To generate the documentation you need the [Doxygen](https://www.doxygen.nl/index.html) program.