1
0
mirror of https://github.com/henrydcase/nobs.git synced 2024-11-26 00:51:22 +00:00

makefile: adds bench target

This commit is contained in:
Henry Case 2018-10-25 15:18:54 +01:00
parent 35e326cf2c
commit 51688dc4bb

View File

@ -1,11 +1,16 @@
# I'm sure there is better way. But I would need to find it first # I'm sure there is better way. But I would need to find it first
MK_FILE_PATH = $(lastword $(MAKEFILE_LIST)) MK_FILE_PATH = $(lastword $(MAKEFILE_LIST))
PRJ_DIR = $(abspath $(dir $(MK_FILE_PATH))) PRJ_DIR = $(abspath $(dir $(MK_FILE_PATH)))
GO ?= go
GOPATH_LOCAL = $(PRJ_DIR)/build/ GOPATH_LOCAL = $(PRJ_DIR)/build/
GOPATH_DIR = src/github.com/henrydcase/nobs GOPATH_DIR = src/github.com/henrydcase/nobs
VENDOR_DIR = tls_vendor VENDOR_DIR = tls_vendor
OPTS ?= OPTS ?=
NOASM ?= NOASM ?=
TEST_PATH ?= ./...
GOCACHE ?= off
BENCH_OPTS ?= -v -bench=. -run="NonExistingTest"
ifeq ($(NOASM),1) ifeq ($(NOASM),1)
OPTS+=$(OPTS_TAGS) OPTS+=$(OPTS_TAGS)
@ -34,6 +39,10 @@ cover:
-race -coverprofile=coverage_$(NOASM).txt -covermode=atomic $(OPTS) -v ./... -race -coverprofile=coverage_$(NOASM).txt -covermode=atomic $(OPTS) -v ./...
cat $(GOPATH_LOCAL)/coverage_$(NOASM).txt >> coverage.txt cat $(GOPATH_LOCAL)/coverage_$(NOASM).txt >> coverage.txt
bench: clean $(addprefix prep-,$(TARGETS))
cd $(GOPATH_LOCAL); GOCACHE=$(GOCACHE) GOPATH=$(GOPATH_LOCAL) $(GO) test \
$(BENCH_OPTS) ./...
clean: clean:
rm -rf $(GOPATH_LOCAL) rm -rf $(GOPATH_LOCAL)
rm -rf $(VENDOR_DIR) rm -rf $(VENDOR_DIR)