github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/abci/tests/test_cli/test.sh (about) 1 #! /bin/bash 2 set -e 3 4 # Get the root directory. 5 export PATH="$GOBIN:$PATH" 6 SOURCE="${BASH_SOURCE[0]}" 7 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done 8 DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )" 9 10 # Change into that dir because we expect that. 11 cd "$DIR" || exit 12 13 function testExample() { 14 N=$1 15 INPUT=$2 16 APP="$3 $4" 17 18 echo "Example $N: $APP" 19 $APP &> /dev/null & 20 sleep 2 21 abci-cli --log_level=error --verbose batch < "$INPUT" > "${INPUT}.out.new" 22 killall "$3" 23 24 pre=$(shasum < "${INPUT}.out") 25 post=$(shasum < "${INPUT}.out.new") 26 27 if [[ "$pre" != "$post" ]]; then 28 echo "You broke the tutorial" 29 echo "Got:" 30 cat "${INPUT}.out.new" 31 echo "Expected:" 32 cat "${INPUT}.out" 33 exit 1 34 fi 35 36 rm "${INPUT}".out.new 37 } 38 39 testExample 1 tests/test_cli/ex1.abci abci-cli kvstore 40 testExample 2 tests/test_cli/ex2.abci abci-cli counter 41 42 echo "" 43 echo "PASS"