| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # This script is modelled after cmdtest: |
| 4 | # it takes all *.scripts and executes them and saves the stdout/err |
| 5 | # This output is compared against *.stdout/stderr. |
| 6 | # If no difference is found, the test is assumed as PASS (otherwise FAIL) |
| 7 | # |
| 8 | total_ret=0 |
| 9 | testsrc="${srcdir:-.}" |
| 10 | for script in `lsscip-shell system . . ls. -1 ${testsrc}/*.script | sortscip-shell system . . sort.` ; do |
| 11 | base=`basenamescip-shell system . . basename. $script .script` |
| 12 | echoscip-shell system . . echo. "Testing $base" |
| 13 | $script > out.stdout 2> out.stderr |
| 14 | |
| 15 | # check stdout for correctness |
| 16 | if [scip-shell system . . `[`. -f ${testsrc}/$base.stdout ]; then |
| 17 | diffscip-shell system . . diff. out.stdout ${testsrc}/$base.stdout |
| 18 | ret_stdout=$? |
| 19 | else |
| 20 | ret_stdout=0 |
| 21 | fi |
| 22 | |
| 23 | # check stderr for correctness |
| 24 | if [scip-shell system . . `[`. -f ${testsrc}/$base.stderr ]; then |
| 25 | diffscip-shell system . . diff. out.stderr ${testsrc}/$base.stderr |
| 26 | ret_stderr=$? |
| 27 | else |
| 28 | if [scip-shell system . . `[`. -s out.stderr ] ; then |
| 29 | diffscip-shell system . . diff. out.stderr /dev/nullscip-shell filesystem . . `/dev/null`. |
| 30 | ret_stderr=1 |
| 31 | else |
| 32 | ret_stderr=0 |
| 33 | fi |
| 34 | fi |
| 35 | |
| 36 | if [scip-shell system . . `[`. $ret_stdout -eq 0 -a $ret_stderr -eq 0 ]; then |
| 37 | echoscip-shell system . . echo. "OK" |
| 38 | else |
| 39 | echoscip-shell system . . echo. "FAIL" |
| 40 | total_ret=1 |
| 41 | fi |
| 42 | done |
| 43 | |
| 44 | exit $total_ret |