Debian Codegraph @

Makefile

raw
1 BENCH ?=.
2 BENCH_BASE?=master
3
4 clean:
5 rm -f bin/reporter
6 rm -fr autobahn/report/*
7
8 bin/reporter:
9 go build -o bin/reporter ./autobahn
10
11 bin/gocovmerge:
12 go build -o bin/gocovmerge github.com/wadey/gocovmerge
13
14 .PHONY: autobahn
15 autobahn: clean bin/reporter
16 ./autobahn/script/test.sh --build --follow-logs
17 bin/reporter $(PWD)/autobahn/report/index.json
18
19 .PHONY: autobahn/report
20 autobahn/report: bin/reporter
21 ./bin/reporter -http localhost:5555 ./autobahn/report/index.json
22
23 test:
24 go test -coverprofile=ws.coverage .
25 go test -coverprofile=wsutil.coverage ./wsutil
26 go test -coverprofile=wsfalte.coverage ./wsflate
27 # No statements to cover in ./tests (there are only tests).
28 go test ./tests
29
30 cover: bin/gocovmerge test autobahn
31 bin/gocovmerge ws.coverage wsutil.coverage wsflate.coverage autobahn/report/server.coverage > total.coverage
32
33 benchcmp: BENCH_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
34 benchcmp: BENCH_OLD:=$(shell mktemp -t old.XXXX)
35 benchcmp: BENCH_NEW:=$(shell mktemp -t new.XXXX)
36 benchcmp:
37 if [ ! -z "$(shell git status -s)" ]; then\
38 echo "could not compare with $(BENCH_BASE) – found unstaged changes";\
39 exit 1;\
40 fi;\
41 if [ "$(BENCH_BRANCH)" == "$(BENCH_BASE)" ]; then\
42 echo "comparing the same branches";\
43 exit 1;\
44 fi;\
45 echo "benchmarking $(BENCH_BRANCH)...";\
46 go test -run=none -bench=$(BENCH) -benchmem > $(BENCH_NEW);\
47 echo "benchmarking $(BENCH_BASE)...";\
48 git checkout -q $(BENCH_BASE);\
49 go test -run=none -bench=$(BENCH) -benchmem > $(BENCH_OLD);\
50 git checkout -q $(BENCH_BRANCH);\
51 echo "\nresults:";\
52 echo "========\n";\
53 benchcmp $(BENCH_OLD) $(BENCH_NEW);\
54