mirror of
https://github.com/git/git
synced 2024-08-28 12:09:19 +00:00
![Josh Steadmon](/assets/img/avatar_default.png)
To prevent bitrot, we would like to regularly exercise the fuzz tests in order to make sure they still link & run properly. We already compile the fuzz test objects as part of the default `make` target, but we do not link the executables due to the fuzz tests needing specific compilers and compiler features. This has lead to frequent build breakages for the fuzz tests. To remedy this, we can add a CI step to actually link the fuzz executables, and run them (with finite input rather than the default infinite random input mode) to verify that they execute properly. Since the main use of the fuzz tests is via OSS-Fuzz [1], and OSS-Fuzz only runs tests on Linux [2], we only set up a CI test for the fuzzers on Linux. [1] https://github.com/google/oss-fuzz [2] https://google.github.io/oss-fuzz/further-reading/fuzzer-environment/ Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
20 lines
401 B
Bash
Executable file
20 lines
401 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Build and test Git's fuzzers
|
|
#
|
|
|
|
. ${0%/*}/lib.sh
|
|
|
|
group "Build fuzzers" make \
|
|
CC=clang \
|
|
CXX=clang++ \
|
|
CFLAGS="-fsanitize=fuzzer-no-link,address" \
|
|
LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
|
|
fuzz-all
|
|
|
|
for fuzzer in commit-graph date pack-headers pack-idx ; do
|
|
begin_group "fuzz-$fuzzer"
|
|
./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
|
|
end_group "fuzz-$fuzzer"
|
|
done
|