本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.3KB

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