Commit Graph

740 Commits

Author SHA1 Message Date
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