IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
As virtually every test defines either one or both of OUT and ERR
variables and these definitions are exactly the same, move definitions
of these variables from individual tests to init.sh.
* tests/init.sh (OUT, ERR): New variables.
* tests/ipc.sh: Remove initialization of OUT variable.
* tests/statx.sh: Likewise.
* tests/*.test: Remove initialization of OUT and ERR variables.
Use the executable itself for input by default.
* tests/sendfile.c (main): Use av[0] instead of av[1] for input.
* tests/sendfile64.c (main): Likewise.
* tests/sendfile.test: Invoke run_prog without arguments.
* tests/sendfile64.test: Likewise.
While -P option needs /proc to match descriptors, it does not use
/proc to match pathnames. As these tests do not need descriptor
match, the /proc requirement can be safely lifted.
* tests/open.test: Lift /proc/self/fd/ requirement.
* tests/openat.test: Likewise.
* tests/openat.c (main): Rename fname to sample, change its value
to "openat.sample".
* tests/openat.test: Use -P option to filter out openat syscalls
made by libc and dynamic linker.
* mknod.c (decode_mknod): Treat device number argument as unsigned int.
* tests/mknod.c: Include <sys/sysmacros.h> or <sys/mkdev.h>
for definition of makedev macro.
(main): Add a check for a character special file.
Pathname containing >, }, or non-printable characters was resulting
in failing of the test.
* tests/scm_rights-fd.test: Fix pathname regex and simplify things.
Split TESTS into three groups: tests of specific decoders, libunwind
tests, and all other tests.
* tests/Makefile.am (TESTS): Move attach-f-p.test, attach-p-cmd.test,
bexecve.test, count-f.test, count.test, detach-running.test,
detach-sleeping.test, detach-stopped.test, dumpio.test,
filter-unavailable.test, fork-f.test, ksysent.test, opipe.test,
pc.test, qual_syscall.test, redirect.test, restart_syscall.test,
strace-f.test, and vfork-f.test to MISC_TESTS.
Move remaining tests except $(LIBUNWIND_TESTS) to DECODER_TESTS.
Add $(DECODER_TESTS) and $(MISC_TESTS).
* signal.c (SYS_FUNC(rt_sigqueueinfo)): Print first syscall argument
using %d format.
(SYS_FUNC(rt_tgsigqueueinfo)): Print first and second syscall arguments
using %d format.
* tests/rt_tgsigqueueinfo.c: New file.
* tests/rt_tgsigqueueinfo.test: New test.
* tests/.gitignore: Add rt_tgsigqueueinfo.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_tgsigqueueinfo.test.
* signal (print_sigset_addr_len_limit): New function, cloned from
print_sigset_addr_len with added minimal length argument.
Treat length less than minimal length or greater than NSIG/8 as invalid.
Do not align length to 4-byte boundary. Align destination buffer
to 4-byte boundary and initialize it with zeroes so that subsequent
call to sprintsigmask_n will not access uninitialized data.
(print_sigset_addr_len): Turn into a wrapper around
print_sigset_addr_len_limit with current_wordsize
as a minimal length argument.
(SYS_FUNC(rt_sigpending)): Call print_sigset_addr_len_limit
instead of print_sigset_addr_len with 1 as a minimal length argument.
* tests/rt_sigpending.c: New file.
* tests/rt_sigpending.test: New test.
* tests/.gitignore: Add rt_sigpending.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigpending.test.
Unfortunately, 64-bit linux kernel has a bug in matching inode numbers
greater than INT_MAX, so unix_diag exact match is not reliable.
This partially reverts commit 69bfc89770.
* socketutils.c (unix_send_query): Add NLM_F_DUMP to nlmsg_flags,
remove initialization of udiag_cookie.
* tests/netlink_unix_diag.c (send_query): Remove "inode" argument,
add NLM_F_DUMP to nlmsg_flags, remove initialization of udiag_ino
and udiag_cookie.
(check_responses): Remove "inode" argument and its use.
(main): Remove invocation of inode_of_sockfd and passing of listening
socket inode to send_query and check_responses.
* lseek.c (SYS_FUNC(lseek)): Print offset using %lld format.
(SYS_FUNC(llseek)): Likewise. Treat high and low components of offset
as unsigned long integers.
* tests/llseek.c (main): Check that negative offset is printed properly.
* tests/lseek.c (main): Likewise.
* tests/execve.c (main): Use one page gap between two mapped regions
for an address that is more likely to be not yet mapped.
* tests/execveat.c (main): Likewise.
* tests/mmap.c (main): Change output format from regexp to verbatim.
Add tests for madvise, mlockall, mremap, and msync syscalls.
* tests/mmap.test: Convert from match_grep to match_diff.
Add madvise, mlockall, mremap, and msync syscalls to syscall filter.
Check that -f -p attaches and follows all threads of the given pid.
* tests/attach-f-p.c: New file.
* tests/attach-f-p.test: New test.
* tests/.gitignore: Add attach-f-p.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(attach_f_p_LDADD): New variable.
(TESTS): Add attach-f-p.test.
* tests/utime.c (main): Check decoding of NULL struct utimbuf pointer.
Check decoding of struct utimbuf located at the end of page boundary.
* tests/utime.test: Update.
* tests/sysinfo.c (main): Check decoding of NULL struct sysinfo pointer.
Check decoding of struct sysinfo located at the end of page boundary.
* tests/sysinfo.test: Update.
* tests/adjtimex.c (main): Check decoding of NULL struct timex pointer.
Check decoding of struct timex located at the end of page boundary.
* tests/adjtimex.test: Update.
Check that -o |pipe_command works. In particular, check that
strace waits for completion of piped command.
* tests/opipe.test: New test.
* tests/Makefile.am (TESTS): Add it.
* tests/readlink.c (PREFIX, TARGET, LINKPATH): New macros.
(main): Allocate memory for string and buffer passed to the syscall
being tested using tail_alloc mechanism. Create and cleanup test
symlink. Test syscall error path output. Print hexquoted strings
using hexquote_strndup.
* tests/readlinkat.c: Likewise.
* tests/readlink.test: Remove creation and cleanup of test symlinks.
Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.
* tests/net-y-unix.c: New file.
* tests/net-y-unix.test: New test.
* tests/net-fd.test: Remove.
* tests/net-fd.expected: Remove.
* tests/.gitignore: Add net-y-unix.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Replace net-fd.test with net-y-unix.test.
(net-fd.log): Remove.
(EXTRA_DIST): Remove net-fd.expected.
As -yy parser, compared to -y, needs to do at least 5 extra syscalls
(getxattr, socket, sendmsg, recvmsg, close) to print socket details,
caching results of netlink conversations between strace and kernel
noticeably reduces amount of system time spent by strace.
The caching is safe since sockets do not change their addresses after
successful bind or connect syscall.
* defs.h (string_quote, print_sockaddr_by_inode_cached): New prototypes.
* socketutils.c (cache_entry): New type.
(CACHE_SIZE, CACHE_MASK): New macros.
(cache): New static array.
(cache_and_print_inode_details): New static function.
(print_sockaddr_by_inode_cached): New function.
(inet_parse_response, unix_parse_response): Use
cache_and_print_inode_details.
* util.c (printfd): Use string_quote and print_sockaddr_by_inode_cached.
(string_quote): Remove static qualifier.
* NEWS: Mention this improvement.
* tests/unix-yy.c (main): Update.
* socketutils.c (inet_parse_response, unix_parse_response): Change
return type from bool to int, return -1 on all parse errors except
inode mismatch.
(receive_responses): Stop on the first nlmsg_type that is not
SOCK_DIAG_BY_FAMILY, also stop when the parser returns -1.
* tests/netlink_inet_diag.c (check_responses): Stop on short messages,
on first nlmsg_type that is not SOCK_DIAG_BY_FAMILY, print more verbose
diagnostics for NLMSG_ERROR.
* tests/netlink_unix_diag.c (check_responses): Likewise.
Unlike the former test that was based on match_awk,
the new one uses match_diff and does more rigorous testing.
* tests/net-yy-inet.c: New file.
* tests/net-yy-inet.test: New test.
* tests/net-yy.test: Remove.
* tests/net-yy-accept.awk: Remove.
* tests/net-yy-connect.awk: Remove.
* tests/inet-accept-connect-send-recv.c: Remove.
* tests/.gitignore: Replace inet-accept-connect-send-recv
with net-yy-inet.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Replace net-yy.test with net-yy-inet.test.
(EXTRA_DIST): Remove net-yy-accept.awk and net-yy-connect.awk.
Unlike the former test that was based on match_awk,
the new one uses match_diff and does more rigorous testing.
* tests/net-yy-unix.c: New file.
* tests/net-yy-unix.test: New test.
* tests/unix-yy.test: Remove.
* tests/unix-yy-accept.awk: Remove.
* tests/unix-yy-connect.awk: Remove.
* tests/.gitignore: Add net-yy-unix.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Replace unix-yy.test with net-yy-unix.test.
(EXTRA_DIST): Remove unix-yy-accept.awk and unix-yy-connect.awk.
* mem.c (SYS_FUNC(mincore)): Print only those bytes of the vector
that were written by the kernel.
* NEWS: Mention this fix.
* tests/mincore.c: New file.
* tests/mincore.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mincore.
(TESTS): Add mincore.test.
* tests/.gitignore: Add mincore.
* strace.c (init): Allow -p option along with a command.
(startup_child): In -D mode, record the parent of the tracer process
as strace_child.
(startup_attach): Save trace_tracer_pid before -D mode fork.
When tracing a command in -f mode, do not check for the command's
threads as it has no threads at this moment.
Never attach to the tracer process.
In -D mode, never attach to the parent of the tracer process,
terminate that process only once at the end of startup_attach,
and reset strace_child.
* strace.1: Document that -p option can be used along with tracing
of a command.
* NEWS: Mention it.
* tests/attach-p-cmd-cmd.c: New file.
* tests/attach-p-cmd-p.c: Likewise.
* tests/attach-p-cmd.test: New test.
* tests/.gitignore: Add attach-p-cmd-cmd and attach-p-cmd-p.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add attach-p-cmd.test.
This fixes Debian bug #549942.
* tests/sleep.c: New file.
* tests/.gitignore: Add sleep.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/count.test: Use it instead of system sleep utility.
* defs.h (dumpiov_upto): New prototype.
(dumpiov): Change to a wrapper around dumpiov_upto.
* util.c (dumpiov): Rename to dumpiov_upto, add and check data_size
argument.
* io.c (SYS_FUNC(readv)): Call tprint_iov_upto instead
of tprint_iov and specify syscall return value as a data size limit.
* syscall.c (dumpio): In case of SEN_readv, call dumpiov_upto instead
of dumpiov and specify syscall return value as a data size limit.
* NEWS: Mention this fix.
* tests/readv.c: New file.
* tests/readv.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add readv.
(TESTS): Add readv.test.
* tests/.gitignore: Add readv.
This fixes the test on platforms where both __NR_sendmmsg and
HAVE_SENDMMSG are defined but the former is not implemented by the
kernel and the second is implemented as an indirect syscall.
* tests/mmsg.c (LENGTH_OF): New macro.
(send_mmsg, recv_mmsg): Print expected output in case of ENOSYS.
(main): Redirect stdout to a new descriptor. Use LENGTH_OF.
Print expected output.
* tests/mmsg.test: Update.
* tests/mmsg.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mmsg.expected.
* tests/scm_rights.c (main): Rewrite without fork.
Place all objects passed to sendmsg and recvmsg at the end
of memory pages followed by inaccessible pages.
* tests/scm_rights-fd.test: Update.
There are weird platforms that define __NR_sendmmsg but at the same time
do not define __NR_recvmmsg. Add a workaround for them.
* configure.ac (AC_CHECK_FUNCS): Add recvmmsg.
* tests/mmsg.c: Check for __NR_recvmmsg || HAVE_RECVMMSG.
Do not rely on "struct sigevent.__pad" being located at the same address
as "struct sigevent.sigev_notify_thread_id", it's not the case with musl
libc. Do not rely on struct sigevent definition at all to access
sigev_notify_thread_id.
* configure.ac (AC_CHECK_MEMBERS): Remove struct sigevent._sigev_un._pad
and struct sigevent.__pad.
* sigevent.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* print_sigevent.c: Include it.
* print_sigevent.c (struct_sigevent): Remove.
(print_sigevent): Update all struct_sigevent users.
* tests/timer_create.c: Include "sigevent.h".
(main): Use struct_sigevent instead of struct sigevent,
all struct sigevent clients changed.
The size of off_t is not something one can rely upon. For example,
musl libc unconditionally defines it as an int64_t type on x86.
A cast to the target type helps to avoid these libc differences.
* configure.ac: Call AC_C_TYPEOF.
* tests/struct_flock.c (TYPEOF_FLOCK_OFF_T): New macro.
(test_flock_einval): Use it instead of off_t.
The types that are used to define msg_namelen member of struct msghdr
and cmsg_len member of struct cmsghdr differ between libcs.
For example, glibc defines them as size_t, while musl libc - as type
socklen_t. Print these fields using %lu format to avoid issues caused
by libc differences.
* tests/inet-cmsg.c (main): Cast mh.msg_controllen and c->cmsg_len
to unsigned long and print them using %lu format.
* tests/tests.h (tail_memdup): New prototype.
* tests/tail_alloc.c (tail_memdup): New function.
* tests/mmsg.c (main): Place all objects passed to sendmmsg and recvmmsg
at the end of memory pages followed by inaccessible pages.
* tests/mmsg.c: Include <sys/syscall.h>.
Check for __NR_sendmmsg as an alternative to HAVE_SENDMMSG.
[!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(send_mmsg, recv_mmsg): New functions.
(main): Use them instead of sendmmsg and recvmmsg.
Reported-by: Szabolcs Nagy <nsz@port70.net>
Make the test compatible with musl libc that uses RT_2 internally.
* tests/sigreturn.c (main): Replace RT_2 with RT_5.
* tests/sigreturn.test: Likewise.
Reported-by: Szabolcs Nagy <nsz@port70.net>
Workaround limitations of settimeofday wrapper provided by musl libc.
* tests/xettimeofday.c (main): Call settimeofday using syscall().
Reported-by: Szabolcs Nagy <nsz@port70.net>
Print the second return value of getxpid, getxuid, and getxgid syscalls
that return a pair of values using the same mechanism as pipe syscall.
* alpha.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/alpha/syscallent.h [20]: Change SEN(getpid) to SEN(getxpid).
[24]: Change SEN(getuid) to SEN(getxuid).
[47]: Change SEN(getgid) to SEN(getxgid).
* NEWS: Mention this enhancement.
* tests/uid.awk: Update for getxgid output change.
* tests/uid.test: Cleanup.
* tests/getxxid.c: New file.
* tests/getxxid.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getxxid.
(TESTS): Add getxxid.test.
* tests/.gitignore: Add getxxid.
Use chdir syscalls instead of pwrite64 syscalls as a method of inserting
text markers into strace output because the former are more portable.
* tests/fork-f.c (logit): Rename to logit_. Use chdir instead of pwrite.
(logit): New macro wrapper around logit_.
(main): Update expected output.
* tests/vfork-f.c: Likewise.
* tests/fork-f.test: Update.
On some platforms, e.g. hppa glibc, vfork() is implemented using fork
syscall, so the test cannot rely on the parent process remaining blocked
until the child process either terminates or calls execve.
* tests/vfork-f.c (main): Explicitly block the parent until the child
either terminates or calls execve.
Print cpu_set_t as a set of integers, similar to the way
fd_set is printed as a set of descriptors.
* affinity.c: Include <sched.h>.
(get_cpuset_size): New function.
(print_affinitylist): Rewrite using get_cpuset_size and next_set_bit.
(sched_getaffinity, sched_setaffinity): Print first two args as ints.
* NEWS: Mention this enhancement.
* tests/sched_xetaffinity.c: New file.
* tests/sched_xetaffinity.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sched_xetaffinity.
(TESTS): Add sched_xetaffinity.test.
* tests/.gitignore: Add sched_xetaffinity.
Reported-by: Joe Korty <joe.korty@ccur.com>