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.

41 lines
794 B

8 years ago
8 years ago
  1. #! /bin/bash
  2. # Get the root directory.
  3. SOURCE="${BASH_SOURCE[0]}"
  4. while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
  5. DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )"
  6. # Change into that dir because we expect that.
  7. cd "$DIR" || exit
  8. function testExample() {
  9. N=$1
  10. INPUT=$2
  11. APP=$3
  12. echo "Example $N"
  13. $APP &> /dev/null &
  14. sleep 2
  15. abci-cli --verbose batch < "$INPUT" > "${INPUT}.out.new"
  16. killall "$APP"
  17. pre=$(shasum < "${INPUT}.out")
  18. post=$(shasum < "${INPUT}.out.new")
  19. if [[ "$pre" != "$post" ]]; then
  20. echo "You broke the tutorial"
  21. echo "Got:"
  22. cat "${INPUT}.out.new"
  23. echo "Expected:"
  24. cat "${INPUT}.out"
  25. exit 1
  26. fi
  27. rm "${INPUT}".out.new
  28. }
  29. testExample 1 tests/test_cli/ex1.abci dummy
  30. testExample 2 tests/test_cli/ex2.abci counter
  31. echo ""
  32. echo "PASS"