mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
182 lines
4.6 KiB
Makefile
182 lines
4.6 KiB
Makefile
.PHONY: build
|
|
build:
|
|
GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build.sh
|
|
|
|
.PHONY: tools
|
|
tools:
|
|
GO_BUILD_FLAGS="${GO_BUILD_FLAGS} -v -mod=readonly" ./scripts/build_tools.sh
|
|
|
|
# Tests
|
|
|
|
GO_TEST_FLAGS?=
|
|
|
|
.PHONY: test
|
|
test:
|
|
PASSES="unit integration release e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-unit
|
|
test-unit:
|
|
PASSES="unit" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-integration
|
|
test-integration:
|
|
PASSES="integration" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-e2e
|
|
test-e2e: build
|
|
PASSES="e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-grpcproxy-integration
|
|
test-grpcproxy-integration:
|
|
PASSES="grpcproxy_integration" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-grpcproxy-e2e
|
|
test-grpcproxy-e2e: build
|
|
PASSES="grpcproxy_e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-e2e-release
|
|
test-e2e-release: build
|
|
PASSES="release e2e" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: test-robustness
|
|
test-robustness:
|
|
PASSES="robustness" ./scripts/test.sh $(GO_TEST_FLAGS)
|
|
|
|
.PHONY: fuzz
|
|
fuzz:
|
|
./scripts/fuzzing.sh
|
|
|
|
# Static analysis
|
|
|
|
verify: verify-gofmt verify-bom verify-lint verify-dep verify-shellcheck verify-goword \
|
|
verify-govet verify-license-header verify-receiver-name verify-mod-tidy verify-shellcheck \
|
|
verify-shellws verify-proto-annotations verify-genproto verify-goimport
|
|
fix: fix-bom fix-lint
|
|
./scripts/fix.sh
|
|
|
|
.PHONY: verify-gofmt
|
|
verify-gofmt:
|
|
PASSES="gofmt" ./scripts/test.sh
|
|
|
|
.PHONY: verify-bom
|
|
verify-bom:
|
|
PASSES="bom" ./scripts/test.sh
|
|
|
|
.PHONY: update-bom
|
|
fix-bom:
|
|
./scripts/updatebom.sh
|
|
|
|
.PHONY: verify-dep
|
|
verify-dep:
|
|
PASSES="dep" ./scripts/test.sh
|
|
|
|
.PHONY: verify-lint
|
|
verify-lint:
|
|
golangci-lint run
|
|
|
|
.PHONY: update-lint
|
|
fix-lint:
|
|
golangci-lint run --fix
|
|
|
|
.PHONY: verify-shellcheck
|
|
verify-shellcheck:
|
|
PASSES="shellcheck" ./scripts/test.sh
|
|
|
|
.PHONY: verify-goword
|
|
verify-goword:
|
|
PASSES="goword" ./scripts/test.sh
|
|
|
|
.PHONY: verify-govet
|
|
verify-govet:
|
|
PASSES="govet" ./scripts/test.sh
|
|
|
|
.PHONY: verify-license-header
|
|
verify-license-header:
|
|
PASSES="license_header" ./scripts/test.sh
|
|
|
|
.PHONY: verify-receiver-name
|
|
verify-receiver-name:
|
|
PASSES="receiver_name" ./scripts/test.sh
|
|
|
|
.PHONY: verify-mod-tidy
|
|
verify-mod-tidy:
|
|
PASSES="mod_tidy" ./scripts/test.sh
|
|
|
|
.PHONY: verify-shellws
|
|
verify-shellws:
|
|
PASSES="shellws" ./scripts/test.sh
|
|
|
|
.PHONY: verify-proto-annotations
|
|
verify-proto-annotations:
|
|
PASSES="proto_annotations" ./scripts/test.sh
|
|
|
|
.PHONY: verify-genproto
|
|
verify-genproto:
|
|
PASSES="genproto" ./scripts/test.sh
|
|
|
|
.PHONY: verify-goimport
|
|
verify-goimport:
|
|
PASSES="goimport" ./scripts/test.sh
|
|
|
|
# Failpoints
|
|
|
|
GOFAIL_VERSION = $(shell cd tools/mod && go list -m -f {{.Version}} go.etcd.io/gofail)
|
|
|
|
.PHONY: gofail-enable
|
|
gofail-enable: install-gofail
|
|
gofail enable server/etcdserver/ server/storage/backend/ server/storage/mvcc/ server/storage/wal/
|
|
cd ./server && go get go.etcd.io/gofail@${GOFAIL_VERSION}
|
|
cd ./etcdutl && go get go.etcd.io/gofail@${GOFAIL_VERSION}
|
|
cd ./etcdctl && go get go.etcd.io/gofail@${GOFAIL_VERSION}
|
|
cd ./tests && go get go.etcd.io/gofail@${GOFAIL_VERSION}
|
|
|
|
.PHONY: gofail-disable
|
|
gofail-disable: install-gofail
|
|
gofail disable server/etcdserver/ server/storage/backend/ server/storage/mvcc/ server/storage/wal/
|
|
cd ./server && go mod tidy
|
|
cd ./etcdutl && go mod tidy
|
|
cd ./etcdctl && go mod tidy
|
|
cd ./tests && go mod tidy
|
|
|
|
.PHONY: install-gofail
|
|
install-gofail:
|
|
cd tools/mod; go install go.etcd.io/gofail@${GOFAIL_VERSION}
|
|
|
|
build-failpoints-release-3.5:
|
|
rm -rf /tmp/etcd-release-3.5/
|
|
mkdir -p /tmp/etcd-release-3.5/
|
|
cd /tmp/etcd-release-3.5/; \
|
|
git clone --depth 1 --branch release-3.5 https://github.com/etcd-io/etcd.git .; \
|
|
go get go.etcd.io/gofail@${GOFAIL_VERSION}; \
|
|
(cd server; go get go.etcd.io/gofail@${GOFAIL_VERSION}); \
|
|
(cd etcdctl; go get go.etcd.io/gofail@${GOFAIL_VERSION}); \
|
|
(cd etcdutl; go get go.etcd.io/gofail@${GOFAIL_VERSION}); \
|
|
FAILPOINTS=true ./build;
|
|
mkdir -p ./bin
|
|
cp /tmp/etcd-release-3.5/bin/etcd ./bin/etcd
|
|
|
|
build-failpoints-release-3.4:
|
|
rm -rf /tmp/etcd-release-3.4/
|
|
mkdir -p /tmp/etcd-release-3.4/
|
|
cd /tmp/etcd-release-3.4/; \
|
|
git clone --depth 1 --branch release-3.4 https://github.com/etcd-io/etcd.git .; \
|
|
go get go.etcd.io/gofail@${GOFAIL_VERSION}; \
|
|
FAILPOINTS=true ./build;
|
|
mkdir -p ./bin
|
|
cp /tmp/etcd-release-3.4/bin/etcd ./bin/etcd
|
|
|
|
# Cleanup
|
|
|
|
clean:
|
|
rm -f ./codecov
|
|
rm -rf ./covdir
|
|
rm -f ./bin/Dockerfile-release*
|
|
rm -rf ./bin/etcd*
|
|
rm -rf ./default.etcd
|
|
rm -rf ./tests/e2e/default.etcd
|
|
rm -rf ./release
|
|
rm -rf ./coverage/*.err ./coverage/*.out
|
|
rm -rf ./tests/e2e/default.proxy
|
|
rm -rf ./bin/shellcheck*
|
|
find ./ -name "127.0.0.1:*" -o -name "localhost:*" -o -name "*.log" -o -name "agent-*" -o -name "*.coverprofile" -o -name "testname-proxy-*" -delete
|