Samuel A. Falvo II | d6092ad | 2013-06-25 14:07:25 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # This script is responsible for executing all the acceptance tests found in |
| 4 | # the acceptance/ directory. |
| 5 | |
| 6 | # Find where _this_ script is running from. |
| 7 | SCRIPTS=$(dirname $0) |
| 8 | SCRIPTS=$(cd $SCRIPTS; pwd) |
| 9 | |
| 10 | # Locate the acceptance test / examples directory. |
| 11 | ACCEPTANCE=$(cd $SCRIPTS/../acceptance; pwd) |
| 12 | |
Samuel A. Falvo II | 1d3fa66 | 2013-06-25 15:29:32 -0700 | [diff] [blame] | 13 | # Go workspace path |
| 14 | WS=$(cd $SCRIPTS/..; pwd) |
| 15 | |
| 16 | # In order to run Go code interactively, we need the GOPATH environment |
| 17 | # to be set. |
| 18 | if [ "x$GOPATH" == "x" ]; then |
| 19 | export GOPATH=$WS |
| 20 | echo "WARNING: You didn't have your GOPATH environment variable set." |
| 21 | echo " I'm assuming $GOPATH as its value." |
| 22 | fi |
| 23 | |
Samuel A. Falvo II | d6092ad | 2013-06-25 14:07:25 -0700 | [diff] [blame] | 24 | # Run all acceptance tests sequentially. |
| 25 | # If any test fails, we fail fast. |
Samuel A. Falvo II | 704a750 | 2013-07-10 15:23:43 -0700 | [diff] [blame] | 26 | LIBS=$(ls $ACCEPTANCE/lib*.go) |
Samuel A. Falvo II | 1d3fa66 | 2013-06-25 15:29:32 -0700 | [diff] [blame] | 27 | for T in $(ls -1 $ACCEPTANCE/[0-9][0-9]*.go); do |
| 28 | if ! [ -x $T ]; then |
Samuel A. Falvo II | 704a750 | 2013-07-10 15:23:43 -0700 | [diff] [blame] | 29 | CMD="go run $T $LIBS -quiet" |
| 30 | echo "$CMD ..." |
| 31 | if ! $CMD ; then |
Samuel A. Falvo II | d6092ad | 2013-06-25 14:07:25 -0700 | [diff] [blame] | 32 | echo "- FAILED. Try re-running w/out the -quiet option to see output." |
| 33 | exit 1 |
| 34 | fi |
| 35 | fi |
| 36 | done |
| 37 | |