Skip to content

[WIP] Fix data race caused by blevesearch/bleve #5217

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 2 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
3 changes: 3 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pipeline:
group: test
environment:
TAGS: bindata
EXTRA_GOFLAGS: -race
commands:
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
- apt-get install -y git-lfs
Expand Down Expand Up @@ -153,6 +154,7 @@ pipeline:
environment:
TAGS: bindata
TEST_LDAP: "1"
EXTRA_GOFLAGS: -race
commands:
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
- apt-get install -y git-lfs
Expand All @@ -168,6 +170,7 @@ pipeline:
environment:
TAGS: bindata
TEST_LDAP: "1"
EXTRA_GOFLAGS: -race
commands:
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
- apt-get install -y git-lfs
Expand Down
20 changes: 7 additions & 13 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ ignored = ["google.golang.org/appengine*"]
[[override]]
revision = "c10ba270aa0bf8b8c1c986e103859c67a9103061"
name = "golang.org/x/oauth2"

[[override]]
name = "github.com/blevesearch/bleve"
revision = "e70b2878dfb7d5b8610709077b3b467980f413a3"
source = "github.com/typeless/bleve"
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ integration-test-coverage: integrations.cover.test generate-ini
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out

integrations.test: $(SOURCES)
$(GO) test -c code.gitea.io/gitea/integrations -o integrations.test
$(GO) test -c code.gitea.io/gitea/integrations ${EXTRA_GOFLAGS} -o integrations.test

integrations.sqlite.test: $(SOURCES)
$(GO) test -c code.gitea.io/gitea/integrations -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
$(GO) test -c code.gitea.io/gitea/integrations ${EXTRA_GOFLAGS} -o integrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'

integrations.cover.test: $(SOURCES)
$(GO) test -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test
$(GO) test -c code.gitea.io/gitea/integrations ${EXTRA_GOFLAGS} -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test

.PHONY: check
check: test
Expand Down
4 changes: 4 additions & 0 deletions integrations/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"testing"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/racedetector"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/routers"
"code.gitea.io/gitea/routers/routes"
Expand Down Expand Up @@ -80,6 +81,9 @@ func initIntegrationTest() {
fmt.Println("Environment variable $GITEA_ROOT not set")
os.Exit(1)
}
if racedetector.Enabled {
setting.AppBuiltWith = " (race detector enabled)"
}
setting.AppPath = path.Join(giteaRoot, "gitea")
if _, err := os.Stat(setting.AppPath); err != nil {
fmt.Printf("Could not find gitea binary at %s\n", setting.AppPath)
Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"code.gitea.io/gitea/cmd"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/racedetector"
"code.gitea.io/gitea/modules/setting"
// register supported doc types
_ "code.gitea.io/gitea/modules/markup/csv"
Expand Down Expand Up @@ -61,5 +62,9 @@ func formatBuiltWith(Tags string) string {
return ""
}

return " built with: " + strings.Replace(Tags, " ", ", ", -1)
s := " built with: " + strings.Replace(Tags, " ", ", ", -1)
if racedetector.Enabled {
s += " (race detector enabled)"
}
return s
}
10 changes: 10 additions & 0 deletions modules/racedetector/race_disabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2018 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

// +build !race

package racedetector

// Enabled is true if race detector is enabled.
var Enabled = false
10 changes: 10 additions & 0 deletions modules/racedetector/race_enabled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2018 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

// +build race

package racedetector

// Enabled is true if race detector is enabled.
var Enabled = true
22 changes: 0 additions & 22 deletions vendor/github.com/Smerity/govarint/LICENSE

This file was deleted.

Loading