github.com/ezoic/ws@v1.0.4-0.20220713205711-5c1d69e074c5/Makefile (about) 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 17 bin/reporter $(PWD)/autobahn/report/index.json 18 19 test: 20 go test -coverprofile=ws.coverage . 21 go test -coverprofile=wsutil.coverage ./wsutil 22 23 cover: bin/gocovmerge test autobahn 24 bin/gocovmerge ws.coverage wsutil.coverage autobahn/report/server.coverage > total.coverage 25 26 benchcmp: BENCH_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) 27 benchcmp: BENCH_OLD:=$(shell mktemp -t old.XXXX) 28 benchcmp: BENCH_NEW:=$(shell mktemp -t new.XXXX) 29 benchcmp: 30 if [ ! -z "$(shell git status -s)" ]; then\ 31 echo "could not compare with $(BENCH_BASE) – found unstaged changes";\ 32 exit 1;\ 33 fi;\ 34 if [ "$(BENCH_BRANCH)" == "$(BENCH_BASE)" ]; then\ 35 echo "comparing the same branches";\ 36 exit 1;\ 37 fi;\ 38 echo "benchmarking $(BENCH_BRANCH)...";\ 39 go test -run=none -bench=$(BENCH) -benchmem > $(BENCH_NEW);\ 40 echo "benchmarking $(BENCH_BASE)...";\ 41 git checkout -q $(BENCH_BASE);\ 42 go test -run=none -bench=$(BENCH) -benchmem > $(BENCH_OLD);\ 43 git checkout -q $(BENCH_BRANCH);\ 44 echo "\nresults:";\ 45 echo "========\n";\ 46 benchcmp $(BENCH_OLD) $(BENCH_NEW);\ 47