github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/iavl/Makefile (about) 1 GOTOOLS := github.com/golangci/golangci-lint/cmd/golangci-lint 2 VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//') 3 COMMIT := $(shell git log -1 --format='%H') 4 BRANCH=$(shell git rev-parse --abbrev-ref HEAD) 5 6 PDFFLAGS := -pdf --nodefraction=0.1 7 8 CMDFLAGS := -ldflags -X TENDERMINT_IAVL_COLORS_ON=on 9 10 LDFLAGS := -ldflags "-X github.com/tendermint/iavl.Version=$(VERSION) -X github.com/tendermint/iavl.Commit=$(COMMIT) -X github.com/tendermint/iavl.Branch=$(BRANCH)" 11 12 all: lint test install 13 14 15 16 install: 17 ifeq ($(COLORS_ON),) 18 go install ./cmd/iaviewer 19 else 20 go install $(CMDFLAGS) ./cmd/iaviewer 21 endif 22 .PHONY: install 23 24 test: 25 @echo "--> Running go test" 26 @go test ./... $(LDFLAGS) -v --race 27 .PHONY: test 28 29 tools: 30 go get -v $(GOTOOLS) 31 .PHONY: tools 32 33 format: 34 find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s 35 find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w 36 .PHONY: format 37 38 # look into .golangci.yml for enabling / disabling linters 39 lint: 40 @echo "--> Running linter" 41 @golangci-lint run 42 @go mod verify 43 .PHONY: lint 44 45 # bench is the basic tests that shouldn't crash an aws instance 46 bench: 47 cd benchmarks && \ 48 go test $(LDFLAGS) -bench=RandomBytes . && \ 49 go test $(LDFLAGS) -bench=Small . && \ 50 go test $(LDFLAGS) -bench=Medium . && \ 51 go test $(LDFLAGS) -bench=BenchmarkMemKeySizes . 52 .PHONY: bench 53 54 # fullbench is extra tests needing lots of memory and to run locally 55 fullbench: 56 cd benchmarks && \ 57 go test $(LDFLAGS) -bench=RandomBytes . && \ 58 go test $(LDFLAGS) -bench=Small . && \ 59 go test $(LDFLAGS) -bench=Medium . && \ 60 go test $(LDFLAGS) -timeout=30m -bench=Large . && \ 61 go test $(LDFLAGS) -bench=Mem . && \ 62 go test $(LDFLAGS) -timeout=60m -bench=LevelDB . 63 .PHONY: fullbench 64 65 # note that this just profiles the in-memory version, not persistence 66 profile: 67 cd benchmarks && \ 68 go test $(LDFLAGS) -bench=Mem -cpuprofile=cpu.out -memprofile=mem.out . && \ 69 go tool pprof ${PDFFLAGS} benchmarks.test cpu.out > cpu.pdf && \ 70 go tool pprof --alloc_space ${PDFFLAGS} benchmarks.test mem.out > mem_space.pdf && \ 71 go tool pprof --alloc_objects ${PDFFLAGS} benchmarks.test mem.out > mem_obj.pdf 72 .PHONY: profile 73 74 explorecpu: 75 cd benchmarks && \ 76 go tool pprof benchmarks.test cpu.out 77 .PHONY: explorecpu 78 79 exploremem: 80 cd benchmarks && \ 81 go tool pprof --alloc_objects benchmarks.test mem.out 82 .PHONY: exploremem 83 84 delve: 85 dlv test ./benchmarks -- -test.bench=. 86 .PHONY: delve