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 ?= v3.5.0
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: 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: install-deps 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 "+ $@"
@./hack/install-deps.sh
.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 $@
|