Skip to content

Commit

Permalink
build: add option to build ronin with race detector (#350)
Browse files Browse the repository at this point in the history
With this commit, we can use `make ronin-race-detector` to build ronin with race
detector.
  • Loading branch information
minh-bq authored Aug 30, 2023
1 parent 16ee23b commit ff162f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ ronin:
@echo "Done building."
@echo "Run \"$(GOBIN)/ronin\" to launch ronin."

ronin-race-detector:
$(GORUN) build/ci.go install --race ./cmd/ronin
@echo "Done building."
@echo "Run \"$(GOBIN)/ronin\" to launch ronin."

bootnode:
$(GORUN) build/ci.go install ./cmd/bootnode
@echo "Done building."
Expand Down
5 changes: 5 additions & 0 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func doInstall(cmdline []string) {
dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
arch = flag.String("arch", "", "Architecture to cross build for")
cc = flag.String("cc", "", "C compiler to cross build with")
race = flag.Bool("race", false, "Execute the race detector")
)
flag.CommandLine.Parse(cmdline)

Expand All @@ -216,6 +217,10 @@ func doInstall(cmdline []string) {
env := build.Env()
gobuild := tc.Go("build", buildFlags(env)...)

if *race {
gobuild.Args = append(gobuild.Args, "-race")
}

// arm64 CI builders are memory-constrained and can't handle concurrent builds,
// better disable it. This check isn't the best, it should probably
// check for something in env instead.
Expand Down

0 comments on commit ff162f4

Please sign in to comment.