github.com/coyove/sdss@v0.0.0-20231129015646-c2ec58cca6a2/contrib/roaring/Makefile (about) 1 .PHONY: help all test format fmtcheck vet lint qa deps clean nuke ser fetch-real-roaring-datasets 2 3 4 5 6 7 8 9 10 # Display general help about this command 11 help: 12 @echo "" 13 @echo "The following commands are available:" 14 @echo "" 15 @echo " make qa : Run all the tests" 16 @echo " make test : Run the unit tests" 17 @echo "" 18 @echo " make format : Format the source code" 19 @echo " make fmtcheck : Check if the source code has been formatted" 20 @echo " make vet : Check for suspicious constructs" 21 @echo " make lint : Check for style errors" 22 @echo "" 23 @echo " make deps : Get the dependencies" 24 @echo " make clean : Remove any build artifact" 25 @echo " make nuke : Deletes any intermediate file" 26 @echo "" 27 @echo " make fuzz-smat : Fuzzy testing with smat" 28 @echo " make fuzz-stream : Fuzzy testing with stream deserialization" 29 @echo " make fuzz-buffer : Fuzzy testing with buffer deserialization" 30 @echo "" 31 32 # Alias for help target 33 all: help 34 test: 35 go test 36 go test -race -run TestConcurrent* 37 # Format the source code 38 format: 39 @find ./ -type f -name "*.go" -exec gofmt -w {} \; 40 41 # Check if the source code has been formatted 42 fmtcheck: 43 @mkdir -p target 44 @find ./ -type f -name "*.go" -exec gofmt -d {} \; | tee target/format.diff 45 @test ! -s target/format.diff || { echo "ERROR: the source code has not been formatted - please use 'make format' or 'gofmt'"; exit 1; } 46 47 # Check for syntax errors 48 vet: 49 GOPATH=$(GOPATH) go vet ./... 50 51 # Check for style errors 52 lint: 53 GOPATH=$(GOPATH) PATH=$(GOPATH)/bin:$(PATH) golint ./... 54 55 56 57 58 59 # Alias to run all quality-assurance checks 60 qa: fmtcheck test vet lint 61 62 # --- INSTALL --- 63 64 # Get the dependencies 65 deps: 66 GOPATH=$(GOPATH) go get github.com/stretchr/testify 67 GOPATH=$(GOPATH) go get github.com/bits-and-blooms/bitset 68 GOPATH=$(GOPATH) go get github.com/golang/lint/golint 69 GOPATH=$(GOPATH) go get github.com/mschoch/smat 70 GOPATH=$(GOPATH) go get github.com/dvyukov/go-fuzz/go-fuzz 71 GOPATH=$(GOPATH) go get github.com/dvyukov/go-fuzz/go-fuzz-build 72 GOPATH=$(GOPATH) go get github.com/glycerine/go-unsnap-stream 73 GOPATH=$(GOPATH) go get github.com/philhofer/fwd 74 GOPATH=$(GOPATH) go get github.com/jtolds/gls 75 76 fuzz-smat: 77 go test -tags=gofuzz -run=TestGenerateSmatCorpus 78 go-fuzz-build -func FuzzSmat github.com/RoaringBitmap/roaring 79 go-fuzz -bin=./roaring-fuzz.zip -workdir=workdir/ -timeout=200 80 81 82 fuzz-stream: 83 go-fuzz-build -func FuzzSerializationStream github.com/RoaringBitmap/roaring 84 go-fuzz -bin=./roaring-fuzz.zip -workdir=workdir/ -timeout=200 85 86 87 fuzz-buffer: 88 go-fuzz-build -func FuzzSerializationBuffer github.com/RoaringBitmap/roaring 89 go-fuzz -bin=./roaring-fuzz.zip -workdir=workdir/ -timeout=200 90 91 # Remove any build artifact 92 clean: 93 GOPATH=$(GOPATH) go clean ./... 94 95 # Deletes any intermediate file 96 nuke: 97 rm -rf ./target 98 GOPATH=$(GOPATH) go clean -i ./... 99 100 cover: 101 go test -coverprofile=coverage.out 102 go tool cover -html=coverage.out 103 104 fetch-real-roaring-datasets: 105 # pull github.com/RoaringBitmap/real-roaring-datasets -> testdata/real-roaring-datasets 106 git submodule init 107 git submodule update