| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Test runner |
| 3 | # Assumption is that this is run in the top-level directory |
| 4 | # If an executable is not specified via the -x option, it defaults to be |
| 5 | # src/angband. |
| 6 | |
| 7 | usagescip-shell shell angband 1:4.2.5+dfsg1-5 usage().() { |
| 8 | echoscip-shell system . . echo. "Usage: $0 [-x executable] <test>" |
| 9 | } |
| 10 | |
| 11 | runscip-shell shell angband 1:4.2.5+dfsg1-5 run().() { |
| 12 | rmscip-shell system . . rm. -rf ~/.angband/Test |
| 13 | |
| 14 | test="$1" |
| 15 | exe="$2" |
| 16 | printfscip-shell system . . printf. "Running: $test... " |
| 17 | $exe -mtest < "$test/input" > "$test/run.out" |
| 18 | if [scip-shell system . . `[`. -x "$test/matcher" ]; then |
| 19 | "$test/matcher" "$test" |
| 20 | else |
| 21 | diffscip-shell system . . diff. "$test/run.out" "$test/output" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 22 | fi |
| 23 | result=$? |
| 24 | if [scip-shell system . . `[`. $result -eq 0 ]; then |
| 25 | printfscip-shell system . . printf. "\033[01;32mPassed\033[00m\n" |
| 26 | else |
| 27 | printfscip-shell system . . printf. "\033[01;31mFailed\033[00m\n" |
| 28 | fi |
| 29 | return $result |
| 30 | } |
| 31 | |
| 32 | argexe=src/angband |
| 33 | if testscip-shell system . . test. $# -gt 0 ; then |
| 34 | if testscip-shell system . . test. x"$1" = x-x ; then |
| 35 | shift |
| 36 | if testscip-shell system . . test. $# -ge 1 ; then |
| 37 | argexe="$1" |
| 38 | shift |
| 39 | else |
| 40 | usagescip-shell shell angband 1:4.2.5+dfsg1-5 usage(). |
| 41 | exit 1 |
| 42 | fi |
| 43 | fi |
| 44 | fi |
| 45 | if testscip-shell system . . test. $# -eq 1 ; then |
| 46 | argtest="$1" |
| 47 | else |
| 48 | usagescip-shell shell angband 1:4.2.5+dfsg1-5 usage(). |
| 49 | exit 1 |
| 50 | fi |
| 51 | |
| 52 | runscip-shell shell angband 1:4.2.5+dfsg1-5 run(). "$argtest" "$argexe" |