Skip to content

Enable race detection for unit tests #16239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/gocovmerge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down