makefile: moved running Scylla to makefile target

- Modernised Makefile
- Scylla and go bench run on separate CPUs

Signed-off-by: Michał Matczuk <michal@scylladb.com>
This commit is contained in:
Michał Matczuk
2020-04-17 11:36:05 +02:00
committed by Michal Jan Matczuk
parent 1e766b10c9
commit 2569c3dd8f
2 changed files with 32 additions and 11 deletions

View File

@@ -1,12 +1,20 @@
all: check test
ifndef GOBIN
export GOBIN := $(GOPATH)/bin
ifndef SCYLLA_VERSION
SCYLLA_VERSION := latest
endif
define dl_tgz
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
endef
ifndef SCYLLA_CPU
SCYLLA_CPU := 0
endif
ifndef GOTEST_CPU
GOTEST_CPU := 1
endif
ifndef GOBIN
GOBIN := $(GOPATH)/bin
endif
.PHONY: fmt
fmt:
@@ -16,7 +24,7 @@ fmt:
check:
@$(GOBIN)/golangci-lint run ./...
GOTEST := go test -count=1 -cover -race -tags all
GOTEST := go test -cpu $(GOTEST_CPU) -count=1 -cover -race -tags all
.PHONY: test
test:
@@ -27,11 +35,26 @@ test:
.PHONY: bench
bench:
@go test -tags all -run=XXX -bench=. -benchmem ./...
@go test -cpu $(GOTEST_CPU) -tags all -run=XXX -bench=. -benchmem ./...
.PHONY: run-scylla
run-scylla:
@echo "==> Running test instance of Scylla $(SCYLLA_VERSION)"
@docker pull scylladb/scylla:$(SCYLLA_VERSION)
@docker run --name scylla -p 9042:9042 --cpuset-cpus=$(SCYLLA_CPU) --memory 1G --rm -d scylladb/scylla:$(SCYLLA_VERSION)
@until docker exec scylla cqlsh -e "DESCRIBE SCHEMA"; do sleep 2; done
.PHONY: stop-scylla
stop-scylla:
@docker stop scylla
.PHONY: get-deps
get-deps:
go get -t ./...
@go mod download
define dl_tgz
@curl -sSq -L $(2) | tar zxf - --strip 1 -C $(GOBIN) --wildcards '*/$(1)'
endef
.PHONY: get-tools
get-tools: