github.com/karalabe/go-ethereum@v0.8.5/eth/test/run.sh (about) 1 #!/bin/bash 2 # bash run.sh (testid0 testid1 ...) 3 # runs tests tests/testid0.sh tests/testid1.sh ... 4 # without arguments, it runs all tests 5 6 . tests/common.sh 7 8 TESTS= 9 10 if [ "$#" -eq 0 ]; then 11 for NAME in tests/??.sh; do 12 i=`basename $NAME .sh` 13 TESTS="$TESTS $i" 14 done 15 else 16 TESTS=$@ 17 fi 18 19 ETH=../../ethereum 20 DIR="/tmp/eth.test/nodes" 21 TIMEOUT=10 22 23 mkdir -p $DIR/js 24 25 echo "running tests $TESTS" 26 for NAME in $TESTS; do 27 PIDS= 28 CHAIN="tests/$NAME.chain" 29 JSFILE="$DIR/js/$NAME.js" 30 CHAIN_TEST="$DIR/$NAME/chain" 31 32 echo "RUN: test $NAME" 33 cat tests/common.js > $JSFILE 34 . tests/$NAME.sh 35 sleep $TIMEOUT 36 echo "timeout after $TIMEOUT seconds: killing $PIDS" 37 kill $PIDS 38 if [ -r "$CHAIN" ]; then 39 if diff $CHAIN $CHAIN_TEST >/dev/null ; then 40 echo "chain ok: $CHAIN=$CHAIN_TEST" 41 else 42 echo "FAIL: chains differ: expected $CHAIN ; got $CHAIN_TEST" 43 continue 44 fi 45 fi 46 ERRORS=$DIR/errors 47 if [ -r "$ERRORS" ]; then 48 echo "FAIL: " 49 cat $ERRORS 50 else 51 echo PASS 52 fi 53 done