github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/Makefile (about) 1 GO := go 2 PKG := ./... 3 GOFLAGS := 4 STRESSFLAGS := 5 TAGS := invariants 6 TESTS := . 7 PREV_RELEASE := crl-release-23.1 8 COVER_PROFILE := coverprofile.out 9 10 .PHONY: all 11 all: 12 @echo usage: 13 @echo " make test" 14 @echo " make testrace" 15 @echo " make stress" 16 @echo " make stressrace" 17 @echo " make stressmeta" 18 @echo " make crossversion-meta" 19 @echo " make testcoverage" 20 @echo " make mod-update" 21 @echo " make generate" 22 @echo " make generate-test-data" 23 @echo " make clean" 24 25 override testflags := 26 .PHONY: test 27 test: 28 ${GO} test -tags '$(TAGS)' ${testflags} -run ${TESTS} ${PKG} 29 30 .PHONY: testcoverage 31 testcoverage: 32 ${GO} test -tags '$(TAGS)' ${testflags} -run ${TESTS} ${PKG} -coverprofile ${COVER_PROFILE} 33 34 .PHONY: testrace 35 testrace: testflags += -race -timeout 20m 36 testrace: test 37 38 testasan: testflags += -asan -timeout 20m 39 testasan: test 40 41 testmsan: export CC=clang 42 testmsan: testflags += -msan -timeout 20m 43 testmsan: test 44 45 .PHONY: testobjiotracing 46 testobjiotracing: 47 ${GO} test -tags '$(TAGS) pebble_obj_io_tracing' ${testflags} -run ${TESTS} ./objstorage/objstorageprovider/objiotracing 48 49 .PHONY: lint 50 lint: 51 ${GO} test -tags '$(TAGS)' ${testflags} -run ${TESTS} ./internal/lint 52 53 .PHONY: stress stressrace 54 stressrace: testflags += -race 55 stress stressrace: testflags += -exec 'stress ${STRESSFLAGS}' -timeout 0 -test.v 56 stress stressrace: test 57 58 .PHONY: stressmeta 59 stressmeta: override PKG = ./internal/metamorphic 60 stressmeta: override STRESSFLAGS += -p 1 61 stressmeta: override TESTS = TestMeta$$ 62 stressmeta: stress 63 64 .PHONY: crossversion-meta 65 crossversion-meta: 66 git checkout ${PREV_RELEASE}; \ 67 ${GO} test -c ./internal/metamorphic -o './internal/metamorphic/crossversion/${PREV_RELEASE}.test'; \ 68 git checkout -; \ 69 ${GO} test -c ./internal/metamorphic -o './internal/metamorphic/crossversion/head.test'; \ 70 ${GO} test -tags '$(TAGS)' ${testflags} -v -run 'TestMetaCrossVersion' ./internal/metamorphic/crossversion --version '${PREV_RELEASE},${PREV_RELEASE},${PREV_RELEASE}.test' --version 'HEAD,HEAD,./head.test' 71 72 .PHONY: stress-crossversion 73 stress-crossversion: 74 STRESS=1 ./scripts/run-crossversion-meta.sh crl-release-21.2 crl-release-22.1 crl-release-22.2 crl-release-23.1 master 75 76 .PHONY: generate 77 generate: 78 ${GO} generate ${PKG} 79 80 generate: 81 82 # Note that the output of generate-test-data is not deterministic. This should 83 # only be run manually as needed. 84 .PHONY: generate-test-data 85 generate-test-data: 86 ${GO} run -tags make_incorrect_manifests ./tool/make_incorrect_manifests.go 87 ${GO} run -tags make_test_find_db ./tool/make_test_find_db.go 88 ${GO} run -tags make_test_sstables ./tool/make_test_sstables.go 89 ${GO} run -tags make_test_remotecat ./tool/make_test_remotecat.go 90 91 mod-update: 92 ${GO} get -u 93 ${GO} mod tidy 94 95 .PHONY: clean 96 clean: 97 rm -f $(patsubst %,%.test,$(notdir $(shell go list ${PKG}))) 98 99 git_dirty := $(shell git status -s) 100 101 .PHONY: git-clean-check 102 git-clean-check: 103 ifneq ($(git_dirty),) 104 @echo "Git repository is dirty!" 105 @false 106 else 107 @echo "Git repository is clean." 108 endif 109 110 .PHONY: mod-tidy-check 111 mod-tidy-check: 112 ifneq ($(git_dirty),) 113 $(error mod-tidy-check must be invoked on a clean repository) 114 endif 115 @${GO} mod tidy 116 $(MAKE) git-clean-check 117 118 # TODO(radu): switch back to @latest once bogus doc changes are 119 # addressed; see https://github.com/cockroachdb/crlfmt/pull/44 120 .PHONY: format 121 format: 122 go install github.com/cockroachdb/crlfmt@44a36ec7 && crlfmt -w -tab 2 . 123 124 .PHONY: format-check 125 format-check: 126 ifneq ($(git_dirty),) 127 $(error format-check must be invoked on a clean repository) 128 endif 129 $(MAKE) format 130 git diff 131 $(MAKE) git-clean-check