Commit Graph

942 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
dbb76606dc tests: check decoding of fallocate syscall
* configure.ac (AC_CHECK_FUNCS): Add fallocate.
* tests/fallocate.c: New file.
* tests/fallocate.test: New test.
* tests/.gitignore: Add fallocate.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fallocate.test.
2016-09-28 03:00:07 +00:00
Eugene Syromyatnikov
ec3761429e tests: check decoding of getcpu syscall
* tests/getcpu.c: New file.
* tests/getcpu.test: New test.
* tests/.gitignore: Add getcpu.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getcpu.test.
2016-09-27 18:01:09 +00:00
Eugene Syromyatnikov
aefb09b9cc tests: make magic values in ioctl_block test distinctive
* tests/ioctl.block (init_magic): Add iterator value to magic value
in order to enable detection of potential 4-byte aligned shifts.
2016-09-27 17:55:35 +00:00
Eugene Syromyatnikov
db27247d84 tests: additional getcwd decoding checks
* tests/getcwd.c (main): Add more checks for getcwd arguments decoding.
2016-09-27 17:53:50 +00:00
Eugene Syromyatnikov
81b63834dd tests: check decoding of quotactl syscall
* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, linux/quota.h,
and sys/quota.h.
* tests/.gitignore: Add quotactl, quotactl-v, quotactl-xfs,
and quotactl-xfs-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add quotactl.test, quotactl-v.test,
quotactl-xfs.test, and quotactl-xfs-v.test.
(EXTRA_DIST): Add quotactl.h
* quotactl.h: New file.
* quotactl.c: Likewise.
* quotactl-v.c: Likewise.
* quotactl-xfs.c: Likewise.
* quotactl-xfs-v.c: Likewise.
* quotactl.test: New test.
* quotactl-v.test: Likewise.
* quotactl-xfs.test: Likewise.
* quotactl-xfs-v.test: Likewise.
2016-09-27 08:11:06 +00:00
906dc4aaa1 Enhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
* defs.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Add support of char types.
* tests/tests.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Likewise.
2016-09-27 00:57:28 +00:00
632cc8a697 tests: use VERBOSE macro in waitid and waitid-v tests
* tests/waitid-v.c (VERBOSE_RUSAGE): Remove.
(VERBOSE): Define to 1.
* tests/waitid.c (sprint_rusage): Check VERBOSE instead
of VERBOSE_RUSAGE.
2016-09-26 15:24:27 +00:00
5cc7036061 tests: use VERBOSE macro in wait4 and wait4-v tests
* tests/wait4-v.c (VERBOSE_RUSAGE): Remove.
(VERBOSE): Define to 1.
* tests/wait4.c (sprint_rusage): Check VERBOSE instead
of VERBOSE_RUSAGE.
2016-09-26 15:24:26 +00:00
074c630705 tests: use VERBOSE macro in msg_control and msg_control-v tests
* tests/msg_control-v.c (VERBOSE_MSGHDR): Remove.
(VERBOSE): Define to 1.
* tests/msg_control.c (print_fds, print_ip_opts): Check VERBOSE instead
of VERBOSE_MSGHDR.
2016-09-26 15:24:25 +00:00
0c5b09c658 tests: use VERBOSE macro in mmsg_name and mmsg_name-v tests
* tests/mmsg_name-v.c (VERBOSE_MMSGHDR): Remove.
(VERBOSE): Define to 1.
* tests/mmsg_name.c (test_mmsg_name): Check VERBOSE instead
of VERBOSE_MMSGHDR.
2016-09-26 15:24:23 +00:00
a392aaa796 tests: use VERBOSE macro in ioctl_rtc and ioctl_rtc-v tests
* tests/ioctl_rtc-v.c (VERBOSE_IOCTL): Remove.
(VERBOSE): Define to 1.
* tests/ioctl_rtc.c (print_rtc_time): Check VERBOSE instead
of VERBOSE_IOCTL.
2016-09-26 15:24:22 +00:00
aa95ec7648 tests: use VERBOSE macro in ioctl_evdev and ioctl_evdev-v tests
* tests/ioctl_evdev-v.c (VERBOSE_IOCTL): Remove.
(VERBOSE): Define to 1.
* tests/ioctl_evdev.c: Check VERBOSE instead of VERBOSE_IOCTL.
2016-09-26 15:24:01 +00:00
0400e2ca7d tests: use VERBOSE macro in execveat and execveat-v tests
* tests/execveat-v.c (VERBOSE_EXECVEAT): Remove.
(VERBOSE): Define to 1.
* tests/execveat.c (main): Check VERBOSE instead of VERBOSE_EXECVEAT.
2016-09-26 15:23:48 +00:00
68beed808a tests: use VERBOSE macro in execve and execve-v tests
* tests/execve-v.c (VERBOSE_EXECVE): Remove.
(VERBOSE): Define to 1.
* tests/execve.c (main): Check VERBOSE instead of VERBOSE_EXECVE.
2016-09-26 15:23:25 +00:00
91eb1eddb0 tests: add VERBOSE macro
Introduce VERBOSE macro (defaults to 0) that is expected to be defined
to 1 by code testing "strace -v" output.

* tests/tests.h [!VERBOSE] (VERBOSE): New macro.
2016-09-26 15:23:18 +00:00
212a444bdc decode_open: print the mode argument when O_TMPFILE flag is set
O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.

* open.c (STRACE_O_TMPFILE): New macro.
(decode_open): Print the mode argument when O_TMPFILE flag is set.
* tests/open.c (main): Check it.
Fixes RH#1377846.
2016-09-20 20:55:56 +00:00
0918a4c3a2 tests: use sprintrc in tests/ptrace.c
* tests/ptrace.c (errstr): New static variable.
(do_ptrace): Initialize it using sprintrc.
(test_peeksiginfo, main): Use errstr.
2016-09-20 15:17:37 +00:00
b9bac78553 tests: use sprintrc in tests/netlink_protocol.c
* tests/netlink_protocol.c (main): Use sprintrc.
2016-09-20 12:29:35 +00:00
99f41c592d tests: use sprintrc in tests/fchownat.c
* tests/fchownat.c (main): Use sprintrc.
2016-09-20 00:48:57 +00:00
48ba1de869 tests: use sprintrc in tests/fchmodat.c
* tests/fchmodat.c (main): Use sprintrc.  Add more fchmodat decoding tests.
2016-09-20 00:23:10 +00:00
e9bfa4e406 tests: use sprintrc in tests/fchmod.c
* tests/fchmod.c (main): Use sprintrc.  Add more fchmod decoding tests.
* tests/fchmod.test: Update the value specified for strace -a parameter.
2016-09-20 00:23:10 +00:00
ac563cff02 tests: use sprintrc in tests/getgroups.c
* tests/getgroups.c (main): Use sprintrc.
2016-09-20 00:23:10 +00:00
fe1a225459 tests: use sprintrc in tests/setgroups.c
* tests/setgroups.c (main): Use sprintrc.
2016-09-20 00:23:05 +00:00
24f6345505 tests/utime.c: rewrite without assert
* tests/utime.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.
2016-09-19 19:51:37 +00:00
c7cd262a06 tests/xattr.c: rewrite without assert
* tests/xattr.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.
2016-09-19 19:51:37 +00:00
1caf9f296b tests: use sprintrc in tests/xchownx.c
* tests/xchownx.c (main): Do not include <errno.h>.  Use sprintrc.
2016-09-19 19:51:37 +00:00
8870b9e831 tests/xstatfsx.c: fix potential errno clobbering
* tests/xstatfsx.c (main): Use sprintrc.
2016-09-19 19:51:37 +00:00
Eugene Syromyatnikov
43e85a6648 tests: fix whitespace for explicit type casts in futex test 2016-09-15 20:05:44 +00:00
1ae660572f tests: workaround limited semctl implementation in musl
musl libc forwards semctl command argument for 8 known commands only,
for all the rest it passes 0 instead.

* tests/ipc_sem.c (main): Update semctl expected output.
2016-09-13 21:18:17 +00:00
Eugene Syromyatnikov
1bc727fc2f tests: add more IPC decoding checks
* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
commands) checks.
* tests/ipc_sem.c: Additional semget and semctl checks.
* tests/ipc_shm.c: Additional shmget and shmctl checks.
* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
* tests/semop.test: Add explicit -e parameter in order to trace both
semop and semtimedop.
* tests/shmxt.c: Additional shmat and shmdt checks.
2016-09-13 17:21:20 +00:00
378a47e80a tests: use sprintrc_grep in tests/ipc_shm.c
* tests/ipc_shm.c (main): Use sprintrc_grep.
2016-09-12 10:30:22 +00:00
3138893026 tests: use sprintrc_grep in tests/ipc_sem.c
* tests/ipc_sem.c (main): Use sprintrc_grep.
2016-09-12 09:27:58 +00:00
adffd04424 tests: use sprintrc_grep in tests/ipc_msg.c
* tests/ipc_msg.c (main): Use sprintrc_grep.
2016-09-11 00:04:16 +00:00
961a541ab4 tests: use sprintrc in tests/chmod.c
* tests/chmod.c (main): Use sprintrc.  Add more chmod decoding tests.
2016-09-10 22:58:40 +00:00
Eugene Syromyatnikov
84de545d73 tests/aio.c: bring indentation in conformance with the rest of the file 2016-09-09 22:18:11 +00:00
Eugene Syromyatnikov
083123860b tests: use predefined constant in aio_context_t checks in aio test
Also fix io_cancel and io_destroy checks which did not check correct
printing of context argument properly.

* tests/aio.c (main): Update syscall checks in order to use newly
defined bogus_ctx constant.
2016-09-09 22:18:11 +00:00
Eugene Syromyatnikov
3351924396 tests: use PRI__*64 macros in aio test
It was incorrectly assumed that __*64 types are long long on all
platforms, despite strace having specially crafted macros in order
to handle precisely this architecture discrepancy.
The commit fixes this oversight.

* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
specifiers for __*64-typed values.
2016-09-08 20:04:20 +00:00
7b93574bc7 ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
is __kernel_key_t (i.e. int), cast key_t argument to int
and print it using %#x format.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* tests/ipc_msg.c (main): Test it.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
2016-09-08 16:26:48 +00:00
Eugene Syromyatnikov
f4b7ac23b9 tests: add more sched_getattr and sched_setattr decoding checks
* tests/sched_xetattr.c (main): Add more sched_getattr and sched_setattr
decoding checks.
2016-09-08 12:33:44 +00:00
Eugene Syromyatnikov
0797de9efe tests: change type of sched_nice field to signed in sched_xetattr test
Kernel headers declare this field as s32, and strace prints it with %d
specifier.

* tests/sched_xetattr.c (main): Change type of sched_nice field of struct
sched_attr to int32_t, update format specifiers accordingly.
2016-09-08 12:33:44 +00:00
Eugene Syromyatnikov
6d995ae68b tests: add sprintrc_grep function to libtests
New sprintrc_grep function is sprintrc function equivalent suitable for
tests where grep-base pattern matching is employed.

* tests/tests.h (sprintrc_grep): New prototype.
* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
(sprintrc_ex): New function, renamed from sprintrc and updated to
support different formats.
(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.
2016-09-08 01:37:18 +00:00
Eugene Syromyatnikov
ee7d47f4d6 tests: perform more strict structure allocation in sched_xetattr test
Use tail_alloc with precise size of the structure.

* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
Rename sched to sched_attr.  Change type of sched_attr to struct
pointer.  Use tail_alloc for sched_attr allocation, update printf
statements accrodingly.
2016-09-08 01:37:14 +00:00
Eugene Syromyatnikov
e3ed9f557c tests: split long lines in sched_xetattr test
* tests/sched_xetattr.c (main): Split long lines.
2016-09-08 01:34:12 +00:00
9b95549a25 tests/aio.c: fix for x32 personality
* tests/aio.c (main): Do not pass 64-bit aio_context_t to io_submit
and io_getevents until strace learns how to print 64-bit pointers on x32
and on x86_64 for x32 personality.
2016-09-07 13:17:59 +00:00
ed292f62d6 aio: print aio_context_t as a pointer type
As aio_context_t is treated by the kernel as a pointer,
print it using printaddr.

* aio.c (SYS_FUNC(io_setup)): Print the pointer to aio_context_t
argument using printnum_ptr.
(SYS_FUNC(io_destroy), SYS_FUNC(io_submit), SYS_FUNC(io_cancel),
SYS_FUNC(io_getevents)): Print aio_context_t argument using printaddr.
* tests/aio.c (sprint_aio_context_t): Remove.
(main): Update expected output.
2016-09-07 13:01:29 +00:00
460c6253c4 tests/aio.c: rewrite without assert
* tests/aio.c: Do not include <assert.h>.
(main): Use sprintrc instead of assert.
2016-09-07 01:44:50 +00:00
Eugene Syromyatnikov
851ac444f4 tests: add more aio decoding checks
* tests/aio.c (sprint_aio_context_t): New function.
(main): Use it; add more checks.
2016-09-06 16:07:14 +00:00
Eugene Syromyatnikov
ea7adc3c4f tests: add suffix and cast to 64-bit constants in aio test
This helps to avoid warnings like
"integer constant is too large for ‘long’ type"
reported by some versions of gcc on 32-bit platforms.

* tests/aio.c (main): Add ULL suffix to 64-bit constants
and cast them to unsigned long.
2016-09-06 09:06:24 +00:00
Eugene Syromyatnikov
06d0a0eaa3 tests: check decoding of perf_event_open syscall
* tests/perf_event_open.c: New file.
* tests/perf_event_open.test: New test.
* tests/.gitignore: Add perf_event_open.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add perf_event_open.test.
2016-09-05 19:58:00 +00:00
b5d7a0b7cf tests: use sprintrc in tests/xetpriority.c
* tests/xetpriority.c (main): Use sprintrc.
2016-09-05 15:58:35 +00:00