From f24361722940f27b49dbf9b01492ec24574e364b Mon Sep 17 00:00:00 2001 From: Alfonso Uceda Date: Fri, 27 Jun 2025 17:59:02 +0200 Subject: [PATCH] -suffle=on and -count=2 option is added to TESTFLAGS Signed-off-by: Alfonso Uceda --- Makefile | 4 ++-- scripts/coverage.sh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0785fdb2e..df8e65ae4 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ ACCEPTANCE_RUN_TESTS=. PKG := ./... TAGS := TESTS := . -TESTFLAGS := +TESTFLAGS := -shuffle=on -count=2 LDFLAGS := -w -s GOFLAGS := CGO_ENABLED ?= 0 @@ -119,7 +119,7 @@ test-unit: test-coverage: @echo @echo "==> Running unit tests with coverage <==" - @ ./scripts/coverage.sh + @ TESTFLAGS="${TESTFLAGS}" ./scripts/coverage.sh .PHONY: test-style test-style: diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 2164d94da..371de6795 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -16,6 +16,8 @@ set -euo pipefail +TESTFLAGS=${TESTFLAGS:-} + covermode=${COVERMODE:-atomic} coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX) profile="${coverdir}/cover.out" @@ -24,7 +26,7 @@ generate_cover_data() { for d in $(go list ./...) ; do ( local output="${coverdir}/${d//\//-}.cover" - go test -coverprofile="${output}" -covermode="$covermode" "$d" + go test ${TESTFLAGS} -coverprofile="${output}" -covermode="$covermode" "$d" ) done @@ -40,4 +42,3 @@ case "${1-}" in go tool cover -html "${profile}" ;; esac -