| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # Copyright (C) 2000-2002, 2004, 2005, 2011, 2012, 2016, 2020 Niels Möller |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 2 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License along |
| 16 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | |
| 19 | failed=0 |
| 20 | all=0 |
| 21 | |
| 22 | debug='no' |
| 23 | testflags='' |
| 24 | |
| 25 | if [scip-shell system . . `[`. -z "$srcdir" ] ; then |
| 26 | srcdir=`pwdscip-shell system . . pwd.` |
| 27 | fi |
| 28 | |
| 29 | export srcdir |
| 30 | |
| 31 | if [scip-shell system . . `[`. -n "$TEST_SHLIB_DIR" ] ; then |
| 32 | # Prepend to LD_LIBRARY_PATH, if it is alredy set. |
| 33 | LD_LIBRARY_PATH="${TEST_SHLIB_DIR}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" |
| 34 | # For MACOS |
| 35 | DYLD_LIBRARY_PATH="$TEST_SHLIB_DIR" |
| 36 | # For Windows |
| 37 | PATH="${TEST_SHLIB_DIR}:${PATH}" |
| 38 | # For Wine |
| 39 | WINEPATH="${TEST_SHLIB_DIR}${WINEPATH:+;$WINEPATH}" |
| 40 | |
| 41 | export LD_LIBRARY_PATH |
| 42 | export DYLD_LIBRARY_PATH |
| 43 | export PATH |
| 44 | export WINEPATH |
| 45 | fi |
| 46 | |
| 47 | # When used in make rules, we sometimes get the filenames VPATH |
| 48 | # expanded, but usually not. |
| 49 | find_programscip-shell shell gmp 2:6.3.0+dfsg-5 find_program(). () { |
| 50 | case "$1" in |
| 51 | */*) |
| 52 | echoscip-shell system . . echo. "$1" |
| 53 | ;; |
| 54 | *) |
| 55 | if [scip-shell system . . `[`. -x "$1" ] ; then |
| 56 | echoscip-shell system . . echo. "./$1" |
| 57 | elif [scip-shell system . . `[`. -x "$1.exe" ] ; then |
| 58 | echoscip-shell system . . echo. "./$1.exe" |
| 59 | else |
| 60 | echoscip-shell system . . echo. "$srcdir/$1" |
| 61 | fi |
| 62 | ;; |
| 63 | esac |
| 64 | } |
| 65 | |
| 66 | env_programscip-shell shell gmp 2:6.3.0+dfsg-5 env_program(). () { |
| 67 | if [scip-shell system . . `[`. -x "$1" ] ; then |
| 68 | if "$1"; then : ; else |
| 69 | echoscip-shell system . . echo. FAIL: $1 |
| 70 | exit 1 |
| 71 | fi |
| 72 | fi |
| 73 | } |
| 74 | |
| 75 | test_programscip-shell shell gmp 2:6.3.0+dfsg-5 test_program(). () { |
| 76 | testname=`basenamescip-shell system . . basename. "$1" .exe` |
| 77 | testname=`basenamescip-shell system . . basename. "$testname" -test` |
| 78 | if [scip-shell system . . `[`. -z "$EMULATOR" ] || headscip-shell system . . head. -1 "$1" | grepscip-shell system . . grep. '^#!' > /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 79 | "$1" $testflags |
| 80 | else |
| 81 | $EMULATOR "$1" $testflags |
| 82 | fi |
| 83 | case "$?" in |
| 84 | 0) |
| 85 | echoscip-shell system . . echo. PASS: $testname |
| 86 | all=`exprscip-shell system . . expr. $all + 1` |
| 87 | ;; |
| 88 | 77) |
| 89 | echoscip-shell system . . echo. SKIP: $testname |
| 90 | ;; |
| 91 | *) |
| 92 | echoscip-shell system . . echo. FAIL: $testname |
| 93 | failed=`exprscip-shell system . . expr. $failed + 1` |
| 94 | all=`exprscip-shell system . . expr. $all + 1` |
| 95 | ;; |
| 96 | esac |
| 97 | } |
| 98 | |
| 99 | env_programscip-shell shell gmp 2:6.3.0+dfsg-5 env_program(). `find_programscip-shell shell gmp 2:6.3.0+dfsg-5 find_program(). setup-env` |
| 100 | |
| 101 | while testscip-shell system . . test. $# != 0 |
| 102 | do |
| 103 | case "$1" in |
| 104 | --debug) |
| 105 | debug=yes |
| 106 | ;; |
| 107 | -v) |
| 108 | testflags='-v' |
| 109 | ;; |
| 110 | -*) |
| 111 | echoscip-shell system . . echo. >&2 'Unknown option `'"$1'" |
| 112 | exit 1 |
| 113 | ;; |
| 114 | *) |
| 115 | break |
| 116 | ;; |
| 117 | esac |
| 118 | shift |
| 119 | done |
| 120 | |
| 121 | # Comment out special handling for zero arguments to support separate |
| 122 | # tests-build/tests-run. |
| 123 | #if [ $# -eq 0 ] ; then |
| 124 | # for f in *-test; do test_program "./$f"; done |
| 125 | #else |
| 126 | for f in "$@" ; do test_programscip-shell shell gmp 2:6.3.0+dfsg-5 test_program(). `find_programscip-shell shell gmp 2:6.3.0+dfsg-5 find_program(). "$f"`; done |
| 127 | #fi |
| 128 | |
| 129 | if [scip-shell system . . `[`. $failed -eq 0 ] ; then |
| 130 | banner="All $all tests passed" |
| 131 | else |
| 132 | banner="$failed of $all tests failed" |
| 133 | fi |
| 134 | dashes=`echoscip-shell system . . echo. "$banner" | sedscip-shell system . . sed. s/./=/g` |
| 135 | echoscip-shell system . . echo. "$dashes" |
| 136 | echoscip-shell system . . echo. "$banner" |
| 137 | echoscip-shell system . . echo. "$dashes" |
| 138 | |
| 139 | if [scip-shell system . . `[`. "x$debug" = xno ] ; then |
| 140 | env_programscip-shell shell gmp 2:6.3.0+dfsg-5 env_program(). `find_programscip-shell shell gmp 2:6.3.0+dfsg-5 find_program(). teardown-env` |
| 141 | fi |
| 142 | |
| 143 | [scip-shell system . . `[`. "$failed" -eq 0 ] |