Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (61 loc) · 2.04 KB
/
Copy pathMakefile
File metadata and controls
71 lines (61 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# dap-go development makefile.
#
# Run `make check` before every commit. CI runs the same set; if
# `make check` is green locally, the PR will be green too modulo
# go-version matrix differences.
GO ?= go
GOLANGCI_LINT_VERSION ?= v2.12.2
FUZZTIME ?= 30s
GOLANGCI_LINT ?= $(shell command -v golangci-lint 2> /dev/null)
.PHONY: check
check: fmt-check vet test lint
.PHONY: fmt
fmt:
gofmt -w .
.PHONY: fmt-check
fmt-check:
@out=$$(gofmt -l .); \
if [ -n "$$out" ]; then \
echo "gofmt would reformat:"; \
echo "$$out"; \
exit 1; \
fi
.PHONY: vet
vet:
$(GO) vet ./...
.PHONY: test
test:
$(GO) test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: lint
lint:
ifndef GOLANGCI_LINT
@echo "golangci-lint not found on PATH."
@echo "Install matching CI version with:"
@echo " $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)"
@echo "(the project config targets golangci-lint v2)"
@exit 1
else
$(GOLANGCI_LINT) run
endif
# Each target is retried once before the build fails. The Go fuzzing coordinator
# reports "context deadline exceeded" when -fuzztime elapses while a worker is
# mid-iteration; that is a harness artefact rather than a corpus failure, it
# lands on a different target from run to run, and it writes no failing input.
# A real failure is deterministic — the input is written under testdata/fuzz and
# replayed from the corpus — so it survives the retry, as does a genuine hang.
.PHONY: fuzz
fuzz:
@for t in FuzzReportShare FuzzTaskConfiguration FuzzAggregationJobInitReq FuzzAggregationJobResp; do \
echo "== $$t ($(FUZZTIME)) =="; \
if ! $(GO) test -run '^$$' -fuzz="^$$t$$" -fuzztime=$(FUZZTIME) ./pkg/dap/wire/; then \
echo "== $$t did not finish cleanly, retrying once =="; \
$(GO) test -run '^$$' -fuzz="^$$t$$" -fuzztime=$(FUZZTIME) ./pkg/dap/wire/ || exit 1; \
fi; \
done
.PHONY: lint-install
lint-install:
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
.PHONY: clean
clean:
rm -f coverage.txt coverage.html
$(GO) clean ./...