[lotus] Fix coverage build (#5544)

This commit is contained in:
AdamKorcz 2021-04-01 02:48:35 +01:00 committed by GitHub
parent df561687f6
commit 5ed972de75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 5 deletions

View File

@ -17,7 +17,7 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y mesa-opencl-icd ocl-icd-opencl-dev gcc \
git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev
RUN git clone --depth 1 https://github.com/filecoin-project/lotus $GOPATH/src/github.com/filecoin-project/lotus
RUN git clone --depth 1 https://github.com/filecoin-project/fuzzing-lotus $GOPATH/src/github.com/filecoin-project/fuzzing-lotus
RUN git clone --depth 1 https://github.com/filecoin-project/lotus
RUN git clone --depth 1 https://github.com/filecoin-project/fuzzing-lotus
COPY build.sh $SRC/
WORKDIR $GOPATH/src/github.com/filecoin-project/lotus
WORKDIR $SRC/lotus

View File

@ -17,10 +17,26 @@
make
compile_go_fuzzer github.com/filecoin-project/lotus/chain/types FuzzMessage fuzz_message gofuzz
# Not all fuzzers can be compiled with --sanitizer=coverage.
# The specific issue is that gofuzz.NewFromGofuzz is not supported when compiling with coverage.
# The current status of the coverage build is that we do not break it for the fuzzers that cannot be compiled.
#The reason that we don't break the build script is to create coverage reports for the fuzzers that compile.
if [[ $SANITIZER = *coverage* ]]; then
compile_go_fuzzer github.com/filecoin-project/lotus/chain/types FuzzMessage fuzz_message gofuzz
mkdir fuzzing
cp ../fuzzing-lotus/fuzz/fuzz.go fuzzing/
compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzBlockMsg fuzz_block_msg || true
compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzBlockMsgStructural fuzz_block_msg_structural || true
compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzBlockHeader fuzz_block_header || true
compile_go_fuzzer github.com/filecoin-project/lotus/fuzzing FuzzNodesForHeight fuzz_nodes_for_height || true
exit 0
fi
compile_go_fuzzer ./chain/types FuzzMessage fuzz_message gofuzz
# Fuzzers from fuzzing-lotus
cd ../fuzzing-lotus/fuzz
# obsolete modules referenced
rm -Rf libfuzzer
go mod init github.com/filecoin-project/fuzzing-lotus/fuzz
@ -28,3 +44,4 @@ compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzBlockMsg fu
compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzBlockMsgStructural fuzz_block_msg_structural
compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzBlockHeader fuzz_block_header
compile_go_fuzzer github.com/filecoin-project/fuzzing-lotus/fuzz FuzzNodesForHeight fuzz_nodes_for_height
exit 0