From af30a23c9b56007887a61ba73215dd4e8cb065a9 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 23 Jun 2021 23:34:18 +0200 Subject: [PATCH 1/3] show if GOTESTFLAGS are set on unit-test start --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1fd4216dac859..6feb1efe57179 100644 --- a/Makefile +++ b/Makefile @@ -359,7 +359,7 @@ test: test-frontend test-backend .PHONY: test-backend test-backend: - @echo "Running go test with -tags '$(TEST_TAGS)'..." + @echo "Running go test with $(GOTESTFLAGS) -tags '$(TEST_TAGS)' ..." @$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='$(TEST_TAGS)' $(GO_PACKAGES) .PHONY: test-frontend @@ -380,7 +380,7 @@ test-check: .PHONY: test\#% test\#%: - @echo "Running go test with -tags '$(TEST_TAGS)'..." + @echo "Running go test with $(GOTESTFLAGS) -tags '$(TEST_TAGS)' ..." @$(GO) test -mod=vendor $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES) .PHONY: coverage @@ -389,7 +389,7 @@ coverage: .PHONY: unit-test-coverage unit-test-coverage: - @echo "Running unit-test-coverage -tags '$(TEST_TAGS)'..." + @echo "Running unit-test-coverage $(GOTESTFLAGS) -tags '$(TEST_TAGS)' ..." @$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='$(TEST_TAGS)' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1 .PHONY: vendor From 29f75f210d31973fd36df27795239c634dd7b946 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 23 Jun 2021 23:34:37 +0200 Subject: [PATCH 2/3] Enable race detection for unit tests --- .drone.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.drone.yml b/.drone.yml index c338f5ee52edf..456d9b9f21fa6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -216,6 +216,7 @@ steps: TAGS: bindata sqlite sqlite_unlock_notify GITHUB_READ_TOKEN: from_secret: github_read_token + RACE_ENABLED: true - name: unit-test-gogit pull: always @@ -227,6 +228,7 @@ steps: TAGS: bindata gogit sqlite sqlite_unlock_notify GITHUB_READ_TOKEN: from_secret: github_read_token + RACE_ENABLED: true - name: test-mysql image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env From 3724fe71204f9fbd57b34f406ee17dc8b69348cc Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 24 Jun 2021 00:34:33 +0200 Subject: [PATCH 3/3] print corrupt file --- build/gocovmerge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/gocovmerge.go b/build/gocovmerge.go index 65d6f2cd6ccc3..7ceb36c5938be 100644 --- a/build/gocovmerge.go +++ b/build/gocovmerge.go @@ -108,7 +108,7 @@ func main() { for _, file := range flag.Args() { profiles, err := cover.ParseProfiles(file) if err != nil { - log.Fatalf("failed to parse profiles: %v", err) + log.Fatalf("failed to parse profiles (%s): %v", file, err) } for _, p := range profiles { merged = addProfile(merged, p)