Skip to content

Commit f677888

Browse files
authored
MAKE-900: run tests on MacOS without compiling test binaries (#60)
1 parent 6b79f73 commit f677888

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

makefile

+19-16
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ benchmark-send:
109109
@mkdir -p build
110110
go test -v -bench=$(if $(RUN_BENCH),$(RUN_BENCH),BenchmarkAllSenders) ./send/ ./send/benchmark/ -run=^^$$
111111
coverage-%:$(buildDir)/output.%.coverage
112-
@grep -s -q -e "^PASS" $<
112+
@grep -s -q -e "^PASS" $(buildDir)/output.$*.test
113113
html-coverage-%:$(buildDir)/output.%.coverage $(buildDir)/output.%.coverage.html
114-
@grep -s -q -e "^PASS" $<
114+
@grep -s -q -e "^PASS" $(buildDir)/output.$*.test
115115
lint-%:$(buildDir)/output.%.lint
116116
@grep -v -s -q "^--- FAIL" $<
117117
# end convienence targets
@@ -135,28 +135,31 @@ coverDeps := $(addprefix $(gopath)/src/,$(coverDeps))
135135
# and save test output.
136136
$(buildDir)/test.%:$(testSrcFiles) $(coverDeps)
137137
go test $(if $(DISABLE_COVERAGE),,-covermode=count) -c -o $@ ./$(subst -,/,$*)
138-
$(buildDir)/race.%:$(testSrcFiles)
139-
go test -race -c -o $@ ./$(subst -,/,$*)
140-
# targets to run any tests in the top-level package
141-
$(buildDir)/test.$(name):$(testSrcFiles) $(coverDeps)
142-
go test $(if $(DISABLE_COVERAGE),,-covermode=count) -c -o $@ ./
143-
$(buildDir)/race.$(name):$(testSrcFiles)
144-
go test -race -c -o $@ ./
145-
# targets to run the tests and report the output
146-
$(buildDir)/output.%.test:$(buildDir)/test.% .FORCE
147-
$(testRunEnv) ./$< $(testArgs) 2>&1 | tee $@
148-
$(buildDir)/output.%.race:$(buildDir)/race.% .FORCE
149-
$(testRunEnv) ./$< $(testArgs) 2>&1 | tee $@
138+
$(buildDir)/output.%.test: .FORCE
139+
@mkdir -p $(buildDir)
140+
go test $(if $(DISABLE_COVERAGE),,-covermode=count) $(testArgs) ./$(subst -,/,$*) | tee $@
141+
$(buildDir)/output.$(name).test: .FORCE
142+
@mkdir -p $(buildDir)
143+
go test $(testArgs) ./ | tee $@
144+
145+
$(buildDir)/output.%.race: .FORCE
146+
@mkdir -p $(buildDir)
147+
go test -race $(testArgs) ./$(subst -,/,$*) 2>&1 | tee $@
148+
$(buildDir)/output.$(name).race: .FORCE
149+
@mkdir -p $(buildDir)
150+
go test -race $(testArgs) ./ 2>&1 | tee $@
150151
# targets to generate gotest output from the linter.
151152
$(buildDir)/output.%.lint:$(buildDir)/run-linter $(testSrcFiles) .FORCE
152153
@./$< --output=$@ --lintArgs='$(lintArgs)' --packages='$*'
153154
$(buildDir)/output.lint:$(buildDir)/run-linter .FORCE
154155
@./$< --output="$@" --lintArgs='$(lintArgs)' --packages="$(packages)"
155156
# targets to process and generate coverage reports
156-
$(buildDir)/output.%.coverage:$(buildDir)/test.% .FORCE $(coverDeps)
157-
$(testRunEnv) ./$< $(testArgs) -test.coverprofile=$@ | tee $(subst coverage,test,$@)
157+
$(buildDir)/output.%.coverage: .FORCE $(coverDeps)
158+
@mkdir -p $(buildDir)
159+
go test $(testArgs) -test.coverprofile=$@ | tee $(subst coverage,test,$@)
158160
@-[ -f $@ ] && go tool cover -func=$@ | sed 's%$(projectPath)/%%' | column -t
159161
$(buildDir)/output.%.coverage.html:$(buildDir)/output.%.coverage $(coverDeps)
162+
@mkdir -p $(buildDir)
160163
go tool cover -html=$< -o $@
161164
# end test and coverage artifacts
162165

0 commit comments

Comments
 (0)