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.

123 lines
3.7 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 && mkdir -p test/logs
  32. docker run -d -v "$(CURDIR)/test/logs:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog
  33. # requires 'tester' the image from above
  34. bash test/p2p/test.sh tester
  35. # the `docker cp` takes a really long time; uncomment for debugging
  36. #
  37. # mkdir -p test/p2p/logs && docker cp rsyslog:/var/log test/p2p/logs
  38. test_p2p_ipv6:
  39. # IPv6 tests require Docker daemon with IPv6 enabled, e.g. in daemon.json:
  40. #
  41. # {
  42. # "ipv6": true,
  43. # "fixed-cidr-v6": "2001:db8:1::/64"
  44. # }
  45. #
  46. # Docker for Mac can set this via Preferences -> Docker Engine.
  47. docker rm -f rsyslog || true
  48. rm -rf test/logs && mkdir -p test/logs
  49. docker run -d -v "$(CURDIR)/test/logs:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog
  50. # requires 'tester' the image from above
  51. bash test/p2p/test.sh tester 6
  52. # the `docker cp` takes a really long time; uncomment for debugging
  53. #
  54. # mkdir -p test/p2p/logs && docker cp rsyslog:/var/log test/p2p/logs
  55. test_integrations:
  56. make build_docker_test_image
  57. make tools
  58. make install
  59. make test_cover
  60. make test_apps
  61. make test_abci_apps
  62. make test_abci_cli
  63. make test_libs
  64. make test_persistence
  65. make test_p2p
  66. # Disabled by default since it requires Docker daemon with IPv6 enabled
  67. #make test_p2p_ipv6
  68. test_release:
  69. @go test -tags release $(PACKAGES)
  70. test100:
  71. @for i in {1..100}; do make test; done
  72. vagrant_test:
  73. vagrant up
  74. vagrant ssh -c 'make test_integrations'
  75. ### go tests
  76. test:
  77. @echo "--> Running go test"
  78. @go test -p 1 $(PACKAGES)
  79. test_race:
  80. @echo "--> Running go test --race"
  81. @go test -p 1 -v -race $(PACKAGES)
  82. # uses https://github.com/sasha-s/go-deadlock/ to detect potential deadlocks
  83. test_with_deadlock:
  84. make set_with_deadlock
  85. make test
  86. make cleanup_after_test_with_deadlock
  87. set_with_deadlock:
  88. @echo "Get Goid"
  89. @go get github.com/petermattis/goid@b0b1615b78e5ee59739545bb38426383b2cda4c9
  90. @echo "Get Go-Deadlock"
  91. @go get github.com/sasha-s/go-deadlock@d68e2bc52ae3291765881b9056f2c1527f245f1e
  92. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.RWMutex/deadlock.RWMutex/'
  93. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/sync.Mutex/deadlock.Mutex/'
  94. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w
  95. # cleanes up after you ran test_with_deadlock
  96. cleanup_after_test_with_deadlock:
  97. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.RWMutex/sync.RWMutex/'
  98. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 sed -i.bak 's/deadlock.Mutex/sync.Mutex/'
  99. find . -name "*.go" | grep -v "vendor/" | xargs -n 1 goimports -w
  100. # cleans up the deps to not include the need libs
  101. go mod tidy
  102. .PHONY: test_cover test_apps test_persistence test_p2p test test_race test_integrations test_release test100 vagrant_test