Commit Graph

942 Commits

Author SHA1 Message Date
2a897372db msghdr.c: fix representation of struct cmsghdr.cmsg_data integer arrays
* msghdr.c (print_cmsg_ip_opts): Print struct cmsghdr.cmsg_data
as an array of hexadecimal integers.
* tests/inet-cmsg.c (print_opts): Update expected output.
2016-06-30 22:10:31 +00:00
17e624cf96 msghdr.c: fix representation of integer struct cmsghdr.cmsg_data values
* msghdr.c (print_cmsg_ip_ttl, print_cmsg_ip_tos,
print_cmsg_ip_checksum): Print struct cmsghdr.cmsg_data value as an
array element.
* tests/inet-cmsg.c (print_ttl, print_tos): Update expected output.
2016-06-30 22:10:28 +00:00
08c0960ad5 msghdr.c: when printing struct struct cmsghdr.cmsg_data, also print its name
* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
print_cmsg_ip_checksum, print_cmsg_ip_opts, print_cmsg_ip_recverr,
print_cmsg_ip_origdstaddr): Print "cmsg_data=" before its contents.
* tests/inet-cmsg.c (print_pktinfo, print_ttl, print_tos, print_opts,
print_origdstaddr): Update expected output.
* tests/scm_rights-fd.test: Likewise.
2016-06-30 22:02:09 +00:00
a50ec34945 msghdr.c: print struct mmsghdr as a regular structure
* msghdr.c (decode_mmsghdr): Print names of msg_hdr and msg_len fields.
* tests/mmsg.c (main): Update expected output.
2016-06-27 00:14:34 +00:00
9a8216ea7b Mpersify fetchers of struct msghdr and struct mmsghdr
* fetch_struct_msghdr.c: New file.
* fetch_struct_mmsghdr.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* net.c (struct msghdr32, struct mmsghdr32, copy_from_msghdr32,
fetch_msghdr, fetch_mmsghdr): Remove.
(decode_msghdr, dumpiov_in_msghdr): Use fetch_struct_msghdr instead
of fetch_msghdr.
(decode_mmsghdr): Change msg_len argument to use_msg_len.
Use fetch_struct_mmsghdr instead of fetch_mmsghdr.
Return fetch_struct_mmsghdr's return code.
(decode_mmsg): Rename to decode_mmsgvec.  Take addr and len arguments.
Do not print vlen and flags.  Check decode_mmsghdr's return code.
Print mmsghdr array using square brackets.
(dumpiov_in_mmsghdr): Use fetch_struct_mmsghdr instead of fetch_mmsghdr.
(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Use decode_mmsgvec instead
of decode_mmsg.  Print vlen and flags.
* tests/mmsg.c (main): Update expected output.
2016-06-27 00:10:58 +00:00
4b38ce956c net.c: move fallback definition of struct mmsghdr to a separate file.
* msghdr.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* net.c: Include it.  Move fallback definition of struct mmsghdr there.
* tests/mmsg.c: Include "msghdr.h".  Remove fallback definition
of struct mmsghdr.
2016-06-27 00:10:08 +00:00
26f90afc68 net.c: print struct msghdr as a regular structure
* net.c (print_msghdr): Print msg_name, msg_namelen, msg_iov,
and msg_iovlen fields like other regular fields.
* tests/inet-cmsg.c (main): Update expected output.
* tests/mmsg.c (main): Likewise.
* tests/recvmsg.c (main): Likewise.
* tests/scm_rights-fd.test: Likewise.
2016-06-26 23:57:39 +00:00
00ba20aae1 net.c: when printing struct msghdr.msg_control, also print its name
* net.c (printcmsghdr): Skip control messages of zero length.
Always print "msg_control=" before the control message.
(do_msghdr): Print control message before its length, not after.
* tests/inet-cmsg.c (main): Update expected output.
* tests/scm_rights-fd.test: Likewise.
2016-06-26 23:57:18 +00:00
96b04dc71d tests: check decoding of sockaddr structures
* tests/net-sockaddr.c: New file.
* tests/net-sockaddr.test: New test.
* tests/.gitignore: Add net-sockaddr.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add net-sockaddr.test.
2016-06-25 01:11:18 +00:00
71e05be60a net.c: fix printing field names of struct sockaddr_nl
* net.c (print_sockaddr_data_nl): Change "pid" to "nl_pid", "groups"
to "nl_groups".  Print sockaddr_nl.nl_groups using %#08x format.
* tests/net-yy-netlink.c (main): Update.
2016-06-24 01:47:59 +00:00
f52753aad5 net.c: skip details of too short socket addresses
* net.c (print_sockaddr): Print socket address details only when
the address size is greater than sizeof(struct sockaddr.sa_family).
(print_sockaddr_data_un): Remove handling of addrlen == 2.
* tests/net-y-unix.c (main): Update expected pattern.
* tests/net-yy-unix.c (main): Likewise.
* tests/net.expected: Likewise.
2016-06-23 01:10:17 +00:00
b5f1fd926a Assume that libc provides inet_ntop and inet_pton
* configure.ac (AC_CHECK_FUNCS): Remove inet_ntop and inet_pton.
* net.c (sockaddr_buf_t, print_sockaddr, print_mreq6): Remove
HAVE_INET_NTOP checks.
* tests/ip_mreq.c: Remove HAVE_INET_PTON check.
2016-06-21 16:44:50 +00:00
e139cbe969 Consistently use AF_UNIX over AF_LOCAL
As these constants have the same value 1, let's use and print only one
of them, e.g. AF_UNIX.

* xlat/addrfams.in (AF_LOCAL): Remove.
* tests/net-accept-connect.c (main): Replace AF_LOCAL with AF_UNIX.
* tests/net-y-unix.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
2016-06-20 22:52:49 +00:00
d4bdff69fc btrfs: fix build with fresh linux/btrfs.h
Fix build with fresh <linux/btrfs.h> that provides a slightly different
definition of struct btrfs_ioctl_defrag_range_args.

* btrfs.c (btrfs_ioctl): Cast "len" member of
struct btrfs_ioctl_defrag_range_args to uint64_t.
* tests/btrfs.c (btrfs_print_defrag_range_args): Cast "start" and "len"
members of struct btrfs_ioctl_defrag_range_args to uint64_t.
2016-06-17 01:06:55 +00:00
fe7a451e5a btrfs: provide fallback definitions for BTRFS_IOC_QUOTA_RESCAN*
<linux/btrfs.h> was introduced in linux v3.9-rc1 while some
of btrfs ioctls were added later, e.g. BTRFS_IOC_QUOTA_RESCAN
and BTRFS_IOC_QUOTA_RESCAN_STATUS in v3.10-rc2,
or BTRFS_IOC_QUOTA_RESCAN_WAIT in v3.11-rc1.

* btrfs.c [!BTRFS_IOC_QUOTA_RESCAN]
(struct btrfs_ioctl_quota_rescan_args): New structure.
(BTRFS_IOC_QUOTA_RESCAN, BTRFS_IOC_QUOTA_RESCAN_STATUS): New macros.
[!BTRFS_IOC_QUOTA_RESCAN_WAIT] (BTRFS_IOC_QUOTA_RESCAN_WAIT): New macro.
* tests/btrfs.c: Likewise.

Reported-by: Li Er <phoooyb@gmail.com>
2016-06-17 01:06:55 +00:00
Fei Jie
3fd419f9cd tests: add signal_receive.test
* tests/signal_receive.c: New file.
* tests/signal_receive.test: New test.
* tests/.gitignore: Add signal_receive.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add signal_receive.test.
2016-06-16 12:39:56 +00:00
Fei Jie
0d8eaa9c01 tests: add signal2name function to libtests
* tests/tests.h (signal2name): New prototype.
* tests/signal2name.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-06-16 12:39:56 +00:00
21e3ff8d46 tests/attach-f-p.c: fix typo in comment 2016-06-14 16:11:09 +00:00
219dfda2a2 tests/ioctl_evdev.c: fix typo in comment 2016-06-14 15:48:32 +00:00
Elvira Khabirova
be06426625 tests/xgetrlimit.c: fix a warning reported by -Wtype-limits
* tests/xgetrlimit.c (sprint_rlim): Explicitly cast constants
to the type of argument.
2016-06-14 15:48:25 +00:00
484326dbd8 Consistently use printaddr for printing addresses
* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.

Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
2016-06-11 09:26:49 +00:00
87baaec12e tests/attach-p-cmd-p.c: cleanup
* attach-p-cmd-p.c (handler): Move code ...
(main): ... here.  Unblock SIGALRM only.
Use alarm() instead of setitimer().
Replace endless loop with a pause() call.
Check that chdir() returns ENOENT.
2016-06-10 14:34:32 +00:00
056e304d04 tests: enhance test coverage of SIGCHLD siginfo_t
* tests/siginfo.c: New file.
* tests/siginfo.test: New test.
* tests/wait.c: Remove.
* tests/wait.expected: Remove.
* tests/wait.test: Remove.
* tests/.gitignore: Add siginfo, remove wait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add siginfo.test, remove wait.test.
(EXTRA_DIST): Remove wait.expected.
2016-06-10 09:56:53 +00:00
176c568a6a tests: extend test coverage of waitid syscall
* tests/waitid.c: New file.
* tests/waitid-v.c: Likewise.
* tests/waitid.test: New test.
* tests/waitid-v.test: Likewise.
* tests/.gitignore: Add waitid and waitid-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add waitid.test and waitid-v.test.
2016-06-10 09:16:10 +00:00
1f68abfed3 tests: extend test coverage of wait4 syscall
* tests/wait4.c: New file.
* tests/wait4-v.c: Likewise.
* tests/wait4.test: New test.
* tests/wait4-v.test: Likewise.
* tests/.gitignore: Add wait4 and wait4-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add wait4.test and wait4-v.test.
2016-06-10 09:15:59 +00:00
af0d066dc2 tests: add widen_to_ull macro to tests.h
* tests.h (widen_to_ull): New macro, copied from defs.h
2016-06-10 09:14:20 +00:00
e9c1ee9c63 tests: check decoding of waitpid syscall
* tests/waitpid.c: New file.
* tests/waitpid.test: New test.
* tests/.gitignore: Add waitpid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add waitpid.test.
2016-06-09 01:29:45 +00:00
Fei Jie
ef9900e7c1 tests: add strace-E.test
* tests/strace-E.expected: New file.
* tests/strace-E.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
(EXTRA_DIST): Add strace-E.expected.
2016-06-09 01:28:33 +00:00
07d9cf589c tests: remove obsolete strace-f.test
strace-f.test is too inexact while fork-f.test does the right thing.

* tests/strace-f.test: Remove.
* tests/Makefile.am (MISC_TESTS): Remove it.
* strace.spec (BuildRequires): Remove time.
2016-06-07 18:16:26 +00:00
b1dbd9e291 tests: always distribute strace-k.test
Fix distribution of tests/strace-k.test file when configured
without libunwind.

* tests/Makefile.am (EXTRA_DIST): Add strace-k.test.
2016-06-07 09:32:17 +00:00
4e085d0b46 tests: check decoding of setrlimit, getrlimit, and ugetrlimit syscalls
* tests/getrlimit.c: New file.
* tests/setrlimit.c: Likewise.
* tests/ugetrlimit.c: Likewise.
* tests/xgetrlimit.c: Likewise.
* tests/getrlimit.test: New test.
* tests/setrlimit.test: Likewise.
* tests/ugetrlimit.test: Likewise.
* tests/.gitignore: Add getrlimit, setrlimit, and ugetrlimit.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getrlimit.test, setrlimit.test,
and ugetrlimit.test.
(EXTRA_DIST): Add xgetrlimit.c.
2016-06-06 22:06:46 +00:00
b017c09ab3 tests: check decoding of prlimit64 syscall
* tests/prlimit64.c: New file.
* tests/prlimit64.test: New test.
* tests/.gitignore: Add prlimit64.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add prlimit64.test.
2016-06-06 21:25:54 +00:00
Elvira Khabirova
f6be7ae12c tests/ptrace.c: fix fork() return value check
* tests/ptrace.c (test_peeksiginfo): Explicitly cast fork() return value
to pid_t.
2016-06-06 18:07:04 +00:00
f56323f1cc tests/strace-S.test: fix testing 64-bit strace using a 32-bit userspace
* tests/strace-S.test: Measure wall clock time instead of system time.
Use local "./readv" instead of system "date" as a sample executable.

Reported-by: Steve McIntyre <steve@einval.com>
2016-06-06 18:07:04 +00:00
53128b6746 tests/strace-S.test: enhance error diagnostics
* tests/strace-S.test: If strace output does not meet expectations,
print the output.
2016-06-06 18:07:04 +00:00
124c17ad3c tests/ioctl_evdev.c: check EVIOCGUNIQ decoding
* tests/ioctl_evdev.c (main): Check EVIOCGUNIQ(0) decoding.
2016-05-28 22:13:27 +00:00
bd090efc40 tests/ioctl_mtd.c: fix build with musl
* tests/ioctl_mtd.c: Include <linux/ioctl.h>.
2016-05-28 19:55:01 +00:00
129b304c95 tests: check decoding of 'M' type ioctls
* tests/ioctl_mtd.c: New file.
* tests/ioctl_mtd.test: New test.
* tests/.gitignore: Add ioctl_mtd.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_mtd.test.
2016-05-28 19:31:50 +00:00
fc0a38612f tests: check decoding of EVIOC* ioctls
* tests/ioctl_evdev.c: New file.
* tests/ioctl_evdev-v.c: Likewise.
* tests/ioctl_evdev.test: New test.
* tests/ioctl_evdev-v.test: Likewise.
* tests/.gitignore: Add ioctl_evdev and ioctl_evdev-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_evdev.test and ioctl_evdev-v.test.
2016-05-28 00:56:47 +00:00
Jeff Mahoney
eb36e38523 file_ioctl.c: print first two extents for FIDEDUPERANGE in abbrev mode
* file_ioctl.c (file_ioctl, print_file_dedupe_range_info): Print first
two elements of info array in abbrev mode.
* tests/btrfs.c (btrfs_test_extent_same_ioctl): Handle newly
printed elements.
2016-05-28 00:37:02 +00:00
Jeff Mahoney
826b7978ec tests: check decoding of btrfs RDWR ioctls returned data
* tests/btrfs-vw.test: New file.
* tests/btrfs-w.test: New file.
* tests/Makefile.am (DECODER_TESTS): Add them.
2016-05-27 08:54:32 +00:00
Jeff Mahoney
fd70b501f6 tests/btrfs.c: fix live btrfs_test_search_ioctls output
* tests/btrfs.c (btrfs_test_search_ioctls): Use print_tree_search_buf
for BTRFS_IOC_TREE_SEARCH and fix missing whitespace.
2016-05-27 08:54:18 +00:00
Jeff Mahoney
563a758994 tests/btrfs.c: fix btrfs-v for BTRFS_IOC_TREE_SEARCH
* tests/btrfs.c (btrfs_test_send_ioctl): Assign key_reference
to search_args for BTRFS_IOC_TREE_SEARCH ioctl tests.
2016-05-26 20:54:46 +00:00
59b140a096 tests/ioctl_block.c: tweak magic constants to make the test more reliable
* tests/ioctl_block.c (main): Change bad pointer to make
its lower 32-bit part closer to -1U.
2016-05-26 15:16:31 +00:00
b356ad8abf tests/btrfs.c: check basic decoding of read-only ioctls
* tests/btrfs.c (btrfs_test_read_ioctls): New function.
(main): Use it.
2016-05-26 14:46:37 +00:00
799b22a27d tests: check decoding of BLK* ioctls
* configure.ac (AC_CHECK_TYPES): Add struct blk_user_trace_setup.
* tests/ioctl_block.c: New file.
* tests/ioctl_block.test: New test.
* tests/.gitignore: Add ioctl_block.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_block.test.
2016-05-26 14:44:13 +00:00
ba35137246 tests: check decoding of RTC_* ioctls
* configure.ac (AC_CHECK_FUNCS): Add ioctl_rtc.
* tests/ioctl_rtc.c: New file.
* tests/ioctl_rtc-v.c: Likewise.
* tests/ioctl_rtc.test: New test.
* tests/ioctl_rtc-v.test: Likewise.
* tests/.gitignore: Add ioctl_rtc and ioctl_rtc-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_rtc.test and ioctl_rtc-v.test.
2016-05-25 17:58:57 +00:00
f8da0f3e78 tests: check decoding of mount syscall
* tests/mount.c: New file.
* tests/mount.test: New test.
* tests/.gitignore: Add mount.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mount.
2016-05-25 00:11:37 +00:00
1ba55355c6 tests/vhangup.c: diassociate from the controlling terminal first
* tests/vhangup.c (main): Call setsid before vhangup.
2016-05-24 20:12:25 +00:00
Fei Jie
a41d9f5621 tests: add vhangup.test
* tests/vhangup.c: New file.
* tests/vhangup.test: New test.
* tests/.gitignore: Add vhangup.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add vhangup.test.
2016-05-24 20:09:16 +00:00
Gleb Fotengauer-Malinovskiy
e79f038dd9 tests/btrfs.c: fix build on x32
* tests/btrfs.c (btrfs_test_ino_path_ioctls): Fix printing of st_ino.
2016-05-24 15:10:41 +00:00
6697d15f0a tests/btrfs.c: fix build with u64 based BTRFS_IOC_DEFAULT_SUBVOL
* tests/btrfs.c: Fix build on systems where BTRFS_IOC_DEFAULT_SUBVOL
is defined using unexported type "u64".
2016-05-24 14:52:27 +00:00
ea516df85e btrfs.c: fix build on systems without BTRFS_IOC_FILE_EXTENT_SAME
* btrfs.c (btrfs_ioctl): Skip BTRFS_IOC_FILE_EXTENT_SAME case
if this constant is not defined.
* tests/btrfs.c (btrfs_test_extent_same_ioctl): Skip this part
of the test if BTRFS_IOC_FILE_EXTENT_SAME is not defined.
2016-05-24 14:52:27 +00:00
3f36611e98 tests/btrfs.c: fix printing struct btrfs_ioctl_clone_range_args
* tests/btrfs.c (btrfs_test_clone_ioctls): Print __u64 members
of struct btrfs_ioctl_clone_range_args using PRI__u64 format.
2016-05-24 14:52:27 +00:00
57888fa5f9 tests/btrfs.c: tweak magic constants to make the test more reliable
* tests/btrfs.c (btrfs_test_sync_ioctls): Change u64val
to 0xdeadbeefbadc0ded.
(btrfs_test_subvol_ioctls): Likewise.  Change bad_pointer
to make their lower 32-bit parts closer to -1U.
2016-05-24 14:52:27 +00:00
6ce6d3be10 btrfs.c: print file descriptors using printfd
* btrfs.c (btrfs_ioctl): Print struct btrfs_ioctl_send_args.send_fd,
struct btrfs_ioctl_vol_args.fd, and struct btrfs_ioctl_vol_args_v2.fd
using printfd.
* tests/btrfs.c (btrfs_print_vol_args_v2, btrfs_test_subvol_ioctls,
btrfs_test_device_ioctls, btrfs_test_clone_ioctls,
btrfs_test_send_ioctl): Update.
2016-05-24 14:52:27 +00:00
9298c66dc0 tests/btrfs.c: do not print errno in case of fs type mismatch
* tests/btrfs.c (main): Use error_msg_and_fail instead of
perror_msg_and_fail when the fs type of the given directory
is not BTRFS_SUPER_MAGIC.
2016-05-24 14:52:27 +00:00
2447de4ca1 tests/btrfs.c: fix indentation
* tests/btrfs.c: Fix indentation of preprocessor directives
and function prototypes.
2016-05-24 14:52:27 +00:00
28a5f66e2e tests/btrfs.c: sort included headers
* tests/btrfs.c: Sort included headers.
2016-05-24 14:52:27 +00:00
45fcc0c853 tests/btrfs.c: do not use alloca
* tests/btrfs.c: Don't include <alloca.h>.
(btrfs_test_subvol_ioctls): Allocate
struct btrfs_ioctl_vol_args_v2.qgroup_inherit using tail_alloc.
2016-05-24 14:52:27 +00:00
2212918aa2 tests/btrfs.c: fix build on systems without <linux/btrfs.h> or <linux/fiemap.h>
* tests/btrfs.c: Include "tests.h" first.
Skip the test if [!HAVE_LINUX_BTRFS_H].  Skip parts of the test
that use struct fiemap if [!HAVE_LINUX_FIEMAP_H].
2016-05-24 14:52:27 +00:00
Jeff Mahoney
3586679f7a tests: add testing for btrfs ioctls
* tests/btrfs.c: New file.
* tests/btrfs.test: New test.
* tests/btrfs-v.test: Likewise.
* tests/.gitignore: Add btrfs.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add btrfs.test and btrfs-v.test.
2016-05-24 14:52:27 +00:00
aab00c2023 tests/file_ioctl.c: use tail_alloc
* tests/file_ioctl.c (main): Allocate struct fiemap using tail_alloc.
2016-05-24 14:52:27 +00:00
3b730d4a0f tests/file_ioctl.c: fix build on systems without <linux/fiemap.h>
* tests/file_ioctl.c: Include "tests.h" first.
Skip the test if [!HAVE_LINUX_FIEMAP_H].
2016-05-24 14:52:27 +00:00
Jeff Mahoney
c05c24cc51 tests: add testing for FS_IOC_FIEMAP
This is limited to FIEMAP.  FICLONE* and FIDEDUPERANGE originated in
btrfs and will be tested there.

* tests/file_ioctl.c: New file.
* tests/file_ioctl.test: New test.
* tests/.gitignore: Add file_ioctl.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add file_ioctl.test.
2016-05-24 14:52:27 +00:00
9b49af1871 tests/attach-f-p.c: sleep a bit more to let the tracer catch up
On noticeably lagging systems, the parent process may invoke its chdir
call before the tracer gets notified about completion of its last child
process.  Add extra sleep in the parent process to win the race.

* tests/attach-f-p.c (main): Change timerid into a static array.
Arm a timer in the parent process and wait for it.
2016-05-24 12:14:33 +00:00
475d2b5da6 tests/attach-p-cmd-cmd.c: fix potential errno clobbering
* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.
2016-05-23 16:39:23 +00:00
4ea65fb549 tests/net-yy-netlink.c: robustify against libc specific issues
* tests/net-yy-netlink.c (main): Use getsockname instead of recvmsg
as the latter has notible implementation differences that make
the test unreliable.
2016-05-23 10:26:46 +00:00
29df0351a9 tests/net-yy-netlink.c: robustify against os specific issues
* tests/net-yy-netlink.c (main): Pass a pointer to a real struct msghdr
as NULL doesn't work well on some systems.
2016-05-23 10:26:46 +00:00
1e9dabee66 tests/net-yy-{inet,netlink}.test: cleanup
* tests/net-yy-inet.test: Do not pass arguments to net-yy-inet
as the latter does not accept them.
* tests/net-yy-netlink.test: Do not pass arguments to net-yy-netlink
as the latter does not accept them.
2016-05-23 10:14:39 +00:00
Jeff Mahoney
f21a2f4119 tests: define PRI__[dux]64 macros to print __s64 and __u64 values
Rather than cast every __u64 or __s64 before printing,
define printing helpers for those types directly.

This complements commit 1f3482beda.

* tests/tests.h (PRI__d64, PRI__u64, PRI__x64): New macros.
2016-05-22 22:54:23 +00:00
62a35fa572 tests: remove manual creation of memory mapping holes
We used to call tail_alloc(1) to create memory mapping holes around
regular tail_alloc allocations.  This is no longer needed since regular
tail_alloc allocations create additional memory mapping holes.

* tests/clock_adjtime.c (main): Remove creation of memory mapping holes
using tail_alloc(1).
* tests/futimesat.c (main): Likewise.
* tests/get_mempolicy.c (print_nodes, main): Likewise.
* tests/getgroups.c (main): Likewise.
* tests/getresugid.c (main): Likewise.
* tests/ioctl_uffdio.c (main): Likewise.
* tests/ioctl_v4l2.c (main): Likewise.
* tests/move_pages.c (main): Likewise.
* tests/net-icmp_filter.c (main): Likewise.
* tests/ptrace.c (test_peeksiginfo, main): Likewise.
* tests/pwritev.c (main): Likewise.
* tests/set_mempolicy.c (print_nodes): Likewise.
* tests/setgroups.c (main): Likewise.
* tests/umovestr3.c (main): Likewise.
* tests/utimes.c (main): Likewise.
* tests/xattr.c (main): Likewise.
2016-05-22 22:29:33 +00:00
0f303f99c6 tests: make tail_alloc create additional memory mapping holes
* tests/tail_alloc.c (tail_alloc): Create additional memory mapping
holes before and after the allocated memory.
2016-05-22 22:21:48 +00:00
7b6979701b Fix one more code pattern that might break gcc strict aliasing rules
* socketutils.c (receive_responses): Turn static buffer into a union
to avoid breaking of gcc strict aliasing rules.
* tests/netlink_inet_diag.c (check_responses): Likewise.
* tests/netlink_netlink_diag.c (check_responses): Likewise.
* tests/netlink_unix_diag.c (check_responses): Likewise.
2016-05-21 09:33:12 +00:00
Fabien Siron
28e955d747 tests: add check for netlink protocol decoding with -yy option
* tests/netlink_netlink_diag.c: New file.
* tests/net-yy-netlink.c: New file.
* tests/net-yy-netlink.test: New test.
* tests/.gitignore: Add net-yy-netlink and netlink_netlink_diag
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add net-yy-netlink.test.
2016-05-21 09:32:52 +00:00
ff2b853e7f tests/pread64-pwrite64.c: robustify against os specific issues
Do not assume that pwrite64 syscall fails when only part of the
specified memory buffer is accessible.  With some kernels, one
accessible byte at the end of page is enough for pwrite64 syscall
to return 1.

* tests/pread64-pwrite64.c (main): Tweak the test that can lead
to a partial write.
2016-05-18 09:26:01 +00:00
a8e820586e tests/read-write.c: robustify against os specific issues
Do not assume that write syscall fails when only part of the specified
memory buffer is accessible.  With some kernels, one accessible byte
at the end of page is enough for write syscall to return 1.

* tests/read-write.c (main): Tweak the test that can lead to a partial
write.
2016-05-18 09:26:01 +00:00
af09d4f4fa umovestr3.test: extend test coverage
* tests/umovestr3.c: Include <sys/param.h>.
(main): Test with each number between PATH_MAX-1 and 0.
2016-05-18 09:26:01 +00:00
81f1b1689a tests/timer_create.c: robustify against os specific issues
* tests/timer_create.c (main): Do not assume any specific error code
returned by timer_create, print whatever it is.
2016-05-18 09:26:01 +00:00
e0ba92016b Fix some compilation warnings on older systems
* print_statfs.c (print_statfs_flags): Define only
for [HAVE_STRUCT_STATFS_F_FLAGS || HAVE_STRUCT_STATFS64_F_FLAGS].
* tests/inet-cmsg.c (print_origdstaddr): Define only
for [IP_ORIGDSTADDR].
2016-05-18 09:26:01 +00:00
Fei Jie
854a25930c tests: add brk.test
* tests/brk.c: New file.
* tests/brk.test: New test.
* tests/.gitignore: Add brk.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add brk.test.
2016-05-17 10:53:03 +00:00
c5f6863a18 Fix printing of invalid arguments of prctl syscall
* prctl.c (SYS_FUNC(prctl)): Print 2nd syscall argument
of PR_CAPBSET_DROP, PR_CAPBSET_READ, PR_CAP_AMBIENT, PR_MCE_KILL,
and PR_SET_SECCOMP using printxval_long.
Print 2nd syscall argument of PR_SET_SECUREBITS using printflags_long.
Print 3rd syscall argument of PR_CAP_AMBIENT and PR_MCE_KILL using
printxval_long.
* tests/prctl-seccomp-strict.c (main): Update.
2016-05-16 23:50:59 +00:00
3a0fa5c619 Fix printing of invalid mode argument of mbind syscall
* numa.c (SYS_FUNC(mbind)): Print 3rd argument of syscall
using printxval_long.
* tests/mbind.c (main): Update.
2016-05-16 23:48:05 +00:00
1168114879 Fix printing of invalid arguments of memory mapping related syscalls
* mem.c (print_mmap): Print 3rd and 4th arguments of syscall
using printflags_long.
(SYS_FUNC(mprotect)): Print 3rd argument of syscall using
printflags_long.
(SYS_FUNC(mremap)): Print 4th argument of syscall using printflags_long.
(SYS_FUNC(remap_file_pages)): Print 3rd and 4th arguments of syscall
using printflags_long.
* tests/remap_file_pages.c (main): Update.
2016-05-16 23:47:34 +00:00
55044d9670 Fix decoding of epoll_ctl operation argument
Consistently treat operation argument of epoll_ctl syscall as int
to match the kernel behaviour.

* epoll.c (SYS_FUNC(epoll_ctl)): Assign 2nd argument of syscall
to a variable of type unsigned int and use it in all subsequent
checks and lookups.
* tests/epoll_ctl.c (invoke_syscall): New function.
(main): Use it.
2016-05-16 21:47:09 +00:00
77086594ce Fix decoding of fcntl/fcntl64 operation argument
Consistently treat operation argument of fcntl/fcntl64 syscalls as int
to match the kernel behaviour.

* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Assign
2nd argument of syscall to a variable of type unsigned int
and use it in all subsequent checks and lookups.
* tests/struct_flock.c (invoke_test_syscall): New function.
(test_flock_einval, test_flock): Use it.
* tests/fcntl.c (test_flock64_einval): Use it.
* tests/fcntl64.c (test_flock64_einval, test_flock64): Use it.
2016-05-16 21:46:48 +00:00
602998be62 tests/ptrace.c: tweak magic constants to make the test more reliable
* tests/ptrace.c (main): Change bad_request and bad_data to make they
lower 32-bit parts closer to -1U.
2016-05-13 09:37:10 +00:00
98f632a14c tests/ioctl_v4l2.c: fix build on older systems
Fix build on systems without HAVE_DECL_V4L2_CTRL_TYPE_STRING or
V4L2_CTRL_CLASS_CAMERA.

* tests/ioctl_v4l2.c (main) [VIDIOC_S_EXT_CTRLS]: Disable part of the
test if [!HAVE_DECL_V4L2_CTRL_TYPE_STRING].
Replace V4L2_CTRL_CLASS_CAMERA with V4L2_CTRL_CLASS_USER.
2016-05-13 05:18:42 +00:00
f2f162e89c Do not use htole32 function
htole32 function is not portable enough.

* v4l2.c (print_pixelformat): Rewrite initialization of pixel format
union without using of htole32.
* tests/ioctl_v4l2.c (main): Likewise.
2016-05-13 05:18:42 +00:00
09de43b39d tests/ioctl_v4l2.c: fix typo
* tests/ioctl_v4l2.c (main)
[!HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE]: Fix typo in expected
output string.
2016-05-13 05:18:42 +00:00
632efff900 tests: check decoding of ptrace syscall
* tests/ptrace.c: New file.
* tests/ptrace.test: New test.
* tests/.gitignore: Add ptrace.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ptrace.
2016-05-13 05:18:41 +00:00
Fei Jie
01d16ccb96 tests: add munlockall.test
* tests/munlockall.c: New file.
* tests/munlockall.test: New test.
* tests/.gitignore: Add munlockall.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add munlockall.test.
2016-05-11 12:26:00 +00:00
Fei Jie
0684c35c25 tests: add link.test
* tests/link.c: New file.
* tests/link.test: New test.
* tests/.gitignore: Add link.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add link.test.
2016-05-11 12:26:00 +00:00
d81b58f650 tests: check decoding and dumping of preadv2 and pwritev2 syscalls
* tests/preadv2-pwritev2.c: New file.
* tests/preadv2-pwritev2.test: New test.
* tests/.gitignore: Add preadv2-pwritev2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add preadv2-pwritev2.
2016-05-11 01:54:12 +00:00
ea7b9dbcbd tests: extend test coverage of xattr family syscalls
* tests/xattr.c: Check decoding of all xattr family syscalls.
* tests/xattr.test: Use run_strace_match_diff.
* tests/xattr.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.
2016-05-10 22:25:23 +00:00
72cb81151f tests: add print_quoted_memory function to libtests
* tests/print_quoted_string.c (print_quoted_memory): New function.
(print_quoted_string): Use it.
* tests/tests.h (print_quoted_memory): New prototype.
2016-05-10 22:12:01 +00:00
Dr. David Alan Gilbert
0efd888e22 userfaultfd: Add ioctl tests
* tests/ioctl_uffdio.c: New file.
* tests/ioctl_uffdio.test: New test.
* tests/.gitignore: Add ioctl_uffdio.
* tests/Makefile.am (check_PROGRAMS):  Likewise.
(DECODER_TESTS): Add ioctl_uffdio.test.
2016-05-10 11:00:12 +00:00
26b2cfeb6b strace-ff.test: fix race condition
* tests/strace-ff.test: Wait for completion of PR_SET_PTRACER command.
2016-05-10 09:51:04 +00:00
d12c44bcac tests/epoll_pwait.c: fix for x32
* tests/epoll_pwait.c (main): Explicitly cast last syscall argument
to kernel_ulong_t.
2016-05-10 01:37:46 +00:00
a44c5184f9 strace-S.test: check "-S name"
* tests/strace-S.test: Add a check for "-c -S name" output.
2016-05-10 00:39:17 +00:00
804bb8797b strace-S.test: cleanup
* tests/strace-S.test: Rewrite using sed.
2016-05-10 00:38:52 +00:00
Fei Jie
6781111857 tests: add strace-S.test
* tests/strace-S.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-05-09 23:33:32 +00:00
58ab8b49e0 strace-ff.test: check that -ff does not create unexpected output files
* tests/strace-ff.expected: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/strace-ff.test: Use it.  Check that no other output files
have been created.
2016-05-09 23:21:30 +00:00
Fei Jie
c259f4fd5d tests: add strace-ff.test
* tests/strace-ff.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-05-09 23:21:20 +00:00
a30d02e902 strace-V.test: cleanup
* tests/strace-V.test: Move config.h parser to a function.
Rename $OUT to $EXP, swap arguments passed to match_diff.
2016-05-09 23:19:37 +00:00
Fei Jie
c4bb57745a tests: add strace-V.test
* tests/strace-V.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2016-05-09 23:18:40 +00:00
e3086cbc4d tests: check decoding of epoll_pwait syscall
* tests/epoll_pwait.c: New file.
* tests/epoll_pwait.test: New test.
* tests/.gitignore: Add epoll_pwait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add epoll_pwait.test.
2016-05-09 22:12:57 +00:00
6d44012cb5 Assume that sys/epoll.h exists
This header file was added in glibc-2.3.2,
so it's safe to assume its availability.

* configure.ac (AC_CHECK_HEADERS): Remove sys/epoll.h.
* epoll.c: Include <sys/epoll.h> unconditionally.
Compile [HAVE_SYS_EPOLL_H] code unconditionally.
* tests/epoll_ctl.c: Do not check for HAVE_SYS_EPOLL_H.
* tests/epoll_wait.c: Likewise.
2016-05-09 21:46:17 +00:00
b6d4b1167b tests: relax timings
Allow nanosleep(2) to spend 10% more time to make the test suite
more reliable on slow systems.

* tests/count.test: Treat 1.1 seconds as valid output.
* tests/strace-T.expected: Likewise.
* tests/strace-r.expected: Likewise.
2016-05-08 00:00:18 +00:00
88fc4c23d4 tests/attach-f-p.c: increase timeouts
Increase timeouts to make the test more reliable on slow systems.

* tests/attach-f-p.c (its): Increase timeouts to 1, 2, and 3 seconds,
respectively.
2016-05-07 23:51:47 +00:00
f82dcd980d seccomp.c: use print_array function
* seccomp.c (decode_filter, decode_seccomp_fprog): Remove.
(print_bpf_filter): New function.
(print_seccomp_fprog): Use it via print_array.
* tests/seccomp-filter-v.c (main): Update.
2016-05-07 23:37:53 +00:00
fd2d6a7f52 poll.c: use print_array function
* poll.c (print_pollfd): Change for use as print_array callback.
(decode_poll_entering): Use print_array.
* tests/poll.c: Update.
* tests/poll.test: Update.
2016-05-07 23:37:53 +00:00
636b8c161c numa.c: use print_array function
* numa.c (print_node): New function.
(print_nodemask): Use it via print_array.
(print_page_array, print_int_array): Remove.
(print_addr): New function.
(print_status, print_int): Change for use as print_array callback.
(SYS_FUNC(move_pages)): Use print_addr, print_int, and print_status
via print_array.
* tests/move_pages.c: Update.
* tests/set_mempolicy.c: Likewise.
* tests/set_mempolicy.test: Likewise.
2016-05-07 23:37:52 +00:00
4ce3054340 io.c: use print_array function
* io.c (print_iovec_config): New structure.
(print_iovec): New function.
(tprint_iov_upto): Use print_array.
* tests/preadv.c (main): Update.
* tests/pwritev.c (print_iovec, main): Likewise.
2016-05-07 23:32:29 +00:00
2868e2b941 aio.c: use print_array function
* aio.c (print_iocbp): New function.
(SYS_FUNC(io_submit)): Use it via print_array.  Use widen_to_long
to process long int argument.
(print_io_event): Change to print struct io_event fetched elsewhere.
(SYS_FUNC(io_cancel)): Update use of print_io_event.
(SYS_FUNC(io_getevents)): Use print_io_event via print_array.
Use widen_to_long to print long int arguments.
* tests/aio.c (main): Check decoding of io_submit with negative "nr".
2016-05-07 22:40:06 +00:00
eb5c233d99 Fix corner cases of ICMP_FILTER decoding
* net.c (print_icmp_filter): Print icmp_filter for any positive length.
* tests/net-icmp_filter.c: New file.
* tests/net-icmp_filter.test: New test.
* tests/.gitignore: Add net-icmp_filter.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add net-icmp_filter.test.
2016-05-06 00:22:52 +00:00
1d17ac7c32 xlat: do not strip "1<<" prefix from xlat strings
* xlat/gen.sh (cond_xlat, gen_header): Do not strip "1<<" prefix
from xlat strings to fix incorrect output.
* tests/caps.awk: Update.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2016-05-05 22:20:40 +00:00
dcb18a6fd5 tests/xstatfsx.c: fix mips o32 support
mips o32 differs from all other 32-bit architectures by defining
__kernel_fsid_t structure as an array of long ints.

* tests/xstatfsx.c (print_statfs): Explicitly cast elements
of PRINT_F_FSID array to unsigned int.
2016-05-05 21:20:58 +00:00
1e56814f77 Mpersify VIDIOC_* ioctl parser
* v4l2.c: Mpersify arch-specific structures.
(v4l2_ioctl): Mpersify.
* tests/ioctl_v4l2.c: New file.
* tests/ioctl_v4l2.test: New test.
* tests/.gitignore: Add ioctl_v4l2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_v4l2.test.
2016-05-05 21:20:56 +00:00
0a47ff79ca Fix decoding of VIDIOC_* ioctls
* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
* tests/ioctl.c (main): Update.
2016-05-05 21:20:45 +00:00
6331fd4b32 nsyscalls.test: add mips o32 support
Out-of-range syscalls looks differently on mips o32.

* tests/nsyscalls.c (main): Handle LINUX_MIPSO32.
* tests/nsyscalls.test: Trace syscall called "syscall" on mips.
2016-05-05 18:04:33 +00:00
e212a15955 Fix decoding of move_pages syscall
* numa.c (print_page_array, print_status, print_int, print_int_array):
New functions.
(SYS_FUNC(move_pages)): Rewrite using these functions.
* tests/move_pages.c: New file.
* tests/move_pages.test: New test.
* tests/.gitignore: Add move_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add move_pages.test.
2016-04-29 18:21:02 +00:00
900a282d36 tests: check decoding of mbind syscall
* tests/mbind.c: New file.
* tests/mbind.test: New test.
* tests/.gitignore: Add mbind.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mbind.test.
2016-04-29 18:21:01 +00:00
909e664a2e tests/remap_file_pages.c: fix for the upcoming change of xlat.val type
The "flags" argument of remap_file_page syscall has type "unsigned
long", so it is not correct to load most significant bits with garbage
ans assume they are going to be ignored.

* tests/remap_file_pages.c (main): Remove artificial garbage from flags.
2016-04-28 21:14:54 +00:00
38ed916d1b tests: check decoding of migrate_pages syscall
* tests/migrate_pages.c: New file.
* tests/migrate_pages.test: New test.
* tests/.gitignore: Add migrate_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add migrate_pages.test.
2016-04-28 01:20:19 +00:00
d10a95548c tests: check decoding of set_mempolicy syscall
* tests/set_mempolicy.c: New file.
* tests/set_mempolicy.test: New test.
* tests/.gitignore: Add set_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add set_mempolicy.test.
2016-04-28 01:17:39 +00:00
aa1ed760c8 tests: check decoding of get_mempolicy syscall
* tests/get_mempolicy.c: New file.
* tests/get_mempolicy.test: New test.
* tests/.gitignore: Add get_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add get_mempolicy.test.
2016-04-28 01:17:39 +00:00
a182d8c6c1 tests: add printxval function to libtests
* tests/tests.h (printxval): New prototype.
* tests/printxval.c: New file.
* tests/Makefile.am  (libtests_a_SOURCES): Add it.
2016-04-27 20:31:34 +00:00
d6c76f3a37 tests: check decoding of remap_file_pages syscall
* tests/remap_file_pages.c: New file.
* tests/remap_file_pages.test: New test.
* tests/.gitignore: Add remap_file_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add remap_file_pages.test.
2016-04-27 16:04:01 +00:00
Fei Jie
649ee4b370 tests: add pause.test
* tests/pause.c: New file.
* tests/pause.test: New test.
* tests/.gitignore: Add pause.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pause.test.
2016-04-27 14:22:22 +00:00
Fei Jie
7585ccdcab tests: add kill.test
* tests/kill.c: New file.
* tests/kill.test: New test.
* tests/.gitignore: Add kill.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add kill.test.
2016-04-27 14:22:02 +00:00
Fei Jie
b45a1e78e3 tests: add mlock.test
* tests/mlock.c: New file.
* tests/mlock.test: New test.
* tests/.gitignore: Add mlock.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mlock.test.
2016-04-27 11:11:12 +00:00
db34e195bb tests/umovestr3.c: robustify against os specific issues
* tests/umovestr3.c (main): Create extra gap before unreadable page.
2016-04-27 03:18:44 +00:00
12890ffda1 tests: extend test coverage of umovestr short read condition
* tests/umovestr3.c: New file.
* tests/umovestr3.test: New test.
* tests/.gitignore: Add umovestr3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add umovestr3.test.
2016-04-27 01:32:21 +00:00
1c61f829e4 tests: check decoding of out-of-range syscalls
* tests/nsyscalls.c: New file.
* tests/nsyscalls.test: New test.
* tests/.gitignore: Add nsyscalls.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add nsyscalls.test.
2016-04-27 01:32:20 +00:00
f443fd40cb Fix decoding of 3rd argument of getdents/getdents64 syscalls
* dirent.c (SYS_FUNC(getdents)): Always print 3rd syscall argument
as unsigned int.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* tests/getdents.c (main): Check it.
* tests/getdents64.c (main): Likewise.
2016-04-26 22:38:10 +00:00
f41eaebddf tests: check decoding of renameat2 syscall
* tests/renameat2.c: New file.
* tests/renameat2.test: New test.
* tests/.gitignore: Add renameat2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add renameat2.test.
2016-04-26 16:30:43 +00:00
33fc2e4757 tests: check decoding of utimes syscall
* tests/utimes.c: New file.
* tests/utimes.test: New test.
* tests/.gitignore: Add utimes.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add utimes.test.
2016-04-26 16:13:17 +00:00
4e9269aebc tests: check decoding of futimesat syscall
* tests/futimesat.c: New file.
* tests/futimesat.test: New test.
* tests/.gitignore: Add futimesat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add futimesat.test.
2016-04-26 16:13:15 +00:00
7dad3f3edd tests: extend test coverage of mknod syscall
* mknod.c (main): Check more corner cases of mode_t parser.
* mknod.test: Update.
2016-04-26 11:00:51 +00:00
Fei Jie
68b1d24e59 tests: add sched_yield.test
* tests/sched_yield.c: New file.
* tests/sched_yield.test: New test.
* tests/.gitignore: Add sched_yield.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add sched_yield.test.
2016-04-26 10:31:11 +00:00
Fei Jie
86ff93e527 tests: add sync.test
* tests/sync.c: New file.
* tests/sync.test: New test.
* tests/.gitignore: Add sync.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add sync.test.
2016-04-26 10:29:58 +00:00
Fei Jie
63be9e318c tests: add mknodat.test
* tests/mknodat.c: New file.
* tests/mknodat.test: New test.
* tests/.gitignore: Add mknodat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mknodat.test.
2016-04-26 10:11:41 +00:00
Fei Jie
363b71d281 tests: add unlink.test
* tests/unlink.c: New file.
* tests/unlink.test: New test.
* tests/.gitignore: Add unlink.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add unlink.test.
2016-04-26 10:11:41 +00:00
Fei Jie
68d171d133 tests: add reboot.test
* tests/reboot.c: New file.
* tests/reboot.test: New test.
* tests/.gitignore: Add reboot.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add reboot.test.
2016-04-26 10:11:41 +00:00
67c2f67410 Fix decoding of statfs family syscalls
Fix decoders of fstatfs, fstatfs64, statfs, and statfs64 syscalls
by rewriting them using mpers infrastructure.

* fetch_struct_statfs.c: New file.
* fstatfs.c: Likewise.
* fstatfs64.c: Likewise.
* print_statfs.c: Likewise.
* statfs.h: Likewise.
* statfs64.c: Likewise.
* statfs.c: Remove everything except SYS_FUNC(statfs).
* configure.ac: Remove the check for struct statfs64 in <sys/vfs.h>.
Add checks for struct statfs and struct statfs64 in <asm/statfs.h>.
Add checks for f_frsize and f_flags members of these structures.
* defs.h (struct strace_statfs): New forward declaration.
(print_struct_statfs, print_struct_statfs64): New prototypes.
* Makefile.am (libstrace_a_SOURCES): Add fstatfs.c, fstatfs64.c,
statfs.c, and statfs64.c.
(strace_SOURCES): Add fetch_struct_statfs.c, print_statfs.c,
and statfs.h.
* NEWS: Mention this fix.
* tests/fstatfs.c: New file.
* tests/fstatfs64.c: Likewise.
* tests/statfs64.c: Likewise.
* tests/xstatfs.c: Likewise.
* tests/xstatfs64.c: Likewise.
* tests/xstatfsx.c: Likewise.
* tests/fstatfs.test: New test.
* tests/fstatfs64.test: Likewise.
* tests/statfs64.test: Likewise.
* tests/statfs.c: Rewrite using xstatfs.c.
* tests/statfs.test: Update.
* tests/.gitignore: Add fstatfs, fstatfs64, and statfs64.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add  fstatfs.test, fstatfs64.test, and statfs64.test.
(EXTRA_DIST): Add xstatfs.c, xstatfs64.c, and xstatfsx.c.
2016-04-26 01:35:31 +00:00
121e1961d7 tests: add printflags function to libtests
* tests/printflags.c: New file.
* tests/tests.h (printflags): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-04-26 00:13:47 +00:00
f3ac12990d statfs: print f_flags field only when ST_VALID flag is set
* statfs.c (print_statfs_flags): New function.
(printstatfs, printstatfs64, printcompat_statfs64): Use it.
* xlat/statfs_flags.in (ST_VALID): Move to the head of the list.
* tests/statfs.expected: Update.
2016-04-25 10:30:03 +00:00
Fei Jie
13c1d0899d tests: add symlink.test
* tests/symlink.c: New file.
* tests/symlink.test: New test.
* tests/.gitignore: Add symlink.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add symlink.test.
2016-04-25 10:24:48 +00:00
Fei Jie
506a42f8c3 tests: add rmdir.test
* tests/rmdir.c: New file.
* tests/rmdir.test: New test.
* tests/.gitignore: Add rmdir.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add rmdir.test.
2016-04-25 10:24:12 +00:00
Fei Jie
7f05113624 tests: add setdomainname.test
* tests/setdomainname.c: New file.
* tests/setdomainname.test: New test.
* tests/.gitignore: Add setdomainname.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add setdomainname.test.
2016-04-25 10:24:12 +00:00
Fei Jie
cd61c9f3e4 tests: add sched_rr_get_interval.test
* tests/sched_rr_get_interval.c: New file.
* tests/sched_rr_get_interval.test: New test.
* tests/.gitignore: Add sched_rr_get_interval.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add sched_rr_get_interval.test.
2016-04-25 10:24:12 +00:00
b4a478dbfa statfs: decode f_flags field of struct statfs
* xlat/statfs_flags.in: New file.
* statfs.c: Include "xlat/statfs_flags.h".
(printstatfs) [_STATFS_F_FLAGS]: Print statbuf.f_flags as flags.
(printstatfs64) [_STATFS_F_FLAGS]: Likewise.
(printcompat_statfs64): Likewise.
* tests/statfs.expected: Update.
2016-04-25 01:58:25 +00:00
Zev Weiss
b587a5a1be statfs: don't quote f_type macro names
* statfs.c (sprintfstype): Don't add double-quotes to fs magic macros.
* tests/statfs.expected: Remove double-quotes.
2016-04-25 01:54:05 +00:00
6c69ed7ac5 tests/shmxt.c: robustify against arch specific issues
Do not treat failed shmat(SHM_RND) as a test failure.
This change partially reverts commit
bea707377d.

* tests/shmxt.c (main): Use SHM_RND in the second shmat call,
do not treat its potential error as a test failure.
2016-04-25 01:54:05 +00:00
3db07f11c8 Fix old_mmap output when mmap arguments are unfetchable
* mem.c (SYS_FUNC(old_mmap)): Use umove_or_printaddr instead of umoven
to fetch mmap arguments, return RVAL_DECODED when umove_or_printaddr
fails.
* tests/old_mmap.c (main): Check it.
2016-04-23 00:07:14 +00:00
3797d10e82 tests: extend test coverage of mmap syscall
Check decoding of "old mmap" edition of mmap syscall
on those architectures that define it.

* tests/old_mmap.c: New file.
* tests/old_mmap.test: New test.
* tests/.gitignore: Add old_mmap.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add old_mmap.test.
2016-04-22 23:28:23 +00:00
0e6cb1740a tests: extend test coverage of mincore syscall
* tests/mincore.c (print_mincore): New function.
(test_mincore): Use it.  Check mincore with invalid vec address.
Check mincore with length argument not a multiple of the page size.
(main): Check with DEFAULT_STRLEN pages.
2016-04-22 14:14:39 +00:00
a9540e72c7 tests: check decoding of clock_adjtime syscall
* tests/clock_adjtime.c: New file.
* tests/clock_adjtime.test: New test.
* tests/.gitignore: Add clock_adjtime.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add clock_adjtime.test.
2016-04-22 01:13:27 +00:00
fa5e5d9854 tests: do not include <assert.h> unnecessarily
Automatically change tests/*.c files using the following script:

for f in tests/*.c; do
	grep -q '\<assert(' "$f" ||
		sed -i '/# *include *<assert\.h>/d' "$f"
done
2016-04-21 22:05:57 +00:00
96a9ff5746 tests: do not include <errno.h> unnecessarily
Automatically change tests/*.c files using the following script:

for f in tests/*.c; do
	grep -Fv errno.h "$f" |
	grep -Ewq '(si_)?errno|SOCK_FILTER_DENY_SYSCALL' ||
		sed -i '/# *include *<errno\.h>/d' "$f"
done
2016-04-21 22:05:57 +00:00
e5297aeb13 tests/xetpriority.c: print syscall() result using %ld format 2016-04-21 22:05:57 +00:00
8141093cd0 tests/xetpgid.c: print syscall() result using %ld format 2016-04-21 22:05:57 +00:00
556179345b tests/xchownx.c: use errno2name 2016-04-21 22:05:57 +00:00
92288b2ba3 tests/userfaultfd.c: stop using assert 2016-04-21 22:05:56 +00:00
5d8c235110 tests/unlinkat.c: print syscall() result using %ld format 2016-04-21 22:05:56 +00:00
0df647673a tests/umount.c: use errno2name 2016-04-21 22:05:56 +00:00
ae4ba89702 tests/truncate64.c: cleanup
* tests/truncate64.c (main): Use errno2name, stop using assert.
2016-04-21 22:05:56 +00:00
2eec1ce820 tests/truncate.c: cleanup
* tests/truncate.c (main): Use errno2name, stop using assert.
2016-04-21 22:05:56 +00:00
7456b6420b tests/tee.c: stop using assert 2016-04-21 22:05:56 +00:00
86a090120a tests/syslog.c: use errno2name 2016-04-21 22:05:56 +00:00
82dd238b84 tests/sync_file_range2.c: stop using assert 2016-04-21 22:05:56 +00:00
3694b0c5bd tests/sync_file_range.c: stop using assert 2016-04-21 22:05:56 +00:00
5bc585ecc8 tests/symlinkat.c: cleanup 2016-04-21 22:05:56 +00:00
f75e034c84 tests/swap.c: cleanup
* tests/swap.c (error_msg): Remove.
(main): Use errno2name.
2016-04-21 22:05:56 +00:00
f5748b006f tests/splice.c: stop using assert 2016-04-21 22:05:56 +00:00
0b52ac3134 tests/setugid.c: cleanup 2016-04-21 22:05:56 +00:00
60b9187a7c tests/sethostname.c: use errno2name 2016-04-21 22:05:56 +00:00
b255f6e186 tests/setgroups.c: use errno2name
* tests/setgroups.c (errno2str): Remove.
(main): Use errno2name.
2016-04-21 22:05:56 +00:00
4483f628ab tests/seccomp-strict.c: cleanup
* tests/seccomp-strict.c (main): Use errno2name, stop using assert.
2016-04-21 22:05:56 +00:00
14fa74f9aa tests/seccomp-filter.c: cleanup
* tests/seccomp-filter.c (main): Use errno2name, stop using assert.
2016-04-21 22:05:56 +00:00
06c2828ee1 tests/sched_xetscheduler.c: print syscall() result using %ld format 2016-04-21 22:05:56 +00:00
61042d491b tests/sched_xetparam.c: print syscall() result using %ld format 2016-04-21 22:05:56 +00:00
3f470d83de tests/renameat.c: print syscall() result using %ld format 2016-04-21 22:05:56 +00:00
f224909546 tests/rename.c: print syscall() result using %ld format 2016-04-21 22:05:56 +00:00
92e3cca998 tests/readv.c: cleanup 2016-04-21 22:05:56 +00:00
304689e4ec tests/pwritev.c: use errno2name 2016-04-21 22:05:56 +00:00
cf1cfe13be tests/preadv-pwritev.c: cleanup 2016-04-21 22:05:56 +00:00
abde241e68 tests/prctl-seccomp-strict.c: cleanup
* tests/prctl-seccomp-strict.c (main): Use errno2name,
stop using assert.
2016-04-21 22:05:55 +00:00
037ab86e9a tests/openat.c: use errno2name 2016-04-21 22:05:55 +00:00
1e2f5f7733 tests/open.c: use errno2name 2016-04-21 22:05:55 +00:00
84aeea7e29 tests/mlockall.c: cleanup 2016-04-21 22:05:55 +00:00
c0b1d6f37c tests/mlock2.c: stop using assert 2016-04-21 22:05:55 +00:00
d0652a40eb tests/mknod.c: print syscall() result using %ld format 2016-04-21 22:05:55 +00:00
a175bfe445 tests/mkdirat.c: print syscall() result using %ld format 2016-04-21 22:05:55 +00:00
1b511d0fea tests/lseek.c: cleanup
* tests/lseek.c (main): Use errno2name, stop using assert.
2016-04-21 22:05:55 +00:00
cd157776bd tests/llseek.c: cleanup
* tests/llseek.c (main): Use errno2name, stop using assert.
2016-04-21 22:05:55 +00:00
5c62af0753 tests/linkat.c: print syscall() result using %ld format 2016-04-21 22:05:55 +00:00
33e0df7074 tests/iopl.c: use errno2name 2016-04-21 22:05:55 +00:00
c1dbe052f1 tests/ioperm.c: use errno2name 2016-04-21 22:05:55 +00:00