2014-01-12 05:51:01 +00:00
|
|
|
TEST=.
|
|
|
|
BENCH=.
|
|
|
|
COVERPROFILE=/tmp/c.out
|
2014-04-09 11:49:19 +00:00
|
|
|
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
|
|
COMMIT=`git rev-parse --short HEAD`
|
|
|
|
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"
|
2014-01-12 05:51:01 +00:00
|
|
|
|
2014-05-23 16:36:23 +00:00
|
|
|
default: build
|
|
|
|
|
2014-04-11 13:55:14 +00:00
|
|
|
bench:
|
2014-04-14 15:45:44 +00:00
|
|
|
go test -v -test.run=NOTHINCONTAINSTHIS -test.bench=$(BENCH)
|
2014-01-12 05:51:01 +00:00
|
|
|
|
2014-02-20 16:11:52 +00:00
|
|
|
# http://cloc.sourceforge.net/
|
|
|
|
cloc:
|
|
|
|
@cloc --not-match-f='Makefile|_test.go' .
|
|
|
|
|
2014-01-12 05:51:01 +00:00
|
|
|
cover: fmt
|
2014-04-07 22:24:51 +00:00
|
|
|
go test -coverprofile=$(COVERPROFILE) -test.run=$(TEST) $(COVERFLAG) .
|
2014-01-12 05:51:01 +00:00
|
|
|
go tool cover -html=$(COVERPROFILE)
|
|
|
|
rm $(COVERPROFILE)
|
|
|
|
|
2014-03-04 20:02:17 +00:00
|
|
|
cpuprofile: fmt
|
|
|
|
@go test -c
|
2014-05-19 18:08:33 +00:00
|
|
|
@./bolt.test -test.v -test.run=$(TEST) -test.cpuprofile cpu.prof
|
2014-03-04 20:02:17 +00:00
|
|
|
|
2014-03-24 13:38:27 +00:00
|
|
|
# go get github.com/kisielk/errcheck
|
|
|
|
errcheck:
|
|
|
|
@echo "=== errcheck ==="
|
2014-04-19 02:37:45 +00:00
|
|
|
@errcheck github.com/boltdb/bolt
|
2014-03-24 13:38:27 +00:00
|
|
|
|
2014-01-12 05:51:01 +00:00
|
|
|
fmt:
|
|
|
|
@go fmt ./...
|
|
|
|
|
2014-04-08 12:34:26 +00:00
|
|
|
get:
|
|
|
|
@go get -d ./...
|
|
|
|
|
|
|
|
build: get
|
|
|
|
@mkdir -p bin
|
2014-04-19 02:37:45 +00:00
|
|
|
@go build -ldflags=$(GOLDFLAGS) -a -o bin/bolt ./cmd/bolt
|
2014-04-08 12:34:26 +00:00
|
|
|
|
2014-03-24 13:38:27 +00:00
|
|
|
test: fmt errcheck
|
2014-04-08 12:34:26 +00:00
|
|
|
@go get github.com/stretchr/testify/assert
|
2014-02-16 04:50:34 +00:00
|
|
|
@echo "=== TESTS ==="
|
2014-02-09 22:52:19 +00:00
|
|
|
@go test -v -cover -test.run=$(TEST)
|
2014-02-16 04:50:34 +00:00
|
|
|
@echo ""
|
|
|
|
@echo ""
|
2014-04-11 19:23:11 +00:00
|
|
|
@echo "=== CLI ==="
|
|
|
|
@go test -v -test.run=$(TEST) ./cmd/bolt
|
|
|
|
@echo ""
|
|
|
|
@echo ""
|
2014-02-16 04:50:34 +00:00
|
|
|
@echo "=== RACE DETECTOR ==="
|
2014-04-11 21:15:56 +00:00
|
|
|
@go test -v -race -test.run="TestSimulate_(100op|1000op)"
|
2014-01-12 05:51:01 +00:00
|
|
|
|
2014-03-04 20:02:17 +00:00
|
|
|
.PHONY: bench cloc cover cpuprofile fmt memprofile test
|