github.com/opencontainers/umoci@v0.4.8-0.20240508124516-656e4836fb0d/test/fuzzing/README.md (about) 1 # Fuzzing umoci 2 3 Umoci has a series of fuzz tests. These are implemented by way of [go-fuzz](https://github.com/dvyukov/go-fuzz). 4 5 ## Running the fuzzers 6 7 To run the fuzzers, first build the fuzzer image from the root of this repository: 8 9 ```bash 10 sudo docker build -t umoci-fuzz -f Dockerfile.fuzz . 11 ``` 12 Next, get a shell in the container: 13 ```bash 14 sudo docker run -it umoci-fuzz 15 ``` 16 At this point, you can navigate to any directory that has a fuzzer and build it: 17 18 ```bash 19 cd $PATH_TO_FUZZER 20 go-fuzz-build -libfuzzer -func=FUZZ_NAME && \ 21 clang -fsanitize=fuzzer PACKAGE_NAME.a -o fuzzer 22 ``` 23 `FUZZ_NAME` will typically be `Fuzz`, but in some cases the respective fuzzers will have more descriptive names. 24 25 If you encounter any errors when linking with `PACKAGE_NAME.a`, simply `ls` after running `go-fuzz-build...`, and you will see the archive to link with. 26 27 If everything goes well until this point, you can run the fuzzer: 28 ```bash 29 ./fuzzer 30 ```