blob: c6297c11c5da824e3370008a3ad2d78c13d07974 [file] [log] [blame]
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +00001#!/bin/sh
2
3ME_="${0##*/}"
4
Dmitry V. Levin107ceb92013-06-18 13:35:29 +00005LOG="$ME_.tmp"
6rm -f "$LOG"
7
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +00008warn_() { printf >&2 '%s\n' "$*"; }
9fail_() { warn_ "$ME_: failed test: $*"; exit 1; }
10skip_() { warn_ "$ME_: skipped test: $*"; exit 77; }
11framework_failure_() { warn_ "$ME_: framework failure: $*"; exit 99; }
Mike Frysingere689e042011-02-28 19:57:24 -050012framework_skip_() { warn_ "$ME_: framework skip: $*"; exit 77; }
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +000013
14check_prog()
15{
Maxin B. John066a7332013-03-18 11:35:06 +010016 type "$@" > /dev/null 2>&1 ||
Mike Frysingere689e042011-02-28 19:57:24 -050017 framework_skip_ "$* is not available"
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +000018}
19
20check_strace()
21{
Dmitry V. Levin84abf702012-03-15 20:17:49 +000022 STRACE=${*:-../strace}
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +000023 $STRACE -V > /dev/null ||
24 framework_failure_ "$STRACE is not available"
25}
Dmitry V. Levin56fb81c2013-05-08 01:39:55 +000026
27timeout_duration=60
28check_timeout()
29{
30 TIMEOUT="timeout -s 9 $timeout_duration"
31 $TIMEOUT true > /dev/null 2>&1 ||
32 TIMEOUT=
33}