2020-10-20 15:26:55 +00:00
|
|
|
|
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
|
2024-10-17 20:09:39 +00:00
|
|
|
|
./autobahn/script/test.sh --build --follow-logs
|
2020-10-20 15:26:55 +00:00
|
|
|
|
bin/reporter $(PWD)/autobahn/report/index.json
|
|
|
|
|
|
2024-10-17 20:09:39 +00:00
|
|
|
|
.PHONY: autobahn/report
|
|
|
|
|
autobahn/report: bin/reporter
|
|
|
|
|
./bin/reporter -http localhost:5555 ./autobahn/report/index.json
|
|
|
|
|
|
2020-10-20 15:26:55 +00:00
|
|
|
|
test:
|
|
|
|
|
go test -coverprofile=ws.coverage .
|
|
|
|
|
go test -coverprofile=wsutil.coverage ./wsutil
|
2024-10-17 20:09:39 +00:00
|
|
|
|
go test -coverprofile=wsfalte.coverage ./wsflate
|
|
|
|
|
# No statemenets to cover in ./tests (there are only tests).
|
|
|
|
|
go test ./tests
|
2020-10-20 15:26:55 +00:00
|
|
|
|
|
|
|
|
|
cover: bin/gocovmerge test autobahn
|
2024-10-17 20:09:39 +00:00
|
|
|
|
bin/gocovmerge ws.coverage wsutil.coverage wsflate.coverage autobahn/report/server.coverage > total.coverage
|
2020-10-20 15:26:55 +00:00
|
|
|
|
|
|
|
|
|
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);\
|
|
|
|
|
|