Debian Codegraph @

Makefile

raw
1 OVS_VERSION ?= v3.5.0
2
3 TESTS ?=
4
5 .PHONY: all
6 all: lint build test integration-test coverage
7
8 .PHONY: modelgen
9 modelgen:
10 @mkdir -p bin
11 @go build -v -o ./bin ./cmd/modelgen
12
13 .PHONY: prebuild
14 prebuild: modelgen ovsdb/serverdb/_server.ovsschema example/vswitchd/ovs.ovsschema
15 @echo "+ $@"
16 @go generate -v ./...
17
18 .PHONY: build
19 build: prebuild
20 @echo "+ $@"
21 @go build -v ./...
22
23 .PHONY: test
24 test: prebuild
25 @echo "+ $@"
26 @go test -race -coverprofile=unit.cov -test.short -timeout 30s -v $(if $(TESTS),-run $(TESTS)) ./...
27
28 .PHONY: integration-test
29 integration-test:
30 @echo "+ $@"
31 @go test -race -coverprofile=integration.cov -coverpkg=github.com/ovn-kubernetes/libovsdb/... -timeout 60s -v $(if $(TESTS),-run $(TESTS)) ./test/ovs
32
33 .PHONY: coverage
34 coverage: test integration-test
35 @sed -i '1d' integration.cov
36 @cat unit.cov integration.cov > profile.cov
37
38 .PHONY: bench
39 bench: install-deps prebuild
40 @echo "+ $@"
41 @go test -run=XXX -count=3 $(if $(TESTS),-bench $(TESTS),-bench .) ./... | tee bench.out
42 @benchstat bench.out
43
44 .PHONY: install-deps
45 install-deps:
46 @echo "+ $@"
47 @./hack/install-deps.sh
48
49 .PHONY: lint
50 lint: install-deps prebuild
51 @echo "+ $@"
52 @golangci-lint run
53
54 ovsdb/serverdb/_server.ovsschema:
55 @curl -sSL https://raw.githubusercontent.com/openvswitch/ovs/${OVS_VERSION}/ovsdb/_server.ovsschema -o $@
56
57 example/vswitchd/ovs.ovsschema:
58 @curl -sSL https://raw.githubusercontent.com/openvswitch/ovs/${OVS_VERSION}/vswitchd/vswitch.ovsschema -o $@