Skip to content
Snippets Groups Projects
Commit d8382f88 authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

Improved fuzzing instructions for macOS in INSTALL.md

parent 502fd452
Branches
Tags
1 merge request!34Update cmp_tool to version v0.13
# Installation Instructions
## Getting started
### Install git and python 3.7+
If you're on Linux, you probably already have these. On macOS and Windows, you can use the
......@@ -29,6 +28,7 @@ We use the version control system [git](https://git-scm.com/downloads) to get a
git clone https://gitlab.phaidra.org/loidoltd15/cmp_tool.git
cd cmp_tool
```
## Build the cmp\_tool
### Build the cmp\_tool for Debugging
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment