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.

103 lines
2.0 KiB

  1. #! /bin/bash
  2. # XXX: removes tendermint dir
  3. cd $GOPATH/src/github.com/tendermint/tendermint
  4. # specify a dir to copy
  5. # TODO: eventually we should replace with `tendermint init --test`
  6. DIR=$HOME/.tendermint_test/consensus_state_test
  7. rm -rf $HOME/.tendermint
  8. cp -r $DIR $HOME/.tendermint
  9. function reset(){
  10. rm -rf $HOME/.tendermint/data
  11. tendermint unsafe_reset_priv_validator
  12. }
  13. reset
  14. # empty block
  15. function empty_block(){
  16. tendermint node --proxy_app=dummy &> /dev/null &
  17. sleep 5
  18. killall tendermint
  19. # /q would print up to and including the match, then quit.
  20. # /Q doesn't include the match.
  21. # http://unix.stackexchange.com/questions/11305/grep-show-all-the-file-up-to-the-match
  22. sed '/HEIGHT: 2/Q' ~/.tendermint/data/cs.wal/wal > consensus/test_data/empty_block.cswal
  23. reset
  24. }
  25. # many blocks
  26. function many_blocks(){
  27. bash scripts/txs/random.sh 1000 36657 &> /dev/null &
  28. PID=$!
  29. tendermint node --proxy_app=dummy &> /dev/null &
  30. sleep 7
  31. killall tendermint
  32. kill -9 $PID
  33. sed '/HEIGHT: 7/Q' ~/.tendermint/data/cs.wal/wal > consensus/test_data/many_blocks.cswal
  34. reset
  35. }
  36. # small block 1
  37. function small_block1(){
  38. bash scripts/txs/random.sh 1000 36657 &> /dev/null &
  39. PID=$!
  40. tendermint node --proxy_app=dummy &> /dev/null &
  41. sleep 10
  42. killall tendermint
  43. kill -9 $PID
  44. sed '/HEIGHT: 2/Q' ~/.tendermint/data/cs.wal/wal > consensus/test_data/small_block1.cswal
  45. reset
  46. }
  47. # small block 2 (part size = 512)
  48. function small_block2(){
  49. echo "" >> ~/.tendermint/config.toml
  50. echo "block_part_size = 512" >> ~/.tendermint/config.toml
  51. bash scripts/txs/random.sh 1000 36657 &> /dev/null &
  52. PID=$!
  53. tendermint node --proxy_app=dummy &> /dev/null &
  54. sleep 5
  55. killall tendermint
  56. kill -9 $PID
  57. sed '/HEIGHT: 2/Q' ~/.tendermint/data/cs.wal/wal > consensus/test_data/small_block2.cswal
  58. reset
  59. }
  60. case "$1" in
  61. "small_block1")
  62. small_block1
  63. ;;
  64. "small_block2")
  65. small_block2
  66. ;;
  67. "empty_block")
  68. empty_block
  69. ;;
  70. "many_blocks")
  71. many_blocks
  72. ;;
  73. *)
  74. small_block1
  75. small_block2
  76. empty_block
  77. many_blocks
  78. esac