Debian Codegraph @

Makefile

raw
1 .DEFAULT_GOAL := all
2
3 .PHONY: all
4 all: test_with_fuzz lint
5
6 # the TEST_FLAGS env var can be set to eg run only specific tests
7 TEST_COMMAND = go test -v -count=1 -race -cover $(TEST_FLAGS)
8
9 .PHONY: test
10 test:
11 $(TEST_COMMAND)
12
13 .PHONY: bench
14 bench:
15 go test -bench=.
16
17 FUZZ_TIME ?= 10s
18
19 # see https://github.com/golang/go/issues/46312
20 # and https://stackoverflow.com/a/72673487/4867444
21 # if we end up having more fuzz tests
22 .PHONY: test_with_fuzz
23 test_with_fuzz:
24 $(TEST_COMMAND) -fuzz=FuzzRoundTripJSON -fuzztime=$(FUZZ_TIME)
25 $(TEST_COMMAND) -fuzz=FuzzRoundTripYAML -fuzztime=$(FUZZ_TIME)
26
27 .PHONY: fuzz
28 fuzz: test_with_fuzz
29
30 .PHONY: lint
31 lint:
32 golangci-lint run