Commit Graph

740 Commits

Author SHA1 Message Date
6e7ba0d8fe tests: robustify -w option test
* tests/count.test: Allow nanosleep to spend a bit less time than 1 second.
2014-06-05 15:42:04 +00:00
Masatake YAMATO
9682107053 unwind: tests: add a test for -k option
* tests/stack-fcall.c: New test target.
* tests/strace-k.test: New test driver.
* tests/Makefile.am (check_PROGRAMS): Add stack-fcall.
(TESTS): Add strace-k.test.
* tests/.gitignore: Add stack-fcall.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-05-30 22:59:27 +00:00
e25fb4fd8e tests: fix SCM_RIGHTS test for big-endian systems
* tests/scm_rights.c (main): Send zero integer to avoid issues with
endianness.
* tests/scm_rights-fd.test: Update grep patterns.
2014-05-30 15:18:00 +00:00
f23b097fc5 Decode file descriptors passed via SCM_RIGHTS control messages
* net.c (printcmsghdr): Print descriptors from SCM_RIGHTS control
messages using printfd.
* tests/scm_rights.c: New file.
* tests/scm_rights-fd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add scm_rights.
(TESTS): Add scm_rights-fd.test.
* tests/.gitignore: Add scm_rights and uio.
2014-05-30 00:20:53 +00:00
772e32b67b tests: add a test for -c and -w options
* tests/count.test: New test.
* tests/Makefile.am (TESTS): Add it.
2014-05-30 00:20:44 +00:00
cc3d59199d tests: add a test for pread/pwrite and preadv/pwritev offset decoding
* tests/uio.c: New file.
* tests/uio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add uio.
(uio_CFLAGS): Define.
(TESTS): Add uio.test.
2014-04-16 23:49:33 +00:00
38593e942a Rewrite signal mask decoding without sigset_t
The sigset_t provided by libc is not quite convenient.
In glibc, sigset_t is an array with space for 1024 bits, which is much
more than required: all architectures supported by Linux have only 64
signals except MIPS, which has 128.
In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than
necessary.

With this change, signal mask is decoded without use of intermediate
sigset_t structure, which saves us some cpu cycles in case of glibc with
its inflated sigset_t, and enables build with libcs where sigset_t is
broken.

Old implementation used to check each signal number in the given signal
mask twice using sigismember().
New implementation is based on popcount and next_set_bit() so it's
noticeably faster.

* configure.ac: Check for __builtin_popcount.
* signal.c: Ensure that NSIG >= 32.
(sprintsigmask, sprintsigmask_long, printsigmask): Remove.
(popcount32, sprintsigmask_n): New functions.
(tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros.
(print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask,
sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use
new signal mask decoding interface.
* tests/sigaction.c (main): Add a test with almost filled signal mask.
* tests/sigaction.awk: Update.
2014-02-27 00:28:39 +00:00
b0c2a9dd5d tests: tighten sigaction check
* tests/sigaction.awk: Check that input conatins all expected lines.
2014-02-08 00:50:10 +00:00
Philippe Ombredanne
894c7e3858 Add decoding of sockets descriptor 'paths' for network calls
* net.c (sys_bind, sys_listen, do_accept, sys_send, sys_sendto,
sys_sendmsg, sys_sendmmsg, sys_recv, sys_recvfrom, sys_recvmsg,
sys_recvmmsg, sys_shutdown, sys_getsockopt, sys_setsockopt): Decode
socket descriptor arguments using printfd.
* pathtrace.c (pathtrace_match): Also check TRACE_NETWORK syscalls
that take socket descriptor arguments.
* tests/net-fd.test: New test for socket descriptor arguments decoding.
* tests/Makefile.am (TESTS): Add net-fd.test.
(net-fd.log): New dependency on net.log.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-02-02 16:51:22 +00:00
123d401508 tests: rename all tests so that their names end in .test suffix
Due to automake limitations, some features work only for tests
that end in one of the suffixes listed in TEST_EXTENSIONS.

* tests/detach-running: Rename to detach-running.test.
* tests/detach-sleeping: Rename to detach-sleeping.test.
* tests/detach-stopped: Rename to detach-stopped.test.
* tests/net: Rename to net.test.
* tests/ptrace_setoptions: Rename to ptrace_setoptions.test.
* tests/qual_syscall: Rename to qual_syscall.test.
* tests/sigaction.sh: Rename to sigaction.test.
* tests/stat: Rename to stat.test.
* tests/strace-f: Rename to strace-f.test.
* tests/Makefile.am (TESTS): Update.
(LOG_COMPILER): Rename to TEST_LOG_COMPILER.
2014-02-02 16:49:41 +00:00
66a15a5bb8 tests: add a test for rt_sigaction output
Since "struct sigaction" varies between architectures, rt_sigaction
decoding sometimes produces incorrect output.  This test is expected
to catch basic rt_sigaction decoding bugs.

Based on a patch proposed by Chris Dearman.

* tests/sigaction.c: New file.
* tests/sigaction.awk: Likewise.
* tests/sigaction.sh: New test.
* tests/Makefile.am (check_PROGRAMS): Add sigaction.
(TESTS): Add sigaction.sh.
(EXTRA_DIST): Add sigaction.awk.
* tests/.gitignore: Add sigaction.
2014-01-08 17:48:25 +00:00
0d7c3653c5 tests: disable /proc based checks when /proc is not mounted
* tests/detach-running: Disable /proc based checks when
/proc/self/status is not available.
* tests/detach-sleeping: Likewise.
* tests/detach-stopped: Likewise.
2013-06-19 14:57:05 +00:00
Denys Vlasenko
a815185d55 tests/detach-{running,sleeping,stopped}: check post-detach state
Check that traced process still exists and is in a right state
after strace detached from it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-19 16:37:24 +02:00
78460f8bb2 tests: ensure that strace can detach from running processes
* tests/detach-running: New test.
* tests/Makefile.am (TESTS): Add it.
2013-06-19 10:22:18 +00:00
223e9a6f85 tests: ensure that strace does not leave sleeping processes stopped
* tests/detach-sleeping: Do not send SIGCONT to the sleeping process.
2013-06-19 01:05:30 +00:00
3cb7a0cd00 tests: fix parallel-tests support in detach-* tests
* tests/detach-sleeping: Use $LOG file for set_ptracer_any output.
* tests/detach-stopped: Likewise.
2013-06-18 22:37:08 +00:00
1e0a28063f tests: parametrize "sleep 1"
* tests/init.sh (SLEEP_A_BIT): New variable.
* tests/detach-sleeping: Use it.
* tests/detach-stopped: Likewise.
2013-06-18 20:51:49 +00:00
97c85088a2 tests: ensure that strace can detach from sleeping and stopped processes
* tests/set_ptracer_any.c: New file.
* tests/detach-sleeping: New test.
* tests/detach-stopped: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add set_ptracer_any.
(TESTS): Add detach-sleeping and detach-stopped.
* tests/.gitignore: Add set_ptracer_any.
2013-06-18 17:07:48 +00:00
f60347d857 tests: enhance timeout checks
Run each test using a wrapper that does all necessary timeout checks.

* tests/run.sh: New file.
* tests/Makefile.am (EXTRA_DIST, LOG_COMPILER): Add it.
* tests/init.sh (check_strace, check_timeout): Remove.
* tests/detach-stopped: Update callers.
* tests/net: Likewise.
* tests/ptrace_setoptions: Likewise.
* tests/qual_syscall: Likewise.
* tests/stat: Likewise.
* tests/strace-f: Likewise.
2013-06-18 17:07:37 +00:00
107ceb935f 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.
2013-06-18 16:58:02 +00:00
56ef5ef90f tests/net: fix portability issues
* tests/net-accept-connect.c: Fix address length passed to bind()
and connect().
* tests/net: Update regexps.
2013-05-08 14:03:38 +00:00
47b0dcca2b tests: add a test for basic network syscalls
* tests/.gitignore: Add net-accept-connect, *.o and *.log.*.
* tests/Makefile.am (AM_CFLAGS): New variable.
(check_PROGRAMS): Add net-accept-connect.
(TESTS): Add net.
* tests/net-accept-connect.c: New file.
* tests/net: New file.
2013-05-08 02:06:39 +00:00
56fb81c696 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.
2013-05-08 01:54:32 +00:00
53f6795d75 tests/stat: enhance regexps
* tests/stat: Enhance regexps that check tracing of stat/stat64 and
fstatat/fstatat64 syscalls.
2013-05-06 19:15:09 +00:00
Chris Metcalf
6f11acd360 tests/stat: support fstatat syscall for stat()
Newer Linux architectures don't support the stat/stat64 syscalls.
Instead they use fstatat() with AT_FDCWD and an extra flags argument.
Support seeing this output in the 'strace -efile' test.

As part of this change, use "grep -E -x" syntax consistently for
all stat tests, since the number of \(foo\)\? expressions was becoming
pretty unwieldy.

* tests/stat: Update stat/stat64 check regexp to handle architectures
that use fstatat instead.  Use "grep -E -x" syntax consistently.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2013-05-06 18:47:50 +00:00
Mike Frysinger
1970da0aa8 tests: stat: fix clean up of sample file
* tests/stat: Also rm the sample file at the end of the test.
2013-05-02 22:06:44 +00:00
Mike Frysinger
d26d011078 Ignore more files
* .gitignore: Add gdb related files.
* tests/.gitignore: Ignore test logs.
2013-05-02 22:06:12 +00:00
318b0dde76 tests: add basic test for ftruncate, lseek and stat family syscalls
* tests/stat: New test.
* tests/Makefile.am (TESTS): Add stat.
2013-05-02 00:44:57 +00:00
Maxin B. John
066a733bc0 tests: relax check_prog to allow timeout command provided by busybox
Busybox version of timeout doesn't have --version option.
Relax check_prog to handle those cases.

* tests/init.sh (check_prog): Use type builtin to check program
availability.

Signed-off-by: Maxin B. John <maxin.john@enea.com>
2013-03-18 22:17:41 +00:00
7b9e45e891 Fix trace=set regression introduced by commit v4.7-111-g9cbc15b
* syscall.c (qual_syscall, qualify): Pass personality down to
qualify_one.
* tests/qual_syscall: New test.
* tests/Makefile.am (TESTS): Add qual_syscall.
2013-03-01 16:22:02 +00:00
823eba28cd tests: raise strace check timeout to 60 seconds
* tests/init.sh (check_timeout): New variable.
* tests/ptrace_setoptions: Use it.
* tests/strace-f: Likewise.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2012-05-01 21:32:09 +00:00
84abf70011 tests: robustify again buggy shells
* tests/init.sh (check_strace): Use "${parameter:-word}" shell syntax
instead of "${parameter-word}".

Reported-by: Mike Frysinger <vapier@gentoo.org>
2012-03-15 20:17:49 +00:00
d1d182209e tests: finish ptrace_setoptions_* merge
* tests/Makefile.am (TESTS): Merge ptrace_setoptions_*.
* tests/ptrace_setoptions: Check for Linux kernel > 2.6.
2011-06-21 15:03:17 +00:00
Denys Vlasenko
8f0f14b6da Fix tests/ptrace_setoptions_* to match last fix in ptrace options code
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-06-21 15:55:07 +02:00
2ea2ab0590 Add test for PTRACE_O_TRACESYSGOOD
* tests/ptrace_setoptions_for_all: New file.
* tests/Makefile.am (TESTS): Add ptrace_setoptions_for_all.
2011-06-09 18:28:02 +00:00
30ecdcc121 tests: update test for linux kernel version
* tests/ptrace_setoptions_followfork: Check for Linux kernel > 2.6.
2011-06-09 18:23:09 +00:00
e254e53d8c Update ptrace_setoptions test
The test have to be adjusted after commit v4.6-5-g3454e4b.

* ptrace_setoptions: Update grep pattern, rename to
ptrace_setoptions_followfork.
* tests/Makefile.am (TESTS): Rename ptrace_setoptions to
ptrace_setoptions_followfork.
2011-06-09 16:10:07 +00:00
f9a84ef39f tests: avoid SIGPIPE
* tests/ptrace_setoptions: Replace "grep -q" with "grep > /dev/null".
The former may result to strace being killed by SIGPIPE, which in
certain configuratons may lead to generation of a core file.
Suggested by Mike Frysinger.
2011-03-03 00:10:20 +00:00
Mike Frysinger
e689e04c10 tests: do not make missing /usr/bin/time a failure
* tests/init.sh (framework_skip_): New function.
(check_prog): Use it instead of framework_failure_.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-01 00:54:06 +00:00
4e4b5adfab Implement two basic "strace -f" tests
* Makefile.am (SUBDIRS): Add tests.
* configure.ac (AC_CONFIG_FILES): Add tests/Makefile.
* tests/.gitignore: New file.
* tests/Makefile.am: Likewise.
* tests/init.sh: Likewise.
* tests/ptrace_setoptions: Likewise.
* tests/strace-f: Likewise.
2011-02-27 00:28:50 +00:00