Skip to content

Commit cceea81

Browse files
Add race detection to test builds (cosmos#662)
1 parent ce7389e commit cceea81

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ test-race: run-tests
147147

148148
test-evmd: ARGS=-timeout=15m
149149
test-evmd:
150-
@cd evmd && go test -tags=test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(PACKAGES_EVMD)
150+
@cd evmd && go test -race -tags=test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(PACKAGES_EVMD)
151151

152152
test-unit-cover: ARGS=-timeout=15m -coverprofile=coverage.txt -covermode=atomic
153153
test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)
154154
test-unit-cover: run-tests
155155
@echo "🔍 Running evm (root) coverage..."
156-
@go test -tags=test $(COMMON_COVER_ARGS) -coverpkg=$(COVERPKG_ALL) -coverprofile=coverage.txt ./...
156+
@go test -race -tags=test $(COMMON_COVER_ARGS) -coverpkg=$(COVERPKG_ALL) -coverprofile=coverage.txt ./...
157157
@echo "🔍 Running evmd coverage..."
158-
@cd evmd && go test -tags=test $(COMMON_COVER_ARGS) -coverpkg=$(COVERPKG_ALL) -coverprofile=coverage_evmd.txt ./...
158+
@cd evmd && go test -race -tags=test $(COMMON_COVER_ARGS) -coverpkg=$(COVERPKG_ALL) -coverprofile=coverage_evmd.txt ./...
159159
@echo "🔀 Merging evmd coverage into root coverage..."
160160
@tail -n +2 evmd/coverage_evmd.txt >> coverage.txt && rm evmd/coverage_evmd.txt
161161
@echo "🧹 Filtering ignored files from coverage.txt..."
@@ -167,15 +167,15 @@ test: test-unit
167167

168168
test-all:
169169
@echo "🔍 Running evm module tests..."
170-
@go test -tags=test -mod=readonly -timeout=15m $(PACKAGES_NOSIMULATION)
170+
@go test -race -tags=test -mod=readonly -timeout=15m $(PACKAGES_NOSIMULATION)
171171
@echo "🔍 Running evmd module tests..."
172-
@cd evmd && go test -tags=test -mod=readonly -timeout=15m $(PACKAGES_EVMD)
172+
@cd evmd && go test -race -tags=test -mod=readonly -timeout=15m $(PACKAGES_EVMD)
173173

174174
run-tests:
175175
ifneq (,$(shell which tparse 2>/dev/null))
176-
go test -tags=test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
176+
go test -race -tags=test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
177177
else
178-
go test -tags=test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
178+
go test -race -tags=test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
179179
endif
180180

181181
# Use the old Apple linker to workaround broken xcode - https://github.com/golang/go/issues/65169
@@ -184,11 +184,11 @@ ifeq ($(OS_FAMILY),Darwin)
184184
endif
185185

186186
test-fuzz:
187-
go test -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzMintCoins ./x/precisebank/keeper
188-
go test -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzBurnCoins ./x/precisebank/keeper
189-
go test -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzSendCoins ./x/precisebank/keeper
190-
go test -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzGenesisStateValidate_NonZeroRemainder ./x/precisebank/types
191-
go test -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzGenesisStateValidate_ZeroRemainder ./x/precisebank/types
187+
go test -race -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzMintCoins ./x/precisebank/keeper
188+
go test -race -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzBurnCoins ./x/precisebank/keeper
189+
go test -race -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzSendCoins ./x/precisebank/keeper
190+
go test -race -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzGenesisStateValidate_NonZeroRemainder ./x/precisebank/types
191+
go test -race -tags=test $(FUZZLDFLAGS) -run NOTAREALTEST -v -fuzztime 10s -fuzz=FuzzGenesisStateValidate_ZeroRemainder ./x/precisebank/types
192192

193193
test-scripts:
194194
@echo "Running scripts tests"
@@ -201,7 +201,7 @@ test-solidity:
201201
.PHONY: run-tests test test-all $(TEST_TARGETS)
202202

203203
benchmark:
204-
@go test -tags=test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION)
204+
@go test -race -tags=test -mod=readonly -bench=. $(PACKAGES_NOSIMULATION)
205205

206206
.PHONY: benchmark
207207

0 commit comments

Comments
 (0)