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.

106 lines
3.0 KiB

  1. #!/usr/bin/make -f
  2. ########################################
  3. ### Testing
  4. BINDIR ?= $(GOPATH)/bin
  5. ## required to be run first by most tests
  6. build_docker_test_image:
  7. docker build -t tester -f ./test/docker/Dockerfile .
  8. ### coverage, app, persistence, and libs tests
  9. test_cover:
  10. # run the go unit tests with coverage
  11. bash test/test_cover.sh
  12. test_apps:
  13. # run the app tests using bash
  14. # requires `abci-cli` and `tendermint` binaries installed
  15. bash test/app/test.sh
  16. test_abci_apps:
  17. bash abci/tests/test_app/test.sh
  18. test_abci_cli:
  19. # test the cli against the examples in the tutorial at:
  20. # ./docs/abci-cli.md
  21. # if test fails, update the docs ^
  22. @ bash abci/tests/test_cli/test.sh
  23. test_persistence:
  24. # run the persistence tests using bash
  25. # requires `abci-cli` installed
  26. docker run --name run_persistence -t tester bash test/persist/test_failure_indices.sh
  27. # TODO undockerize
  28. # bash test/persist/test_failure_indices.sh
  29. test_p2p:
  30. docker rm -f rsyslog || true
  31. rm -rf test/logs || true
  32. mkdir test/logs
  33. cd test/
  34. docker run -d -v "logs:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog
  35. cd ..
  36. # requires 'tester' the image from above
  37. bash test/p2p/test.sh tester
  38. # the `docker cp` takes a really long time; uncomment for debugging
  39. #
  40. # mkdir -p test/p2p/logs && docker cp rsyslog:/var/log test/p2p/logs
  41. test_integrations:
  42. make build_docker_test_image
  43. make tools
  44. make install
  45. make test_cover
  46. make test_apps
  47. make test_abci_apps
  48. make test_abci_cli
  49. make test_libs
  50. make test_persistence
  51. make test_p2p
  52. test_release:
  53. @go test -tags release $(PACKAGES)
  54. test100:
  55. @for i in {1..100}; do make test; done
  56. vagrant_test:
  57. vagrant up
  58. vagrant ssh -c 'make test_integrations'
  59. ### go tests
  60. test:
  61. @echo "--> Running go test"
  62. @go test -p 1 $(PACKAGES)
  63. test_race:
  64. @echo "--> Running go test --race"
  65. @go test -p 1 -v -race $(PACKAGES)
  66. # uses https://github.com/sasha-s/go-deadlock/ to detect potential deadlocks
  67. test_with_deadlock:
  68. make set_with_deadlock
  69. make test
  70. make cleanup_after_test_with_deadlock
  71. set_with_deadlock:
  72. @echo "Get Goid"
  73. @go get github.com/petermattis/goid@b0b1615b78e5ee59739545bb38426383b2cda4c9
  74. @echo "Get Go-Deadlock"
  75. @go get github.com/sasha-s/go-deadlock@d68e2bc52ae3291765881b9056f2c1527f245f1e
  76. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.RWMutex/deadlock.RWMutex/'
  77. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.Mutex/deadlock.Mutex/'
  78. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w
  79. # cleanes up after you ran test_with_deadlock
  80. cleanup_after_test_with_deadlock:
  81. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.RWMutex/sync.RWMutex/'
  82. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.Mutex/sync.Mutex/'
  83. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w
  84. # cleans up the deps to not include the need libs
  85. go mod tidy
  86. .PHONY: test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test