File: Makefile

package info (click to toggle)
golang-github-gobwas-ws 1.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 560 kB
  • sloc: sh: 98; makefile: 48
file content (54 lines) | stat: -rw-r--r-- 1,618 bytes parent folder | download | duplicates (6)
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
BENCH     ?=.
BENCH_BASE?=master

clean:
	rm -f bin/reporter
	rm -fr autobahn/report/*

bin/reporter:
	go build -o bin/reporter ./autobahn

bin/gocovmerge:
	go build -o bin/gocovmerge github.com/wadey/gocovmerge

.PHONY: autobahn
autobahn: clean bin/reporter 
	./autobahn/script/test.sh --build --follow-logs
	bin/reporter $(PWD)/autobahn/report/index.json

.PHONY: autobahn/report
autobahn/report: bin/reporter
	./bin/reporter -http localhost:5555 ./autobahn/report/index.json

test:
	go test -coverprofile=ws.coverage .
	go test -coverprofile=wsutil.coverage ./wsutil
	go test -coverprofile=wsfalte.coverage ./wsflate
	# No statements to cover in ./tests (there are only tests).
	go test ./tests

cover: bin/gocovmerge test autobahn
	bin/gocovmerge ws.coverage wsutil.coverage wsflate.coverage autobahn/report/server.coverage > total.coverage

benchcmp: BENCH_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
benchcmp: BENCH_OLD:=$(shell mktemp -t old.XXXX)
benchcmp: BENCH_NEW:=$(shell mktemp -t new.XXXX)
benchcmp:
	if [ ! -z "$(shell git status -s)" ]; then\
		echo "could not compare with $(BENCH_BASE) – found unstaged changes";\
		exit 1;\
	fi;\
	if [ "$(BENCH_BRANCH)" == "$(BENCH_BASE)" ]; then\
		echo "comparing the same branches";\
		exit 1;\
	fi;\
	echo "benchmarking $(BENCH_BRANCH)...";\
	go test -run=none -bench=$(BENCH) -benchmem > $(BENCH_NEW);\
	echo "benchmarking $(BENCH_BASE)...";\
	git checkout -q $(BENCH_BASE);\
	go test -run=none -bench=$(BENCH) -benchmem > $(BENCH_OLD);\
	git checkout -q $(BENCH_BRANCH);\
	echo "\nresults:";\
	echo "========\n";\
	benchcmp $(BENCH_OLD) $(BENCH_NEW);\