42 lines
794 B
Bash
Raw Normal View History

2016-07-23 18:54:58 -04:00
#! /bin/bash
# Get the root directory.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )"
# Change into that dir because we expect that.
cd "$DIR" || exit
2017-01-12 15:47:55 -05:00
2016-07-23 18:54:58 -04:00
function testExample() {
N=$1
INPUT=$2
APP=$3
echo "Example $N"
$APP &> /dev/null &
sleep 2
abci-cli --verbose batch < "$INPUT" > "${INPUT}.out.new"
killall "$APP"
2016-07-23 18:54:58 -04:00
pre=$(shasum < "${INPUT}.out")
post=$(shasum < "${INPUT}.out.new")
2016-07-23 18:54:58 -04:00
if [[ "$pre" != "$post" ]]; then
echo "You broke the tutorial"
echo "Got:"
2016-09-10 20:10:59 -04:00
cat "${INPUT}.out.new"
echo "Expected:"
2016-09-10 20:10:59 -04:00
cat "${INPUT}.out"
2016-07-23 18:54:58 -04:00
exit 1
fi
rm "${INPUT}".out.new
}
2017-01-12 15:47:55 -05:00
testExample 1 tests/test_cli/ex1.abci dummy
testExample 2 tests/test_cli/ex2.abci counter
2016-07-23 18:54:58 -04:00
echo ""
echo "PASS"