-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (71 loc) · 2.16 KB
/
Makefile
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
SHELL := /bin/bash
PROJECT=tinykv
GOPATH ?= $(shell go env GOPATH)
# Ensure GOPATH is set before running build process.
ifeq "$(GOPATH)" ""
$(error Please set the environment variable GOPATH before running `make`)
endif
# ENV=LOG_LEVEL=fatal
GO := $(ENV) GO111MODULE=on go
GOBUILD := $(GO) build $(BUILD_FLAG) -tags codes
GOTEST := $(GO) test -v --count=1 --parallel=1 -p=1
TEST_LDFLAGS := ""
PACKAGE_LIST := go list ./...| grep -vE "cmd"
PACKAGES := $$($(PACKAGE_LIST))
# Targets
.PHONY: clean test proto kv scheduler dev
default: kv scheduler
dev: default test
test:
@echo "Running tests in native mode."
@export TZ='Asia/Shanghai'; \
LOG_LEVEL=fatal $(GOTEST) -cover $(PACKAGES)
CURDIR := $(shell pwd)
export PATH := $(CURDIR)/bin/:$(PATH)
proto:
mkdir -p $(CURDIR)/bin
(cd proto && ./generate_go.sh)
GO111MODULE=on go build ./proto/pkg/...
kv:
$(GOBUILD) -o bin/tinykv-server kv/main.go
scheduler:
$(GOBUILD) -o bin/tinyscheduler-server scheduler/main.go
ci: default
@echo "Checking formatting"
@test -z "$$(gofmt -s -l $$(find . -name '*.go' -type f -print) | tee /dev/stderr)"
@echo "Running Go vet"
@go vet ./...
format:
@gofmt -s -w `find . -name '*.go' -type f ! -path '*/_tools/*' -print`
project1:
$(GOTEST) ./kv/server -run 1
project2: project2a project2b project2c
project2a:
$(GOTEST) ./raft -run 2A
project2aa:
$(GOTEST) ./raft -run 2AA
project2ab:
$(GOTEST) ./raft -run 2AB
project2ac:
$(GOTEST) ./raft -run 2AC
project2ba:
$(GOTEST) ./kv/test_raftstore -run 2BA
project2b:
$(GOTEST) ./kv/test_raftstore -run 2B
project2c:
$(GOTEST) ./raft ./kv/test_raftstore -run 2C
project3: project3a project3b project3c
project3a:
$(GOTEST) ./raft -run 3A
## testcase总耗时可能会存在超时,所以这里设置下超时为30m(分钟)。
project3b:
$(GOTEST) -timeout 40m ./kv/test_raftstore -run 3B
project3c:
$(GOTEST) ./scheduler/server ./scheduler/server/schedulers -check.f="3C"
project4: project4a project4b project4c
project4a:
$(GOTEST) ./kv/transaction/... -run 4A
project4b:
$(GOTEST) ./kv/transaction/... -run 4B
project4c:
$(GOTEST) ./kv/transaction/... -run 4C