Skip to content

Commit 5c75b92

Browse files
committed
feat: Significant improvements to the Makefile.
1 parent 44c1b50 commit 5c75b92

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Makefile

+13-13
Original file line numberDiff line numberDiff line change
@@ -216,55 +216,55 @@ lint: vuln
216216
test: unit acc
217217

218218
.PHONY: acc
219-
## acc: [test] Runs Terraform provider acceptance tests.
219+
## acc: [test] Runs Terraform provider acceptance tests. Set NAME= (without 'Test') to run a specific test by name
220220
acc:
221221
@ $(ECHO) " "
222222
@ $(ECHO) "\033[1;33m=====> Running unit and acceptance tests...\033[0m"
223-
TF_ACC=1 go test -count=1 -parallel=$(shell nproc) -timeout 30s -coverpkg=./corefuncprovider/... -coverprofile=__coverage.out -v ./corefuncprovider/...
223+
TF_ACC=1 $(GO) test -run=TestAcc$(NAME) -count=1 -parallel=$(shell nproc) -timeout 30s -coverpkg=./corefuncprovider/... -coverprofile=__coverage.out -v ./corefuncprovider/...
224224

225225
.PHONY: unit
226-
## unit: [test] Runs unit and fuzz tests.
226+
## unit: [test] Runs unit tests. Set NAME= (without 'Test') to run a specific test by name
227227
unit:
228228
@ $(ECHO) " "
229229
@ $(ECHO) "\033[1;33m=====> Running unit tests...\033[0m"
230-
go test -count=1 -parallel=$(shell nproc) -timeout 30s -coverpkg=./corefunc/... -coverprofile=__coverage.out -v ./corefunc/...
230+
$(GO) test -run=Test$(NAME) -count=1 -parallel=$(shell nproc) -timeout 30s -coverpkg=./corefunc/... -coverprofile=__coverage.out -v ./corefunc/...
231231

232232
.PHONY: fuzz
233-
## fuzz: [test]* Runs the fuzzer for 10 minutes.
233+
## fuzz: [test]* Runs the fuzzer for 10 minutes. Set NAME= (without 'Fuzz') to run a specific test by name
234234
fuzz:
235235
@ $(ECHO) " "
236236
@ $(ECHO) "\033[1;33m=====> Running the fuzzer (https://go.dev/doc/tutorial/fuzz)...\033[0m"
237-
go test -fuzz=Fuzz -fuzztime 10m -parallel=$(shell nproc) -v ./corefunc/.
237+
$(GO) test -run='^$$' -fuzz=Fuzz$(NAME) -fuzztime 10m -parallel=$(shell nproc) -v ./corefunc/...
238238

239239
.PHONY: quickbench
240-
## quickbench: [test]* Runs the benchmarks with minimal data for a quick check.
240+
## quickbench: [test]* Runs the benchmarks with minimal data for a quick check
241241
quickbench:
242-
go test -bench=. -timeout 60m ./corefunc
242+
$(GO) test -bench=. -timeout 60m ./corefunc
243243

244244
.PHONY: bench
245245
## bench: [test]* Runs the benchmarks with enough data for analysis with benchstat.
246246
bench:
247-
go test -bench=. -count=6 -timeout 60m -benchmem -cpuprofile=__cpu.out -memprofile=__mem.out -trace=__trace.out ./corefunc | tee __bench-$(shell date --utc "+%Y%m%dT%H%M%SZ").out
247+
$(GO) test -bench=. -count=6 -timeout 60m -benchmem -cpuprofile=__cpu.out -memprofile=__mem.out -trace=__trace.out ./corefunc | tee __bench-$(shell date --utc "+%Y%m%dT%H%M%SZ").out
248248

249249
.PHONY: view-cov
250250
## view-cov: [test] After running test or unittest, this will launch a browser to view the coverage report.
251251
view-cov:
252-
go tool cover -html=__coverage.out
252+
$(GO) tool cover -html=__coverage.out
253253

254254
.PHONY: view-cpupprof
255255
## view-cpupprof: [test] After running bench, this will launch a browser to view the CPU profiler results.
256256
view-cpupprof:
257-
go tool pprof -http :8080 __cpu.out
257+
$(GO) tool pprof -http :8080 __cpu.out
258258

259259
.PHONY: view-mempprof
260260
## view-mempprof: [test] After running bench, this will launch a browser to view the memory profiler results.
261261
view-mempprof:
262-
go tool pprof -http :8080 __mem.out
262+
$(GO) tool pprof -http :8080 __mem.out
263263

264264
.PHONY: view-trace
265265
## view-trace: [test] After running bench, this will launch a browser to view the trace results.
266266
view-trace:
267-
go tool trace _trace.out
267+
$(GO) tool trace _trace.out
268268

269269
#-------------------------------------------------------------------------------
270270
# Git Tasks

0 commit comments

Comments
 (0)