-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (41 loc) · 1.31 KB
/
Makefile
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
TEST ?=.
BENCH ?=.
BENCH_BASE?=master
autobahn:
go build -o ./bin/autobahn ./example/autobahn
test:
go test -run=$(TEST) -cover ./...
testrfc: PID:=$(shell mktemp -t autobahn.XXXX)
testrfc: autobahn
./bin/autobahn & echo $$! > $(PID)
if [ -z "$$(ps | grep $$(cat $(PID)) | grep autobahn)" ]; then\
echo "could not start autobahn";\
exit 1;\
fi;\
wstest -m fuzzingclient -s ./example/autobahn/fuzzingclient.json
pkill -9 -F $(PID)
rfc: testrfc
open ./example/autobahn/reports/servers/index.html
bench:
go test -run=none -bench=$(BENCH) -benchmem
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);\