Makefile 1.6 KB

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