Commit Graph

843 Commits

Author SHA1 Message Date
8df052e2ae ip_mreq.test: rewrite from match_grep to match_diff
* tests/ip_mreq.c (main): Print expected output.
* tests/ip_mreq.test: Use run_strace_match_diff.
* tests/ip_mreq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-08-02 16:33:09 +00:00
79bbee8368 fanotify_mark.test: rewrite from match_grep to match_diff
* tests/fanotify_mark.c (main): Print expected output.
* tests/fanotify_mark.test: Use run_strace_match_diff.
* tests/fanotify_mark.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-08-02 11:11:52 +00:00
884e1e930b signalfd4.test: rewrite from match_grep to match_diff
* tests/signalfd4.c (get_sigset_size): New function.
(main): Use it.  Print expected output.
* tests/signalfd4.test: Use run_strace_match_diff.
* tests/signalfd4.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-08-02 11:00:06 +00:00
4f328761f3 tests: rename signalfd.test to signalfd4.test
* tests/signalfd.c: Rename to signalfd4.c.
* tests/signalfd.test: Rename to signalfd4.test.
* tests/signalfd.expected: Rename to signalfd4.expected.
* tests/.gitignore: Replace signalfd with signalfd4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Replace signalfd.test with signalfd4.test.
(EXTRA_DIST): Replace signalfd.expected with signalfd4.expected.
2016-07-31 21:55:23 +00:00
c4fdce5cea memfd_create.test: rewrite from match_grep to match_diff
* tests/memfd_create.c (main): Print expected output.
* tests/memfd_create.test: Use run_strace_match_diff.
* tests/memfd_create.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-07-30 22:52:27 +00:00
f915f220c0 tests: use terse notation in designated initializers where appropriate
* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Initialize
struct btrfs_ioctl_dev_replace_args using terse notation.
* tests/clock_nanosleep.c (main): Initialize struct timespec
using terse notation.
* tests/nanosleep.c (main): Likewise.
2016-07-28 18:32:28 +00:00
469fd109cd Consistently use extended regular expressions where appropriate
When grep or sed is used with basic regular expressions containing
'(', ')', '{', '}', '|', '?', and '+' special characters, convert them
to extended regular expressions for better portability and readability.

* generate_mpers_am.sh: Convert grep and sed BREs to EREs.
* Makefile.am (ioctl_redefs%.h, m%_type_defs.h, m%_funcs.h,
mpers_printer_decl_pattern, printers.h, %_printer_decls.h,
%_printer_defs.h): Convert sed BREs to EREs.
* generate_sen.sh: Likewise.
* linux/mips/genstub.sh: Likewise.
* make-dsc: Likewise.
* mpers.sh: Likewise.
* xlat/gen.sh: Likewise.
* tests/Makefile.am (ksysent.h): Likewise.
* tests/ksysent.sed: Likewise.
* tests/pc.test: Likewise.
* tests/strace-S.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-k.test: Likewise.
2016-07-28 18:32:18 +00:00
1b2500c6bf tests: fix extended regexps
* tests/adjtimex.c (main): Consistently quote curly braces
in expected output.
* tests/uio.expected: Likewise.
2016-07-28 00:06:46 +00:00
de5b0092a6 Fix one more code pattern that might break gcc strict aliasing rules
* btrfs.c (btrfs_ioctl): Add one more expicit cast to "void *",
to avoid breaking strict-aliasing rules reported by some gcc compilers.
* syscall.c (decode_socket_subcall): Likewise.
* util.c (next_set_bit): Likewise.
* tests/btrfs.c (btrfs_test_send_ioctl): Likewise.
2016-07-26 16:14:50 +00:00
e43bb8dffc tests/btrfs.c: do not include the same header file twice
* tests/btrfs.c: Do not include <sys/fcntl.h>, <fcntl.h> is enough.
2016-07-26 15:51:55 +00:00
9d168f3cdf tests: fix accept4.test on systems that lack SOCK_CLOEXEC definition
* tests/accept4.c: Check that O_CLOEXEC is defined.  Use O_CLOEXEC
instead of SOCK_CLOEXEC.
2016-07-26 15:33:22 +00:00
cb44289ee3 tests: fix vhangup.test
* tests/vhangup.c (main): Fix expected output for the case when
the calling process has CAP_SYS_TTY_CONFIG capability.

Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>
2016-07-26 12:16:58 +00:00
58d0ee2ea5 tests: fix chown.test
* tests/chown.test: Fix the value specified for strace -a parameter.

Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>
2016-07-26 09:58:37 +00:00
76ebcf1476 tests/ipc.c: fix typo 2016-07-25 09:20:09 +00:00
1a7c38dc52 tests: check decoding of ipc syscall
* tests/ipc.c: New file.
* tests/ipc.test: New test.
* tests/.gitignore: Add ipc.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ipc.test.
2016-07-22 19:30:30 +00:00
9c652ccf90 tests: skip netlink_protocol.test on old systems
* tests/netlink_protocol.c: Check that HAVE_SYS_XATTR_H is defined.
Include <stdlib.h> and <sys/xattr.h>.
(main): Check that system.sockprotoname attribute is supported.
2016-07-21 20:57:55 +00:00
b7844f8b4a Do not print too many arguments of socketcall syscall
* socketcall.c (SYS_FUNC(socketcall)): Print just "call" and "args"
syscall arguments.
* tests/socketcall.c (test_socketcall): Update expected output.
* tests/socketcall.test: Likewise.
2016-07-21 12:32:14 +00:00
3b6bc9b40d tests/nsyscalls.c: change the type of syscall arguments to kernel_ulong_t
As most syscalls on x32 and mips n32 are actually 64-bit,
check that 64-bit syscall arguments are decoded properly.

This also workarounds x32 gcc sign extension bug
reported by Eugene Syromyatnikov at
https://sourceforge.net/p/strace/mailman/message/35150860/

* tests/nsyscalls.c: Include "kernel_types.h".
(main): Change the type of syscall arguments to kernel_ulong_t.
2016-07-20 11:16:37 +00:00
b49c65cece tests: check decoding of socketcall syscall
* tests/socketcall.c: New file.
* tests/socketcall.test: New test.
* tests/.gitignore: Add socketcall.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add socketcall.test.
2016-07-20 11:16:37 +00:00
374dc48dbd tests: check decoding and dumping of send and recv syscalls
* tests/unix-pair-send-recv.c: New file.
* tests/unix-pair-send-recv.expected: Likewise.
* tests/unix-pair-send-recv.test: New test.
* tests/.gitignore: Add unix-pair-send-recv.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unix-pair-send-recv.test.
(EXTRA_DIST): Add unix-pair-send-recv.expected.
2016-07-19 17:46:33 +00:00
1991ee94bc tests: rename unix-pair-send-recv to unix-pair-sendto-recvfrom
* dumpio.expected: Rename to unix-pair-sendto-recvfrom.expected.
* dumpio.test: Rename to unix-pair-sendto-recvfrom.test.
* unix-pair-send-recv.c: Rename to unix-pair-sendto-recvfrom.c
* .gitignore: Rename unix-pair-send-recv to unix-pair-sendto-recvfrom.
* Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unix-pair-sendto-recvfrom.test.
(MISC_TESTS): Remove dumpio.test.
(EXTRA_DIST): Rename dumpio.expected
to unix-pair-sendto-recvfrom.expected.
2016-07-19 17:46:33 +00:00
d95eaefb45 tests: check decoding of shutdown syscall
* tests/shutdown.c: New file.
* tests/shutdown.test: New test.
* tests/.gitignore: Add shutdown.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add shutdown.test.
2016-07-19 17:46:33 +00:00
349750e1bc tests: check silent decoding of sendmmsg and recvmmsg syscalls
* tests/mmsg-silent.c: New file.
* tests/mmsg-silent.test: New test.
* tests/.gitignore: Add mmsg-silent.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mmsg-silent.test.
2016-07-19 17:46:33 +00:00
0d88d99da2 Print unsent messages of failed sendmmsg syscall
* mmsghdr.c (decode_mmsgvec): Clear syserror for the time of printing
struct mmsghdr array in !use_msg_len case.
(SYS_FUNC(sendmmsg)): As failed sendmmsg syscall does not
set msg_len fields, tell this to decode_mmsgvec.
* tests/mmsg_name.c (test_mmsg_name): Check it.
2016-07-19 17:46:33 +00:00
3a161d1902 Print unsent messages of sendmmsg syscall
* defs.h (decode_mmsgvec): Add int argument.
* mmsghdr.c (print_struct_mmsghdr_config): Add msg_len_vlen field.
(print_struct_mmsghdr): Print struct mmsghdr.msg_len only for
msg_len_vlen first elements of struct mmsghdr array.
(decode_mmsgvec): Add msg_len_vlen argument.
(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Pass to decode_mmsgvec
the number of elements of struct mmsghdr array that contain meaningful
struct mmsghdr.msg_len.
* tests/mmsg_name.c (test_mmsg_name): Check it.
2016-07-19 17:46:33 +00:00
850523683d tests: check verbose decoding of msg_name* fields of struct mmsghdr array
* tests/mmsg_name-v.c: New file.
* tests/mmsg_name-v.test: New test.
* tests/.gitignore: Add mmsg_name-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mmsg_name-v.test.
2016-07-19 17:46:33 +00:00
80bd8e11fa tests: check decoding of msg_name* fields of struct mmsghdr array
* tests/mmsg_name.c: New file.
* tests/mmsg_name.test: New test.
* tests/.gitignore: Add mmsg_name.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mmsg_name.test.
2016-07-19 17:46:33 +00:00
1c444a75d1 tests: check decoding of timeout argument of recvmmsg syscall
* tests/recvmmsg-timeout.c: New file.
* tests/recvmmsg-timeout.test: New test.
* tests/.gitignore: Add recvmmsg-timeout.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add recvmmsg-timeout.test.
2016-07-19 17:46:30 +00:00
3e3b7f6403 Fix printing of remaining timeout of recvmmsg syscall
* mmsghdr.c (SYS_FUNC(recvmmsg)): Do not print remaining timeout
when the 5th syscall argument is NULL.
* tests/mmsg.c (main): Update expected output.
2016-07-19 17:45:06 +00:00
aaf526ce32 tests: add recv_mmsg and send_mmsg functions to libtests
* tests/tests.h (recv_mmsg, send_mmsg): New prototype.
* tests/libmmsg.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/mmsg.c Do not check for __NR_sendmmsg, __NR_recvmmsg,
HAVE_SENDMMSG, and HAVE_RECVMMSG.  Do not include unused headers.
(recv_mmsg, send_mmsg): Remove.
2016-07-19 17:45:02 +00:00
736d8e4d3f tests: add socketcall function to libtests
* tests/tests.h (socketcall): New prototype.
* tests/libsocketcall.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-07-19 15:15:17 +00:00
8da9668b1b Use IOV_MAX instead of UIO_MAXIOV
IOV_MAX appears to be more portable than UIO_MAXIOV.

* msghdr.c: Include <limits.h>. Remove fallback defintion of UIO_MAXIOV.
(get_optmem_max): Replace UIO_MAXIOV with IOV_MAX.
* tests/msg_control.c: Likewise.
2016-07-18 22:12:45 +00:00
64a8a4ca3d tests: disable part of msg_name test on non-glibc systems
Sadly, musl recvmsg wrapper blindly dereferences 2nd argument,
so limit the affected part of the test to glibc that doesn't.

* tests/msg_name.c (test_msg_name) [!__GLIBC__]: Do not test
with inaccessible 2nd argument.
2016-07-14 09:37:09 +00:00
4ddbfcfb3c Print struct iovec as a regular structure
* io.c (print_iovec): Print names of iov_base and iov_len fields.
* tests/aio.c (main): Update expected output.
* tests/inet-cmsg.c (main): Likewise.
* tests/mmsg.c (main): Likewise.
* tests/msg_name.c (test_msg_name): Likewise.
* tests/preadv-pwritev.c (main): Likewise.
* tests/preadv2-pwritev2.c (main): Likewise.
* tests/preadv.c (main): Likewise.
* tests/pwritev.c (main): Likewise.
* tests/readv.c (main): Likewise.
* tests/recvmsg.c (main): Likewise.
* tests/vmsplice.c (main): Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/uio.expected: Likewise.
2016-07-13 23:45:20 +00:00
0b2cf813d7 tests: check decoding of msghdr.msg_name* arguments of recvmsg syscall
* tests/msg_name.c: New file.
* tests/msg_name.test: New test.
* tests/.gitignore: Add msg_name.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add msg_name.test.
2016-07-13 22:45:04 +00:00
7fa29bbf35 block.c: remove BLKDAXGET support
BLKDAXGET was removed by linux kernel commit v4.7-rc1~78^2^2~4.

* block.c: Do not define BLKDAXGET.
(block_ioctl): Remove BLKDAXGET support.
* tests/ioctl_block.c (main): Remove BLKDAXGET test.
2016-07-12 16:22:22 +00:00
416e880a91 tests: check decoding of sockaddr related arguments of recvfrom syscall
* configure.ac (AC_CHECK_FUNCS): Add recvfrom.
* tests/recvfrom.c: New file.
* tests/recvfrom.test: New test.
* tests/.gitignore: Add recvfrom.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add recvfrom.test.
2016-07-12 14:42:30 +00:00
891855edd9 tests: check decoding of accept4 syscall
* configure.ac (AC_CHECK_FUNCS): Add accept4.
* tests/accept4.c: New file.
* tests/accept4.test: New test.
* tests/.gitignore: Add accept4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add accept4.test.
2016-07-12 14:42:30 +00:00
fe811f7ed7 tests: check decoding of accept syscall
* tests/accept.c: New file.
* tests/accept.test: New test.
* tests/.gitignore: Add accept.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add accept.test.
2016-07-12 14:42:30 +00:00
524045c1ee tests: check decoding of getpeername syscall
* tests/getpeername.c: New file.
* tests/getpeername.test: New test.
* tests/.gitignore: Add getpeername.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getpeername.test.
2016-07-12 14:42:30 +00:00
587cba262e tests: check decoding of getsockname syscall
* tests/getsockname.c: New file.
* tests/getsockname.test: New test.
* tests/sockname.c: New file.
* tests/.gitignore: Add getsockname.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getsockname.test.
(EXTRA_DIST): Add sockname.c.
2016-07-12 14:42:29 +00:00
eca8b5b26a Print both values of changing address length in sockname family syscalls
* net.c (decode_sockname): Print both user and kernel address lengths
when the value changes.
* tests/net-y-unix.c (main): Update expected output.
* tests/net-yy-unix.c (main): Likewise.
* tests/net.expected: Likewise.
2016-07-12 10:54:25 +00:00
36df8223a1 Enhance diagnostics of address truncation in sockname family syscalls
* net.c (decode_sockname): Print both user and kernel address lengths
when the returned address is truncated.
* tests/sun_path.expected: Update expected output.
2016-07-12 07:40:31 +00:00
deb0c18871 netlink: handle multipart netlink messages
Handle multipart netlink messages made of multiple struct nlmsghdr
headers with associated payload in one byte stream.

* netlink.c (fetch_nlmsghdr, print_nlmsghdr,
decode_nlmsghdr_with_payload): New functions.
(decode_netlink): Use them.
* tests/netlink_parsing.c (send_query): Check them.
2016-07-08 16:01:49 +00:00
73362a23fd tests: extend netlink protocol check
* tests/netlink_protocol.c (send_query): Check that no part
of netlink message is fetched beyond the end of message.
Check decoding of zero address and zero length messages.
Check decoding of messages with nlmsg_len exceeding message length.
2016-07-07 10:01:25 +00:00
Fabien Siron
1b1baea407 tests: check decoding of netlink protocol
* tests/netlink_protocol.test: New test.
* tests/netlink_protocol.c: New file.
* tests/.gitignore: Add netlink_protocol.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add netlink_protocol.test.
2016-07-07 09:48:32 +00:00
bf2698a6b8 msghdr.c: limit output when printing excessively large messages
Limit output of struct msghdr.msg_control when
struct msghdr.msg_controllen is greater than the maximum ancillary
buffer size specified in /proc/sys/net/core/optmem_max file.

* configure.ac (AC_CHECK_FUNCS): Add open64.
* defs.h (read_int_from_file): New prototype.
* util.c (read_int_from_file): New function.
* msghdr.c (get_optmem_max): New function based on read_int_from_file.
(decode_msg_control): Use it to check control_len argument.
* tests/msg_control.c (test_big_len): New function.
(main): Use it to test printing of excessively large messages.
2016-07-03 22:15:45 +00:00
ea7002822f tests: add read_int_from_file function to libtests
* tests/overflowuid.c (read_int_from_file): New function.
(check_overflow_id): Use it.
* tests/tests.h (read_int_from_file): New prototype.
2016-07-03 22:15:38 +00:00
67135824fe msghdr.c: limit IP_RECVOPTS/IP_RETOPTS output in abbrev mode
* msghdr.c (print_cmsg_ip_opts): Do not print more than max_strlen
bytes of ip options in abbrev mode.
* tests/msg_control.c (print_ip_opts): Use DEFAULT_STRLEN.
(test_sol_ip): Test IP_RETOPTS output in abbrev mode.
2016-07-02 21:14:48 +00:00
d35d5ecc4d msghdr.c: limit SCM_RIGHTS output in abbrev mode
* msghdr.c (print_scm_rights): Do not print more than max_strlen
descriptors in abbrev mode.
* tests/msg_control.c (DEFAULT_STRLEN): New macro.
(print_fds): Use it.
(test_scm_rights3): New function.
(main): Use it to test SCM_RIGHTS output in abbrev mode.
* tests/msg_control-v.c: New file.
* tests/msg_control-v.test: New test.
* tests/.gitignore: Add msg_control-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add msg_control-v.test.
2016-07-02 21:14:26 +00:00