From 6000bd167021ac7d17a1dbc9dbb011b34d249828 Mon Sep 17 00:00:00 2001 From: flouthoc Date: Mon, 3 Feb 2025 21:37:12 -0800 Subject: [PATCH] .cirrus: run -race only on non-PR branch Signed-off-by: flouthoc --- Makefile | 3 +-- contrib/cirrus/test.sh | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fd067da5c54..a2aa24da905 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,7 @@ GO_GCFLAGS := $(shell if $(GO) version|grep -q gccgo; then echo "-gccgoflags"; e NPROCS := $(shell nproc) export GO_BUILD=$(GO) build export GO_TEST=$(GO) test -parallel=$(NPROCS) -#RACEFLAGS := $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race) -RACEFLAGS := +RACEFLAGS ?= $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race) COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true) GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO}) diff --git a/contrib/cirrus/test.sh b/contrib/cirrus/test.sh index 2ee945ec000..216441325a8 100755 --- a/contrib/cirrus/test.sh +++ b/contrib/cirrus/test.sh @@ -67,7 +67,13 @@ else showrun make validate ;; unit) - showrun make test-unit + race= + if [[ -z "$CIRRUS_PR" ]]; then + # If not running on a PR then run unit tests + # with appropriate `-race` flags. + race="-race" + fi + showrun RACEFLAGS=$race make test-unit ;; conformance) # Typically it's undesirable to install packages at runtime.