diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2013-06-18 13:35:29 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2013-06-18 16:58:02 +0000 |
commit | 107ceb935f43ee3d0e117621d74cf3db09a96838 (patch) | |
tree | 6d2351340a173d74ed78136f3c2458bf0bcda7c7 /tests | |
parent | f1669e7975cb8d67448d52d9ae7dde3301d27273 (diff) | |
download | strace-107ceb935f43ee3d0e117621d74cf3db09a96838.tar.gz strace-107ceb935f43ee3d0e117621d74cf3db09a96838.tar.bz2 strace-107ceb935f43ee3d0e117621d74cf3db09a96838.tar.xz |
tests: prepare for parallel-tests support
* tests/Makefile.am (CLEANFILES): Calculate dynamically from TESTS.
* tests/init.sh (LOG): New variable.
* tests/detach-stopped: Use it.
* tests/net: Likewise.
* tests/qual_syscall: Likewise.
* tests/stat: Likewise.
* tests/strace-f: Likewise.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/init.sh | 3 | ||||
-rwxr-xr-x | tests/net | 14 | ||||
-rwxr-xr-x | tests/qual_syscall | 20 | ||||
-rwxr-xr-x | tests/stat | 26 | ||||
-rwxr-xr-x | tests/strace-f | 4 |
6 files changed, 36 insertions, 33 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index a7f584d..c72fc9d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,4 +8,4 @@ TESTS = ptrace_setoptions strace-f qual_syscall stat net EXTRA_DIST = init.sh $(TESTS) -CLEANFILES = check.log +CLEANFILES = $(TESTS:=.tmp) diff --git a/tests/init.sh b/tests/init.sh index db7f102..c6297c1 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -2,6 +2,9 @@ ME_="${0##*/}" +LOG="$ME_.tmp" +rm -f "$LOG" + warn_() { printf >&2 '%s\n' "$*"; } fail_() { warn_ "$ME_: failed test: $*"; exit 1; } skip_() { warn_ "$ME_: skipped test: $*"; exit 77; } @@ -9,29 +9,29 @@ check_timeout check_prog grep check_prog rm -rm -f check.log.* +rm -f $LOG.* $TIMEOUT ./net-accept-connect || fail_ 'net-accept-connect failed' -args='-tt -ff -o check.log -enetwork ./net-accept-connect' +args="-tt -ff -o $LOG -enetwork ./net-accept-connect" $TIMEOUT $STRACE $args || fail_ "strace $args failed" -"$srcdir"/../strace-log-merge check.log > check.log || { - cat check.log +"$srcdir"/../strace-log-merge $LOG > $LOG || { + cat $LOG fail_ 'strace-log-merge failed' } -rm -f check.log.* +rm -f $LOG.* grep_log() { local syscall="$1"; shift local prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +' - LC_ALL=C grep -E -x "$prefix$syscall$@" check.log > /dev/null || { - cat check.log + LC_ALL=C grep -E -x "$prefix$syscall$@" $LOG > /dev/null || { + cat $LOG fail_ "strace -enetwork failed to trace \"$syscall\" properly" } } diff --git a/tests/qual_syscall b/tests/qual_syscall index f382f1a..9d75fca 100755 --- a/tests/qual_syscall +++ b/tests/qual_syscall @@ -9,19 +9,19 @@ check_timeout check_prog ls check_prog grep -$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'; } +$TIMEOUT $STRACE -e execve ls > /dev/null 2> $LOG && +grep '^execve(' $LOG > /dev/null || + { cat $LOG; fail_ 'strace -e execve does not work'; } -grep -v '^execve(' check.log | +grep -v '^execve(' $LOG | LC_ALL=C grep '^[[:alnum:]_]*(' > /dev/null && - { cat check.log; fail_ 'strace -e execve does not work properly'; } + { cat $LOG; fail_ 'strace -e execve does not work properly'; } -$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'; } +$TIMEOUT $STRACE -e trace=process ls > /dev/null 2> $LOG && +grep '^execve(' $LOG > /dev/null || + { cat $LOG; fail_ 'strace -e trace=process does not work'; } -grep '^open' check.log > /dev/null && - { cat check.log; fail_ 'strace -e trace=process does not work properly'; } +grep '^open' $LOG > /dev/null && + { cat $LOG; fail_ 'strace -e trace=process does not work properly'; } exit 0 @@ -13,24 +13,24 @@ check_prog rm umask 022 truncate_cmd='dd seek=46118400000 obs=1 count=0 if=/dev/null of=sample' -$truncate_cmd > check.log 2>&1 || - { cat check.log; framework_skip_ 'failed to create a large sparse file'; } +$truncate_cmd > $LOG 2>&1 || + { cat $LOG; framework_skip_ 'failed to create a large sparse file'; } rm -f sample -$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'; } +$TIMEOUT $STRACE -edesc $truncate_cmd 2>&1 > /dev/null 2> $LOG && +LC_ALL=C grep -E -x 'ftruncate(64)?\(1, 46118400000\) += 0' $LOG > /dev/null || + { cat $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'; } +LC_ALL=C grep -E -x 'lseek\(1, 46118400000, SEEK_CUR\) += 46118400000|_llseek\(1, 46118400000, \[46118400000\], SEEK_CUR\) += 0' $LOG > /dev/null || + { cat $LOG; fail_ 'strace -edesc failed to trace lseek/_llseek properly'; } -$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 $STRACE -efile find -L sample > /dev/null 2> $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' $LOG > /dev/null || + { cat $LOG; fail_ 'strace -efile failed to trace stat/stat64 properly'; } -$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'; } +$TIMEOUT $STRACE -efile find sample > /dev/null 2> $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' $LOG > /dev/null || + { cat $LOG; fail_ 'strace -efile failed to trace fstatat/fstatat64 properly'; } rm -f sample diff --git a/tests/strace-f b/tests/strace-f index 0f76afc..20fd943 100755 --- a/tests/strace-f +++ b/tests/strace-f @@ -9,5 +9,5 @@ check_timeout time=/usr/bin/time check_prog $time -$TIMEOUT $STRACE -f $time /bin/ls > check.log 2>&1 || - { cat check.log; fail_ 'strace -f does not work'; } +$TIMEOUT $STRACE -f $time /bin/ls > $LOG 2>&1 || + { cat $LOG; fail_ 'strace -f does not work'; } |