Skip to content

Commit a970fd7

Browse files
author
Paulo Gomes
committed
Bump envtest to 1.24.0
Signed-off-by: Paulo Gomes <[email protected]>
1 parent b2eb601 commit a970fd7

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

Makefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ REPOSITORY_ROOT := $(shell git rev-parse --show-toplevel)
3333
BUILD_DIR := $(REPOSITORY_ROOT)/build
3434

3535
# Other dependency versions
36-
ENVTEST_BIN_VERSION ?= 1.19.2
36+
ENVTEST_BIN_VERSION ?= 1.24.0
37+
38+
# FUZZ_TIME defines the max amount of time, in Go Duration,
39+
# each fuzzer should run for.
40+
FUZZ_TIME ?= 1m
3741

3842
# Caches libgit2 versions per tag, "forcing" rebuild only when needed.
3943
LIBGIT2_PATH := $(BUILD_DIR)/libgit2/$(LIBGIT2_TAG)
@@ -206,9 +210,9 @@ ifneq ($(shell grep -o 'LIBGIT2_IMG ?= \w.*' Makefile | cut -d ' ' -f 3):$(shell
206210
exit 1; \
207211
}
208212
endif
209-
ifneq ($(shell grep -o 'LIBGIT2_TAG ?= \w.*' Makefile | cut -d ' ' -f 3), $(shell grep -o "LIBGIT2_TAG=.*" tests/fuzz/oss_fuzz_build.sh | sed 's;LIBGIT2_TAG="$${LIBGIT2_TAG:-;;g' | sed 's;}";;g'))
213+
ifneq ($(shell grep -o 'LIBGIT2_TAG ?= \w.*' Makefile | cut -d ' ' -f 3), $(shell grep -o "LIBGIT2_TAG=.*" tests/fuzz/oss_fuzz_prebuild.sh | sed 's;LIBGIT2_TAG="$${LIBGIT2_TAG:-;;g' | sed 's;}";;g'))
210214
@{ \
211-
echo "LIBGIT2_TAG must match in both Makefile and tests/fuzz/oss_fuzz_build.sh"; \
215+
echo "LIBGIT2_TAG must match in both Makefile and tests/fuzz/oss_fuzz_prebuild.sh"; \
212216
exit 1; \
213217
}
214218
endif
@@ -232,26 +236,32 @@ rm -rf $$TMP_DIR ;\
232236
}
233237
endef
234238

235-
# Build fuzzers
239+
# Build fuzzers used by oss-fuzz.
236240
fuzz-build: $(LIBGIT2)
237-
rm -rf $(BUILD_DIR)/fuzz/
238-
mkdir -p $(BUILD_DIR)/fuzz/out/
241+
rm -rf $(shell pwd)/build/fuzz/
242+
mkdir -p $(shell pwd)/build/fuzz/out/
239243

240-
docker build . --pull --tag local-fuzzing:latest -f tests/fuzz/Dockerfile.builder
244+
docker build . --tag local-fuzzing:latest -f tests/fuzz/Dockerfile.builder
241245
docker run --rm \
242246
-e FUZZING_LANGUAGE=go -e SANITIZER=address \
243247
-e CIFUZZ_DEBUG='True' -e OSS_FUZZ_PROJECT_NAME=fluxcd \
244-
-v "$(BUILD_DIR)/fuzz/out":/out \
248+
-v "$(shell pwd)/build/fuzz/out":/out \
245249
local-fuzzing:latest
246250

251+
# Run each fuzzer once to ensure they will work when executed by oss-fuzz.
247252
fuzz-smoketest: fuzz-build
248253
docker run --rm \
249-
-v "$(BUILD_DIR)/fuzz/out":/out \
250-
-v "$(shell go env GOMODCACHE):/root/go/pkg/mod" \
254+
-v "$(shell pwd)/build/fuzz/out":/out \
251255
-v "$(shell pwd)/tests/fuzz/oss_fuzz_run.sh":/runner.sh \
252256
local-fuzzing:latest \
253257
bash -c "/runner.sh"
254258

259+
# Run fuzz tests for the duration set in FUZZ_TIME.
260+
fuzz-native:
261+
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
262+
FUZZ_TIME=$(FUZZ_TIME) \
263+
./tests/fuzz/native_go_run.sh
264+
255265
# Creates an env file that can be used to load all source-controller's dependencies
256266
# this is handy when you want to run adhoc debug sessions on tests or start the
257267
# controller in a new debug session.

0 commit comments

Comments
 (0)