aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: cfbed514bbbc5b07dd42b9c8ac96bdfcd2946f0a (plain) (blame)
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
TEST=.
BENCH=.
COVERPROFILE=/tmp/c.out
BRANCH=`git rev-parse --abbrev-ref HEAD`
COMMIT=`git rev-parse --short HEAD`
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"

default: build

bench:
	go test -v -test.run=NOTHINCONTAINSTHIS -test.bench=$(BENCH)

# http://cloc.sourceforge.net/
cloc:
	@cloc --not-match-f='Makefile|_test.go' .

cover: fmt
	go test -coverprofile=$(COVERPROFILE) -test.run=$(TEST) $(COVERFLAG) .
	go tool cover -html=$(COVERPROFILE)
	rm $(COVERPROFILE)

cpuprofile: fmt
	@go test -c
	@./bolt.test -test.v -test.run=$(TEST) -test.cpuprofile cpu.prof

# go get github.com/kisielk/errcheck
errcheck:
	@echo "=== errcheck ==="
	@errcheck github.com/boltdb/bolt

fmt:
	@go fmt ./...

get:
	@go get -d ./...

build: get
	@mkdir -p bin
	@go build -ldflags=$(GOLDFLAGS) -a -o bin/bolt ./cmd/bolt

test: fmt
	@go get github.com/stretchr/testify/assert
	@echo "=== TESTS ==="
	@go test -v -cover -test.run=$(TEST)
	@echo ""
	@echo ""
	@echo "=== CLI ==="
	@go test -v -test.run=$(TEST) ./cmd/bolt
	@echo ""
	@echo ""
	@echo "=== RACE DETECTOR ==="
	@go test -v -race -test.run="TestSimulate_(100op|1000op)"

.PHONY: bench cloc cover cpuprofile fmt memprofile test