tests/fuzz: update build config

Ensure we only download github.com/AdaLogics/go-fuzz-headers once;
clearify use `go.mod`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals 2022-06-02 12:11:49 +02:00
parent 2142eb320e
commit b2daa3e9df
2 changed files with 4 additions and 5 deletions

View File

@ -1,3 +1,5 @@
// Used to exclude it from Go mod in repository root.
// Replaced by oss_fuzz_build.sh.
module github.com/fluxcd/image-automation-controller/tests/fuzz
go 1.17

View File

@ -54,8 +54,6 @@ export PKG_CONFIG_PATH="${TARGET_DIR}/lib/pkgconfig:${TARGET_DIR}/lib64/pkgconfi
export CGO_CFLAGS="-I${TARGET_DIR}/include -I${TARGET_DIR}/include/openssl"
export CGO_LDFLAGS="$(pkg-config --libs --static --cflags libssh2 openssl libgit2)"
go get -d github.com/AdaLogics/go-fuzz-headers
pushd "tests/fuzz"
# Setup files to be embedded into controllers_fuzzer.go's testFiles variable.
@ -79,6 +77,8 @@ SOURCE_VER=$(go list -m github.com/fluxcd/source-controller/api | awk '{print $2
REFLECTOR_VER=$(go list -m github.com/fluxcd/image-reflector-controller/api | awk '{print $2}')
go mod download
go get -d github.com/fluxcd/image-automation-controller
go get -d github.com/AdaLogics/go-fuzz-headers
if [ -d "../../controllers/testdata/crds" ]; then
cp ../../controllers/testdata/crds/*.yaml testdata/crds
@ -89,9 +89,6 @@ else
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml -o testdata/crds/imagepolicies.yaml
fi
go get -d github.com/AdaLogics/go-fuzz-headers
go get -d github.com/fluxcd/image-automation-controller
# Using compile_go_fuzzer to compile fails when statically linking libgit2 dependencies
# via CFLAGS/CXXFLAGS.
function go_compile(){