summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2013-05-08 01:39:55 +0000
committerDmitry V. Levin <ldv@altlinux.org>2013-05-08 01:54:32 +0000
commit56fb81c696601f6b66ce77fa8732ae9f2fec4e99 (patch)
tree493a9eacb6c6425a58fbe5eece75da032b3678e5
parentde462cf99b2826a564f026cf79b631a1e10dad85 (diff)
downloadstrace-56fb81c696601f6b66ce77fa8732ae9f2fec4e99.tar.gz
strace-56fb81c696601f6b66ce77fa8732ae9f2fec4e99.tar.bz2
strace-56fb81c696601f6b66ce77fa8732ae9f2fec4e99.tar.xz
tests: do not skip tests when timeout utility is not available
* tests/init.sh (check_timeout): New function. * tests/ptrace_setoptions: Use it. * tests/qual_syscall: Likewise. * tests/stat: Likewise. * tests/strace-f: Likewise.
-rw-r--r--tests/init.sh10
-rwxr-xr-xtests/ptrace_setoptions11
-rwxr-xr-xtests/qual_syscall8
-rwxr-xr-xtests/stat11
-rwxr-xr-xtests/strace-f5
5 files changed, 21 insertions, 24 deletions
diff --git a/tests/init.sh b/tests/init.sh
index a4b537c..db7f102 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -2,8 +2,6 @@
ME_="${0##*/}"
-check_timeout=60
-
warn_() { printf >&2 '%s\n' "$*"; }
fail_() { warn_ "$ME_: failed test: $*"; exit 1; }
skip_() { warn_ "$ME_: skipped test: $*"; exit 77; }
@@ -22,3 +20,11 @@ check_strace()
$STRACE -V > /dev/null ||
framework_failure_ "$STRACE is not available"
}
+
+timeout_duration=60
+check_timeout()
+{
+ TIMEOUT="timeout -s 9 $timeout_duration"
+ $TIMEOUT true > /dev/null 2>&1 ||
+ TIMEOUT=
+}
diff --git a/tests/ptrace_setoptions b/tests/ptrace_setoptions
index 7511047..38a2a02 100755
--- a/tests/ptrace_setoptions
+++ b/tests/ptrace_setoptions
@@ -13,19 +13,16 @@ case "$(uname -r)" in
esac
check_strace
-check_prog timeout
+check_timeout
-timeout -s 9 $check_timeout \
-$STRACE -df -enone / 2>&1 |
+$TIMEOUT $STRACE -df -enone / 2>&1 |
grep -F -x 'ptrace_setoptions = 0xe' > /dev/null ||
fail_ 'strace -f failed to recognize proper kernel PTRACE_O_TRACECLONE support'
-timeout -s 9 $check_timeout \
-$STRACE -df -enone / 2>&1 |
+$TIMEOUT $STRACE -df -enone / 2>&1 |
grep -F -x 'ptrace_setoptions = 0x1f' > /dev/null ||
fail_ 'strace -f failed to recognize proper kernel PTRACE_O_TRACESYSGOOD support'
-timeout -s 9 $check_timeout \
-$STRACE -d -enone / 2>&1 |
+$TIMEOUT $STRACE -d -enone / 2>&1 |
grep -F -x 'ptrace_setoptions = 0x11' > /dev/null ||
fail_ 'strace failed to recognize proper kernel PTRACE_O_TRACESYSGOOD support'
diff --git a/tests/qual_syscall b/tests/qual_syscall
index a0ac029..f382f1a 100755
--- a/tests/qual_syscall
+++ b/tests/qual_syscall
@@ -5,12 +5,11 @@
. "${srcdir=.}/init.sh"
check_strace
-check_prog timeout
+check_timeout
check_prog ls
check_prog grep
-timeout -s 9 $check_timeout \
-$STRACE -e execve ls > /dev/null 2> check.log &&
+$TIMEOUT $STRACE -e execve ls > /dev/null 2> check.log &&
grep '^execve(' check.log > /dev/null ||
{ cat check.log; fail_ 'strace -e execve does not work'; }
@@ -18,8 +17,7 @@ grep -v '^execve(' check.log |
LC_ALL=C grep '^[[:alnum:]_]*(' > /dev/null &&
{ cat check.log; fail_ 'strace -e execve does not work properly'; }
-timeout -s 9 $check_timeout \
-$STRACE -e trace=process ls > /dev/null 2> check.log &&
+$TIMEOUT $STRACE -e trace=process ls > /dev/null 2> check.log &&
grep '^execve(' check.log > /dev/null ||
{ cat check.log; fail_ 'strace -e trace=process does not work'; }
diff --git a/tests/stat b/tests/stat
index 69fa5bf..e0fc379 100755
--- a/tests/stat
+++ b/tests/stat
@@ -5,11 +5,11 @@
. "${srcdir=.}/init.sh"
check_strace
+check_timeout
check_prog dd
check_prog find
check_prog grep
check_prog rm
-check_prog timeout
umask 022
truncate_cmd='dd seek=46118400000 obs=1 count=0 if=/dev/null of=sample'
@@ -17,21 +17,18 @@ $truncate_cmd > check.log 2>&1 ||
{ cat check.log; framework_skip_ 'failed to create a large sparse file'; }
rm -f sample
-timeout -s 9 $check_timeout \
-$STRACE -edesc $truncate_cmd 2>&1 > /dev/null 2> check.log &&
+$TIMEOUT $STRACE -edesc $truncate_cmd 2>&1 > /dev/null 2> check.log &&
LC_ALL=C grep -E -x 'ftruncate(64)?\(1, 46118400000\) += 0' check.log > /dev/null ||
{ cat check.log; fail_ 'strace -edesc failed to trace ftruncate/ftruncate64 properly'; }
LC_ALL=C grep -E -x 'lseek\(1, 46118400000, SEEK_CUR\) += 46118400000|_llseek\(1, 46118400000, \[46118400000\], SEEK_CUR\) += 0' check.log > /dev/null ||
{ cat check.log; fail_ 'strace -edesc failed to trace lseek/_llseek properly'; }
-timeout -s 9 $check_timeout \
-$STRACE -efile find -L sample > /dev/null 2> check.log &&
+$TIMEOUT $STRACE -efile find -L sample > /dev/null 2> check.log &&
LC_ALL=C grep -E -x 'stat(64)?\("sample", \{st_mode=S_IFREG\|0644, st_size=46118400000, \.\.\.\}\) += 0|(new)?fstatat(64)?\(AT_FDCWD, "sample", \{st_mode=S_IFREG\|0644, st_size=46118400000, \.\.\.\}, 0\) += 0' check.log > /dev/null ||
{ cat check.log; fail_ 'strace -efile failed to trace stat/stat64 properly'; }
-timeout -s 9 $check_timeout \
-$STRACE -efile find sample > /dev/null 2> check.log &&
+$TIMEOUT $STRACE -efile find sample > /dev/null 2> check.log &&
LC_ALL=C grep -E -x 'lstat(64)?\("sample", \{st_mode=S_IFREG\|0644, st_size=46118400000, \.\.\.\}\) += 0|(new)?fstatat(64)?\(AT_FDCWD, "sample", \{st_mode=S_IFREG\|0644, st_size=46118400000, \.\.\.\}, AT_SYMLINK_NOFOLLOW\) += 0' check.log > /dev/null ||
{ cat check.log; fail_ 'strace -efile failed to trace fstatat/fstatat64 properly'; }
diff --git a/tests/strace-f b/tests/strace-f
index 7b39552..0f76afc 100755
--- a/tests/strace-f
+++ b/tests/strace-f
@@ -5,10 +5,9 @@
. "${srcdir=.}/init.sh"
check_strace
-check_prog timeout
+check_timeout
time=/usr/bin/time
check_prog $time
-timeout -s 9 $check_timeout \
-$STRACE -f $time /bin/ls > check.log 2>&1 ||
+$TIMEOUT $STRACE -f $time /bin/ls > check.log 2>&1 ||
{ cat check.log; fail_ 'strace -f does not work'; }