-
Notifications
You must be signed in to change notification settings - Fork 154
/
Makefile
58 lines (46 loc) · 1.45 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
OVS_VERSION ?= v2.16.0
.PHONY: all
all: lint build test integration-test coverage
.PHONY: modelgen
modelgen:
@mkdir -p bin
@go build -v -o ./bin ./cmd/modelgen
.PHONY: prebuild
prebuild: modelgen ovsdb/serverdb/_server.ovsschema example/vswitchd/ovs.ovsschema
@echo "+ $@"
@go generate -v ./...
.PHONY: build
build: prebuild
@echo "+ $@"
@go build -v ./...
.PHONY: test
test: prebuild
@echo "+ $@"
@go test -race -coverprofile=unit.cov -test.short -timeout 30s -v ./...
.PHONY: integration-test
integration-test:
@echo "+ $@"
@go test -race -coverprofile=integration.cov -coverpkg=github.com/ovn-org/libovsdb/... -timeout 60s -v ./test/ovs
.PHONY: coverage
coverage: test integration-test
@sed -i '1d' integration.cov
@cat unit.cov integration.cov > profile.cov
.PHONY: bench
bench: install-deps prebuild
@echo "+ $@"
@go test -run=XXX -count=3 -bench=. ./... | tee bench.out
@benchstat bench.out
.PHONY: install-deps
install-deps:
@echo "+ $@"
@go install github.com/golangci/golangci-lint/cmd/[email protected]
@golangci-lint --version
@go install golang.org/x/perf/cmd/benchstat@latest
.PHONY: lint
lint: install-deps prebuild
@echo "+ $@"
@golangci-lint run
ovsdb/serverdb/_server.ovsschema:
@curl -sSL https://raw.githubusercontent.com/openvswitch/ovs/${OVS_VERSION}/ovsdb/_server.ovsschema -o $@
example/vswitchd/ovs.ovsschema:
@curl -sSL https://raw.githubusercontent.com/openvswitch/ovs/${OVS_VERSION}/vswitchd/vswitch.ovsschema -o $@