From db168ca558da2575b5625b19fa9638f186bbca5d Mon Sep 17 00:00:00 2001 From: elias-orijtech <103319121+elias-orijtech@users.noreply.github.com> Date: Fri, 3 Jun 2022 15:02:59 +0200 Subject: [PATCH] test/fuzz: fix OSS-Fuzz build (#8669) Broken by https://github.com/AdamKorcz/go-118-fuzz-build/commit/7bed8f92ea820f668efab099ec774d548f1873a8. - note the purpose of test/fuzz/oss-fuzz-build.sh --- test/fuzz/oss-fuzz-build.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/fuzz/oss-fuzz-build.sh b/test/fuzz/oss-fuzz-build.sh index 836253d4d..fdfbfaf29 100755 --- a/test/fuzz/oss-fuzz-build.sh +++ b/test/fuzz/oss-fuzz-build.sh @@ -1,19 +1,29 @@ #!/bin/bash - +# This script is invoked by OSS-Fuzz to run fuzz tests against Tendermint core. +# See https://github.com/google/oss-fuzz/blob/master/projects/tendermint/build.sh set -euo pipefail +# Upgrade to Go 1.18. Remove when it's the default. +apt-get update && apt-get install -y wget +wget https://go.dev/dl/go1.18.2.linux-amd64.tar.gz + +mkdir -p temp-go +rm -rf /root/.go/* +tar -C temp-go/ -xzf go1.18.2.linux-amd64.tar.gz +mv temp-go/go/* /root/.go/ + export FUZZ_ROOT="github.com/tendermint/tendermint" build_go_fuzzer() { local function="$1" local fuzzer="$2" - gotip run github.com/orijtech/otils/corpus2ossfuzz@latest -o "$OUT"/"$fuzzer"_seed_corpus.zip -corpus test/fuzz/tests/testdata/fuzz/"$function" + go run github.com/orijtech/otils/corpus2ossfuzz@latest -o "$OUT"/"$fuzzer"_seed_corpus.zip -corpus test/fuzz/tests/testdata/fuzz/"$function" compile_native_go_fuzzer "$FUZZ_ROOT"/test/fuzz/tests "$function" "$fuzzer" } -gotip get github.com/AdamKorcz/go-118-fuzz-build/utils -gotip get github.com/prometheus/common/expfmt@v0.32.1 +go get github.com/AdamKorcz/go-118-fuzz-build/utils +go get github.com/prometheus/common/expfmt@v0.32.1 build_go_fuzzer FuzzP2PSecretConnection fuzz_p2p_secretconnection