Dmitry V. Levin | 4e4b5ad | 2011-02-27 00:28:50 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | ME_="${0##*/}" |
| 4 | |
Dmitry V. Levin | 107ceb9 | 2013-06-18 13:35:29 +0000 | [diff] [blame] | 5 | LOG="$ME_.tmp" |
| 6 | rm -f "$LOG" |
| 7 | |
Dmitry V. Levin | 4e4b5ad | 2011-02-27 00:28:50 +0000 | [diff] [blame] | 8 | warn_() { printf >&2 '%s\n' "$*"; } |
| 9 | fail_() { warn_ "$ME_: failed test: $*"; exit 1; } |
| 10 | skip_() { warn_ "$ME_: skipped test: $*"; exit 77; } |
| 11 | framework_failure_() { warn_ "$ME_: framework failure: $*"; exit 99; } |
Mike Frysinger | e689e04 | 2011-02-28 19:57:24 -0500 | [diff] [blame] | 12 | framework_skip_() { warn_ "$ME_: framework skip: $*"; exit 77; } |
Dmitry V. Levin | 4e4b5ad | 2011-02-27 00:28:50 +0000 | [diff] [blame] | 13 | |
| 14 | check_prog() |
| 15 | { |
Maxin B. John | 066a733 | 2013-03-18 11:35:06 +0100 | [diff] [blame] | 16 | type "$@" > /dev/null 2>&1 || |
Mike Frysinger | e689e04 | 2011-02-28 19:57:24 -0500 | [diff] [blame] | 17 | framework_skip_ "$* is not available" |
Dmitry V. Levin | 4e4b5ad | 2011-02-27 00:28:50 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | check_strace() |
| 21 | { |
Dmitry V. Levin | 84abf70 | 2012-03-15 20:17:49 +0000 | [diff] [blame] | 22 | STRACE=${*:-../strace} |
Dmitry V. Levin | 4e4b5ad | 2011-02-27 00:28:50 +0000 | [diff] [blame] | 23 | $STRACE -V > /dev/null || |
| 24 | framework_failure_ "$STRACE is not available" |
| 25 | } |
Dmitry V. Levin | 56fb81c | 2013-05-08 01:39:55 +0000 | [diff] [blame] | 26 | |
| 27 | timeout_duration=60 |
| 28 | check_timeout() |
| 29 | { |
| 30 | TIMEOUT="timeout -s 9 $timeout_duration" |
| 31 | $TIMEOUT true > /dev/null 2>&1 || |
| 32 | TIMEOUT= |
| 33 | } |