-
Notifications
You must be signed in to change notification settings - Fork 162
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (53 loc) · 1.62 KB
/
Copy pathMakefile
File metadata and controls
67 lines (53 loc) · 1.62 KB
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
OVS_VERSION ?= v3.7.1
TESTS ?=
.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: check-generated
check-generated: prebuild
@echo "+ $@"
@if ! git diff --quiet; then \
echo "Error: generated files are out of date. Please run 'make prebuild' and commit the changes."; \
git diff --stat; \
exit 1; \
fi
.PHONY: build
build: prebuild
@echo "+ $@"
@go build -v ./...
.PHONY: test
test: prebuild
@echo "+ $@"
@go test -race -coverprofile=unit.cov -test.short -timeout 30s -v $(if $(TESTS),-run $(TESTS)) ./...
.PHONY: integration-test
integration-test:
@echo "+ $@"
@go test -race -coverprofile=integration.cov -coverpkg=github.com/ovn-kubernetes/libovsdb/... -timeout 60s -v $(if $(TESTS),-run $(TESTS)) ./test/ovs
.PHONY: coverage
coverage: test integration-test
@sed -i '1d' integration.cov
@cat unit.cov integration.cov > profile.cov
.PHONY: bench
bench: prebuild
@echo "+ $@"
@go test -run=XXX -count=3 $(if $(TESTS),-bench $(TESTS),-bench .) ./... | tee bench.out
@benchstat bench.out
.PHONY: install-deps
install-deps:
@echo "+ $@"
@mise install
.PHONY: lint
lint: 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 $@