This repository has been archived by the owner on Sep 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
75 lines (69 loc) · 2 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
VERSION := $(shell git describe --tags | sed -e 's/^v//g' | awk -F "-" '{print $$1}')
ITERATION := $(shell git describe --tags --long | awk -F "-" '{print $$2}')
GO_VERSION=$(shell gobuild -v)
GO := $(or $(GOROOT),/usr/lib/go)/bin/go
PROCS := $(shell nproc)
cores:
@echo "cores: $(PROCS)"
test:
go test -v
bench:
go test -bench .
bench-record:
$(GO) test -bench . > "benchmarks/stun-go-$(GO_VERSION).txt"
fuzz-prepare-msg:
go-fuzz-build -func FuzzMessage -o stun-msg-fuzz.zip github.com/cydev/stun
fuzz-prepare-typ:
go-fuzz-build -func FuzzType -o stun-typ-fuzz.zip github.com/cydev/stun
fuzz-msg:
go-fuzz -bin=./stun-msg-fuzz.zip -workdir=examples/stun-msg
fuzz-typ:
go-fuzz -bin=./stun-typ-fuzz.zip -workdir=examples/stun-typ
lint:
@echo "linting on $(PROCS) cores"
@gometalinter \
-e "_test.go.+(gocyclo|errcheck|dupl)" \
-e "attributes\.go.+credentials,.+,LOW.+\(gas\)" \
--enable="lll" --line-length=80 \
--enable="gofmt" \
--enable="goimports" \
--enable="misspell" \
--enable="unused" \
--deadline=300s \
-j $(PROCS)
@echo "ok"
escape:
@echo "Not escapes, except autogenerated:"
@go build -gcflags '-m -l' 2>&1 \
| grep -v "<autogenerated>" \
| grep escapes
blackbox:
@TEST_EXTERNAL=1 go test -run TestClientSend -v
format:
goimports -w .
bench-compare:
go test -bench . > bench.go-16
go-tip test -bench . > bench.go-tip
@benchcmp bench.go-16 bench.go-tip
install:
go get -u sourcegraph.com/sqs/goreturns
go get -u github.com/alecthomas/gometalinter
gometalinter --install --update
go get -u github.com/cydev/go-fuzz/go-fuzz-build
go get -u github.com/dvyukov/go-fuzz/go-fuzz
push:
git push origin dev
release:
@read -p "Enter new release version: " version; \
./extras/scripts/release.sh $$version
prepare:
go get github.com/mitchellh/gox
go get github.com/tools/godep
godep restore
bindata:
go-bindata-assetfs -prefix="extras" extras/web/...
mv bindata_assetfs.go bindata.go
gofmt -w bindata.go
godep save -r ./...
package:
./extras/scripts/package.sh $(VERSION) $(ITERATION)