Makefile 662 B

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