]> granicus.if.org Git - strace/log
strace
7 years agoIntroduce tprintf_comment and tprints_comment functions
Dmitry V. Levin [Mon, 24 Apr 2017 19:31:54 +0000 (19:31 +0000)]
Introduce tprintf_comment and tprints_comment functions

* defs.h (tprintf_comment, tprints_comment): New prototypes.
* strace.c (tvprintf): New function.
(tprintf): Use it.
(tprintf_comment, tprints_comment): New functions.
* aio.c (tprint_lio_opcode): Use tprints_comment.
* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Likewise.
* futex.c (SYS_FUNC(futex)): Likewise.
* perf.c (print_perf_event_attr): Likewise.
* seccomp.c (decode_bpf_code): Likewise.
* util.c (printxvals, printxval_searchn, printflags64): Likewise.
* btrfs.c (print_u64, btrfs_print_key_type, btrfs_print_objectid,
print_key_value_internal): Likewise.
(btrfs_ioctl): Use tprints_comment and tprintf_comment.
* dirent.c (SYS_FUNC(getdents)): Likewise.
* dirent64.c (SYS_FUNC(getdents64)): Likewise.
* execve.c (printargc): Use tprintf_comment.
* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl,
btrfs_test_features_ioctls): Update expected output.

7 years agoMake output of execve/execveat syscall parsers more structured
Dmitry V. Levin [Mon, 24 Apr 2017 19:22:11 +0000 (19:22 +0000)]
Make output of execve/execveat syscall parsers more structured

* execve.c (printargc): Always print the address, format the number
of variables as a comment.
* tests/execve.c: Update expected output.
* tests/execveat.c: Likewise.
* tests/qual_syscall.test: Likewise.
* tests/strace-r.expected: Likewise.
* tests/strace-t.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/threads-execve.c: Likewise.
* tests/threads-execve.test: Likewise.

7 years agodm: fix diagnostics about misplaced parts of struct dm_ioctl
Dmitry V. Levin [Mon, 24 Apr 2017 19:14:41 +0000 (19:14 +0000)]
dm: fix diagnostics about misplaced parts of struct dm_ioctl

* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
dm_decode_dm_name_list, dm_decode_dm_target_versions,
dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Fix
diagnostics about various misplaced parts of struct dm_ioctl.
* tests/ioctl_dm.c: Update expected output.

7 years agoprint_mq_attr: fix typo
Dmitry V. Levin [Mon, 24 Apr 2017 14:14:07 +0000 (14:14 +0000)]
print_mq_attr: fix typo

* print_mq_attr.c (printmqattr): Fix the last argument of printflags64.

7 years agotests: add faulty pointer check to time test
Eugene Syromyatnikov [Sun, 23 Apr 2017 19:50:29 +0000 (21:50 +0200)]
tests: add faulty pointer check to time test

* tests/time.c (main): Add check for an inaccessible pointer.

7 years agotests: fix print_time_t_nsec usage in xstatx.c
Dmitry V. Levin [Sat, 22 Apr 2017 00:15:41 +0000 (00:15 +0000)]
tests: fix print_time_t_nsec usage in xstatx.c

* tests/xstatx.c (print_stat): Pass tv_nsec field through
zero_extend_signed_to_ull before feeding it to print_time_t_nsec.

7 years agotests: fix netlink_protocol on sparc
Dmitry V. Levin [Fri, 21 Apr 2017 23:01:22 +0000 (23:01 +0000)]
tests: fix netlink_protocol on sparc

* tests/netlink_protocol.c (test_nlmsgerr): Do not access fields of an
unaligned structure, this makes architectures like sparc very unhappy.

7 years agoutil: return pointer to string literal directly in sprinttime
Eugene Syromyatnikov [Wed, 1 Mar 2017 01:25:20 +0000 (02:25 +0100)]
util: return pointer to string literal directly in sprinttime

There is no sense to copy it to static buffer first.

* util.c (sprinttime): Just return "0", do not copy it to internal
buffer first.

7 years agotests: remove stat.sample creation from gen_tests.in
Dmitry V. Levin [Fri, 21 Apr 2017 03:54:02 +0000 (03:54 +0000)]
tests: remove stat.sample creation from gen_tests.in

stat.sample is created by appropriate executables and never removed.

* tests/gen_tests.in (trace_fstat, trace_lstat, trace_stat,
trace_stat_like): Remove stat.sample creation.

7 years agotests: tabulate fstat.test
Dmitry V. Levin [Fri, 21 Apr 2017 03:49:07 +0000 (03:49 +0000)]
tests: tabulate fstat.test

* tests/gen_tests.in (fstat): New entry.
(fstat64, oldfstat): Update.
* tests/fstat.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove fstat.test.

7 years agoImplement -e trace=%stat option
Eugene Syromyatnikov [Tue, 18 Apr 2017 01:14:52 +0000 (03:14 +0200)]
Implement -e trace=%stat option

linux/*/syscallent*.h part is updated automatically by:

    sed -i '/statx/! s/TF|TSTA,/TF|TST|TSTA,/' linux/*/syscallent*.h

* sysent.h (TRACE_STAT): New macro.
* syscall.c: Alias LST to TRACE_STAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_STAT for "%stat".
* strace.1 (.SS Filtering): Add information about %stat syscall class.
* NEWS: Mention this change.
* linux/aarch64/syscallent.h (stat): Add TST flag.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (oldstat, stat, stat64): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/avr32/syscallent.h (stat, stat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h (oldstat, stat): Likewise.
* linux/alpha/syscallent.h (osf_old_stat, osf_stat, stat, stat64): Likewise.
* linux/mips/syscallent-compat.h (bsd43_oldstat, bsd43_stat, posix_stat,
svr4_stat, svr4_xstat, sysv_stat, sysv_xstat): Likewise.
* tests/gen_tests.in (trace_stat): New entry.
* tests/trace_stat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoImplement -e trace=%lstat option
Eugene Syromyatnikov [Tue, 18 Apr 2017 00:23:05 +0000 (02:23 +0200)]
Implement -e trace=%lstat option

linux/*/syscallent*.h part is updated automatically by:

    sed -i '/TSTA,.*lx\?stat/ s/TSTA,/TLST|&/' linux/*/syscallent*.h

* sysent.h (TRACE_LSTAT): New macro.
* syscall.c: Alias TLST to TRACE_LSTAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_LSTAT for "%lstat".
* strace.1 (.SS Filtering): Add information about %lstat syscall class.
* NEWS: Mention this change.
* linux/aarch64/syscallent.h (lstat): Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (lstat, lstat64, oldlstat): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/avr32/syscallent.h (lstat, lstat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (lstat, lstat64, osf_lstat, osf_old_lstat): Likewise.
* linux/mips/syscallent-compat.h (bsd43_lstat, posix_lstat, svr4_lstat,
sysv_lstat): Likewise.
* tests/gen_tests.in (trace_lstat): New entry.
* tests/trace_lstat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TLST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoImplement -e trace=%fstat option
Eugene Syromyatnikov [Mon, 17 Apr 2017 23:52:58 +0000 (01:52 +0200)]
Implement -e trace=%fstat option

linux/*/syscallent*.h part is updated automatically by:

    sed -i -e '/TSTA.*fx\?stat/ s/TSTA,/TFST|&/' \
           -e 's/\(TD|TF|TFST|TSTA,\)[[:space:]]/\1/' linux/*/syscallent*.h

* sysent.h (TRACE_FSTAT): New macro.
* syscall.c: Alias TFST to TRACE_FSTAT around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_FSTAT for "%fstat".
* strace.1 (.SS Filtering): Add information about %fstat syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstat64, fstatat64): Add TFST flag.
* linux/64/syscallent.h (fstat, newfstatat): Likewise.
* linux/aarch64/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (fstat, fstat64, fstatat64, oldfstat): Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/avr32/syscallent.h (fstat, fstat64, fstatat64): Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, osf_fstat,
osf_old_fstat): Likewise.
* linux/powerpc64/syscallent.h (fstat, newfstatat, oldfstat): Likewise.
* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_oldfstat, posix_fstat,
svr4_fstat, sysv_fstat): Likewise.
* tests/gen_tests.in (trace_fstat): New entry.
* tests/trace_fstat.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TFST): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoImplement -e trace=%%stat option
Eugene Syromyatnikov [Mon, 17 Apr 2017 23:14:58 +0000 (01:14 +0200)]
Implement -e trace=%%stat option

linux/*/syscallent*.h part is updated automatically by:

    sed -i '/TSFA\|stat[iu]s/! s/,[[:space:]]\?\([[:space:]]*SEN(.*stat\)/|TSTA,\1/' \
        linux/*/syscallent*.h

* sysent.h (TRACE_STAT_LIKE): New macro.
* syscall.c: Alias TSTA to TRACE_STAT_LIKE around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_STAT_LIKE for "%%stat".
* strace.1 (.SS Filtering): Add information about %%stat syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstat64, fstatat64, statx): Add TSTA flag.
* linux/64/syscallent.h (fstat, newfstatat, statx): Likewise.
* linux/aarch64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
osf_fstat, osf_lstat, osf_old_fstat, osf_old_lstat, osf_old_stat, osf_stat,
stat, stat64): Likewise.
* linux/arm/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/avr32/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64): Likewise.
* linux/bfin/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/crisv10/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/hppa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64): Likewise.
* linux/i386/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/ia64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
* linux/m68k/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/microblaze/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_lstat, bsd43_oldfstat,
bsd43_oldstat, bsd43_stat, posix_fstat, posix_lstat, posix_stat, svr4_fstat,
svr4_fxstat, svr4_lstat, svr4_lxstat, svr4_stat, svr4_xstat, sysv_fstat,
sysv_fxstat, sysv_lstat, sysv_lxstat, sysv_stat, sysv_xstat): Likewise.
* linux/mips/syscallent-n32.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/mips/syscallent-n64.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/mips/syscallent-o32.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/powerpc64/syscallent.h (fstat, lstat, newfstatat, oldfstat, oldlstat,
oldstat, stat): Likewise.
* linux/powerpc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
* linux/s390/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64, statx): Likewise.
* linux/s390x/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/sh64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64): Likewise.
* linux/sh/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
oldlstat, oldstat, stat, stat64): Likewise.
* linux/sparc64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldlstat, stat, stat64): Likewise.
* linux/sparc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
oldlstat, stat, stat64): Likewise.
* linux/x32/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/x86_64/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
* linux/xtensa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
stat64, statx): Likewise.
* tests/gen_tests.in (trace_stat_like): New entry.
* tests/trace_stat_like.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TSTA): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoqualify: add syntax for optional non-matching syscall qualification
Eugene Syromyatnikov [Mon, 17 Apr 2017 23:02:09 +0000 (01:02 +0200)]
qualify: add syntax for optional non-matching syscall qualification

It may be useful in case syscall is not present on the target
architecture.

* qualify.c (qualify_syscall): Add ignore_fail flag, set it to true
in case syscall qualification is led by a question mark(s).
* strace.1 (.SS Filtering): Document ability to use question marks
in syscall qualification.

7 years agolinux/alpha/syscallent.h: add TSFA flag to osf_getfsstat
Eugene Syromyatnikov [Mon, 17 Apr 2017 19:01:05 +0000 (21:01 +0200)]
linux/alpha/syscallent.h: add TSFA flag to osf_getfsstat

In accordance with [1].

[1] https://www.freebsd.org/cgi/man.cgi?query=getfsstat&sektion=2

* linux/alpha/syscallent.h (osf_getfsstat): Add TSFA flag.
* strace.1 (.SS Filtering) <%%statfs>: Update equivalent regexp.

7 years agolinux/mips/syscallent-compat.h: add some TD/TF flags for *stat* variants
Eugene Syromyatnikov [Mon, 17 Apr 2017 18:55:51 +0000 (20:55 +0200)]
linux/mips/syscallent-compat.h: add some TD/TF flags for *stat* variants

*xstat syscalls are, according to [1], like their *stat counterparts,
but with additional argument with fixed value.

[1] http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf

* linux/mips/syscallent-compat.h (*_xstat, *_lxstat, bsd43_oldstat):
Add TF flag.
(*_fxstat, bsd43_oldfstat): Add TD flag.

7 years agoImplement -e trace=%%statfs option
Eugene Syromyatnikov [Sun, 16 Apr 2017 13:30:29 +0000 (15:30 +0200)]
Implement -e trace=%%statfs option

linux/*/syscallent*.h part is updated automatically by:

    sed -i 's/\(TSF\),[[:space:]]\?/\1|TSFA,/' linux/*/syscallent*.h
    sed -i 's/\(TFSF\),/\1|TSFA,/' linux/*/syscallent*.h
    sed -i 's/0\(,.*ustat\)/TSFA\1/' linux/*/syscallent*.h

* sysent.h (TRACE_STATFS_LIKE): New macro.
* syscall.c: Alias TSFA to TRACE_STATFS_LIKE around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS_LIKE for "%%statfs".
* strace.1 (.SS Filtering): Add information about %%statfs syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (statfs64, fstatfs64): Add TSFA flag.
* linux/64/syscallent.h (statfs, fstatfs): Likewise.
* linux/aarch64/syscallent.h (statfs, fstatfs, ustat): Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (statfs, statfs64, fstatfs, fstatfs64, ustat):
Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs,
ofs_fstatfs, osf_fstatfs64, ustat): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs, *_fstatfs): Likewise.
* tests/gen_tests.in (trace_statfs_like): New entry.
* tests/trace_statfs_like.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TSFA): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoImplement -e trace=%fstatfs option
Eugene Syromyatnikov [Mon, 17 Apr 2017 18:29:44 +0000 (20:29 +0200)]
Implement -e trace=%fstatfs option

linux/*/syscallent*.h part is updated automatically by:

    sed -i 's/TD,[[:space:]]\([[:space:]]*SEN.*[_"]fstatv\?fs\)/TD|TFSF,\1/' \
           linux/*/syscallent*.h

* sysent.h (TRACE_FSTATFS): New macro.
* syscall.c: Alias TFSF to TRACE_FSTATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_FSTATFS for "%fstatfs".
* strace.1 (.SS Filtering): Add information about %fstatfs syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h (fstatfs64): Add TFSF flag.
* linux/64/syscallent.h (fstatfs): Likewise.
* linux/aarch64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h (fstatfs, fstatfs64):
Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (ofs_fstatfs, osf_fstatfs64): Likewise.
* linux/mips/syscallent-compat.h (*_fstatfs, *_fstatvfs): Likewise.
* tests/gen_tests.in (trace_fstatfs): New entry.
* tests/trace_fstatfs.in: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/ksysent.c (TFSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agosysent.h: format syscall flag macros
Eugene Syromyatnikov [Sun, 16 Apr 2017 13:24:00 +0000 (15:24 +0200)]
sysent.h: format syscall flag macros

Add some tabulation and leading zeroes to the values.

7 years agotests: tabulate sched.test
Dmitry V. Levin [Fri, 21 Apr 2017 01:29:29 +0000 (01:29 +0000)]
tests: tabulate sched.test

Rewrite sched.test using test_trace_expr().

* tests/gen_tests.in (sched): New entry.
* tests/sched.in: New file, derived from a set of tests in sched.test.
* tests/sched.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove sched.test.
(EXTRA_DIST): Add sched.in.

7 years agotests: tabulate regex.test
Dmitry V. Levin [Fri, 21 Apr 2017 01:29:29 +0000 (01:29 +0000)]
tests: tabulate regex.test

Rewrite regex.test using test_trace_expr().

* tests/gen_tests.in (regex): New entry.
* tests/regex.in: New file, derived from a set of tests in regex.test.
* tests/regex.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove regex.test.
(EXTRA_DIST): Add regex.in.

7 years agotests: tabulate clock.test
Dmitry V. Levin [Fri, 21 Apr 2017 01:29:29 +0000 (01:29 +0000)]
tests: tabulate clock.test

Rewrite clock.test using test_trace_expr().

* tests/gen_tests.in (clock): New entry.
* tests/clock.in: New file, derived from a set of tests in clock.test.
* tests/clock.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove clock.test.
(EXTRA_DIST): Add clock.in.

7 years agotests: tabulate trace_statfs.test
Eugene Syromyatnikov [Thu, 20 Apr 2017 00:43:49 +0000 (02:43 +0200)]
tests: tabulate trace_statfs.test

Rewrite trace_statfs.test using test_trace_expr().

* tests/gen_tests.in (trace_statfs): New entry.
* tests/trace_statfs.in: New file, derived from a set of tests
in trace_statfs.test.
* tests/trace_statfs.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove trace_statfs.test.
(EXTRA_DIST): Add trace_statfs.in.

7 years agotests/init.sh: add helpers for running set of programs
Eugene Syromyatnikov [Thu, 20 Apr 2017 00:39:54 +0000 (02:39 +0200)]
tests/init.sh: add helpers for running set of programs

This introduces three new helpers:
prog_set_subtract subtracts one program set from another,
test_pure_prog_set runs strace check on a set of programs,
test_trace_expr tests trace expressions.

* tests/init.sh (prog_set_subtract, test_pure_prog_set,
test_trace_expr): New functions.

7 years agotests: extend gen_tests.sh further
Dmitry V. Levin [Thu, 20 Apr 2017 18:11:35 +0000 (18:11 +0000)]
tests: extend gen_tests.sh further

* tests/gen_tests.sh: Extend support of arbitrary rules.

7 years agotests/xstat.c: do not remove sample file after test
Eugene Syromyatnikov [Thu, 20 Apr 2017 01:04:50 +0000 (03:04 +0200)]
tests/xstat.c: do not remove sample file after test

As tests are executed in separate directories now, there is no need to
remove sample file.

* tests/xstat.c (main): Remove unlink calls.

7 years agotests: use fixed name for stat tests sample file
Eugene Syromyatnikov [Wed, 19 Apr 2017 23:01:29 +0000 (01:01 +0200)]
tests: use fixed name for stat tests sample file

As tests are now run in separate directories.

* tests/xstatx.c: Use fixed "stat.sample" name for sample file.
* tests/fstat.test: Use it as an argument for -P option.
* tests/gen_tests.in (fstat64, lstat, lstat64, newfstatat, oldlstat,
oldstat, stat, stat64, statx): Likewise.

7 years agoDerive copyright year from the git commit date
Eugene Syromyatnikov [Tue, 4 Apr 2017 12:30:39 +0000 (14:30 +0200)]
Derive copyright year from the git commit date

This solves problems like the need to update test suite on every
New Year's Eve.

* Makefile.am (dist-hook): Generate .year.
* copyright-year-gen: New file.
* configure.ac (copyright_year): New m4 variable, defined as the output
of copyright-year-gen script.
(AC_COPYRIGHT): Use it.
(COPYRIGHT_YEAR): New output variable and preprocessor macro.
* strace.c (print_version): Use COPYRIGHT_YEAR.
* strace.spec.in (%prep): Save the value of COPYRIGHT_YEAR autoconf
variable to .year file.
* tests/strace-V.test (config_year): New variable, derived from config.h.
Add sanity checks for $config_year and use it in expected output.

Reported-by: Andreas Schwab <schwab@suse.de>
7 years agotests: move /proc/ checks from scripts to executables
Dmitry V. Levin [Wed, 19 Apr 2017 02:16:31 +0000 (02:16 +0000)]
tests: move /proc/ checks from scripts to executables

Move most of /proc/self/task/ and /proc/self/fd/ checks from scripts
to xecutables.

* tests/attach-f-p.test: Move /proc/self/task/ check ...
* tests/attach-f-p-cmd.c (main): ... here.
* tests/fstat.test: Move /proc/self/fd/ check ...
* tests/xstatx.c (main): ... here.
* tests/net-y-unix.test: Move /proc/self/fd/ check ...
* tests/net-y-unix.c (main): ... here.
* tests/net-yy-inet.test: Move /proc/self/fd/ check ...
* tests/net-yy-inet.c (main): ... here.
* tests/net-yy-netlink.test: Move /proc/self/fd/ check ...
* tests/net-yy-netlink.c (main): ... here.
* tests/net-yy-unix.test: Move /proc/self/fd/ check ...
* tests/net-yy-unix.c (main): ... here.

7 years agotests: tabulate pread64-pwrite64.test
Dmitry V. Levin [Wed, 19 Apr 2017 02:16:31 +0000 (02:16 +0000)]
tests: tabulate pread64-pwrite64.test

* tests/gen_tests.in (pread64-pwrite64): New entry.
* tests/pread64-pwrite64.c: (main): Skip the test if /proc/self/fd/
is not available.
* tests/pread64-pwrite64.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove pread64-pwrite64.test.

7 years agotests: tabulate read-write.test
Dmitry V. Levin [Wed, 19 Apr 2017 02:16:31 +0000 (02:16 +0000)]
tests: tabulate read-write.test

* tests/gen_tests.in (read-write): New entry.
* tests/read-write.c: (main): Skip the test if /proc/self/fd/
is not available.
* tests/read-write.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove read-write.test.

7 years agotests: add skip_if_unavailable function to libtests
Dmitry V. Levin [Wed, 19 Apr 2017 02:16:31 +0000 (02:16 +0000)]
tests: add skip_if_unavailable function to libtests

* tests/skip_unavailable.c: New file.
* tests/tests.h (skip_if_unavailable): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add skip_unavailable.c.

7 years agotests: tabulate netlink_protocol.test
Dmitry V. Levin [Wed, 19 Apr 2017 00:55:21 +0000 (00:55 +0000)]
tests: tabulate netlink_protocol.test

* tests/gen_tests.in (netlink_protocol): New entry.
* tests/netlink_protocol.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove netlink_protocol.test.

7 years agotests: tabulate statfs.test
Dmitry V. Levin [Wed, 19 Apr 2017 00:02:56 +0000 (00:02 +0000)]
tests: tabulate statfs.test

* tests/gen_tests.in (statfs): New entry.
(fstatfs, fstatfs64, statfs64): Update.
* tests/statfs.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove statfs.test.

7 years agotests: skip statfs related tests if their sample files are not available
Dmitry V. Levin [Tue, 18 Apr 2017 23:56:09 +0000 (23:56 +0000)]
tests: skip statfs related tests if their sample files are not available

* tests/xstatfsx.c (print_statfs): Skip the test if open failed.

7 years agotests: extend gen_tests.sh to support arbitrary test_* rules
Dmitry V. Levin [Tue, 18 Apr 2017 23:31:19 +0000 (23:31 +0000)]
tests: extend gen_tests.sh to support arbitrary test_* rules

* tests/gen_tests.sh: Add support of arbitrary test_* rules.

7 years agotests: change gen_tests.sh to read its input as raw input
Dmitry V. Levin [Tue, 18 Apr 2017 23:25:04 +0000 (23:25 +0000)]
tests: change gen_tests.sh to read its input as raw input

* tests/gen_tests.sh: Specify -r option to read.
* tests/gen_tests.in (shmxt): Update.

7 years agostrace.1: s/regex expression/regular expression/
Eugene Syromyatnikov [Mon, 17 Apr 2017 23:07:50 +0000 (01:07 +0200)]
strace.1: s/regex expression/regular expression/

7 years agostrace.1: enhance %statfs description
Dmitry V. Levin [Mon, 17 Apr 2017 20:14:07 +0000 (20:14 +0000)]
strace.1: enhance %statfs description

* strace.1 (.SS Filtering) <%statfs>: Fix the list of syscalls,
add an equivalent regex expression.

7 years agonetlink: decode NLMSG_ERROR messages
Dmitry V. Levin [Mon, 17 Apr 2017 04:37:41 +0000 (04:37 +0000)]
netlink: decode NLMSG_ERROR messages

* netlink.c (decode_nlmsgerr, decode_payload): New functions.
(decode_nlmsghdr_with_payload): Use decode_payload.
* tests/netlink_protocol.c (send_query): Check decoding
of NLMSG_ERROR messages.
* NEWS: Mention this change.

7 years agonetlink: avoid using unaligned sizeof(struct nlmsghdr) unnecessarily
Dmitry V. Levin [Mon, 17 Apr 2017 04:37:29 +0000 (04:37 +0000)]
netlink: avoid using unaligned sizeof(struct nlmsghdr) unnecessarily

* netlink.c (NLMSG_HDRLEN): Redefine.
(decode_nlmsghdr_with_payload, decode_netlink): Use it instead
of sizeof(struct nlmsghdr).

7 years agoFix the length argument passed from print_iovec to decode_netlink
Dmitry V. Levin [Mon, 17 Apr 2017 04:37:11 +0000 (04:37 +0000)]
Fix the length argument passed from print_iovec to decode_netlink

* io.c (print_iovec): Pass the actual length to decode_netlink
instead of the original length.
* NEWS: Mention this fix.

7 years agonuma: fix printing of error values in move_pages status array
Dmitry V. Levin [Mon, 17 Apr 2017 04:36:54 +0000 (04:36 +0000)]
numa: fix printing of error values in move_pages status array

* numa.c (print_status): Do not lose a minus sign when printing
a symbolic error code.
* tests/move_pages.c (print_status_array): Update expected output.

7 years agotests: generate pure_executables part of check_PROGRAMS automatically
Dmitry V. Levin [Mon, 17 Apr 2017 00:53:19 +0000 (00:53 +0000)]
tests: generate pure_executables part of check_PROGRAMS automatically

* tests/gen_pure_executables.sh: New file.
* bootstrap: Invoke it.
* tests/Makefile.am: Include pure_executables.am.
(check_PROGRAMS): Add $(PURE_EXECUTABLES).  Remove everything listed
in pure_executables.list.
(EXTRA_DIST): Add gen_pure_executables.sh.
* tests/.gitignore: Add pure_executables.am.

7 years agotests: make EXTRA_DIST sorted
Dmitry V. Levin [Mon, 17 Apr 2017 00:50:19 +0000 (00:50 +0000)]
tests: make EXTRA_DIST sorted

* tests/Makefile.am (EXTRA_DIST): Sort.

7 years agotests: check decoding of alpha specific osf_utimes syscall
Dmitry V. Levin [Mon, 17 Apr 2017 00:29:58 +0000 (00:29 +0000)]
tests: check decoding of alpha specific osf_utimes syscall

* tests/osf_utimes.c: New file.
* tests/gen_tests.in (osf_utimes): New entry.
* tests/Makefile.am (check_PROGRAMS): Add osf_utimes.
* tests/pure_executables.list: Likewise.
* tests/.gitignore: Likewise.

7 years agotests: parametrize utimes.c
Dmitry V. Levin [Mon, 17 Apr 2017 00:17:00 +0000 (00:17 +0000)]
tests: parametrize utimes.c

* tests/xutimes.c: New file, based on utimes.c.
* tests/utimes.c [__NR_utimes] (TEST_SYSCALL_NR, TEST_SYSCALL_STR,
TEST_STRUCT): New macros.
[__NR_utimes]: Replace all the rest with include "xutimes.c".
* tests/Makefile.am (EXTRA_DIST): Add xutimes.c.

7 years agoalpha: fix tracing flags of osf_select and osf_utimes syscalls
Dmitry V. Levin [Sun, 16 Apr 2017 23:37:13 +0000 (23:37 +0000)]
alpha: fix tracing flags of osf_select and osf_utimes syscalls

* linux/alpha/syscallent.h (osf_select): Add TD flag.
(osf_utimes): Add TF flag.
* NEWS: Mention alpha specific fixes.

7 years agoalpha: rename print_timeval32_pair to print_timeval32_utimes
Dmitry V. Levin [Sun, 16 Apr 2017 23:27:08 +0000 (23:27 +0000)]
alpha: rename print_timeval32_pair to print_timeval32_utimes

This follows the rename of print_timeval_item to print_timeval_utimes.

* defs.h [ALPHA] (print_timeval32_pair): Rename
to print_timeval32_utimes.
* print_timeval.c [ALPHA] (print_timeval32_pair): Likewise.
* utimes.c [ALPHA] (SYS_FUNC(osf_utimes)): Replace print_timeval32_pair
with print_timeval32_utimes.

7 years agotests: do more rigorous testing of utimes syscall parser
Dmitry V. Levin [Sun, 16 Apr 2017 18:47:29 +0000 (18:47 +0000)]
tests: do more rigorous testing of utimes syscall parser

* tests/utimes.c (errstr): New variable.
(print_ts, k_utimes): New functions.
(main): Use them to do more rigorous testing of utimes syscall parser.
* tests/gen_tests.in (utimes): Update -a option.

7 years agotests: do more rigorous testing of futimesat syscall parser
Dmitry V. Levin [Sun, 16 Apr 2017 18:47:29 +0000 (18:47 +0000)]
tests: do more rigorous testing of futimesat syscall parser

* tests/futimesat.c (errstr): New variable.
(print_ts, k_futimesat): New functions.
(main): Use them to do more rigorous testing of futimesat syscall parser.

7 years agoFix printing of inaccessible times argument of utimes and futimesat syscalls
Dmitry V. Levin [Sun, 16 Apr 2017 18:13:27 +0000 (18:13 +0000)]
Fix printing of inaccessible times argument of utimes and futimesat syscalls

When the whole pair of struct timeval structures cannot be fetched from
tracee's memory, print the address.  This behavior follows the kernel's
that uses copy_from_user for the whole pair, too.

* print_timeval.c (print_timeval_item): Remove.
(print_timeval_pair): Rename to print_timeval_utimes, all callers
updated.  Fetch the whole timeval_t array with a single
umove_or_printaddr call.
* tests/futimesat.c (main): Update expected output.
* tests/utimes.c (main): Likewise.

7 years agotests: rewrite utimensat.test without relying on libc utimensat wrapper
Dmitry V. Levin [Sun, 16 Apr 2017 17:28:00 +0000 (17:28 +0000)]
tests: rewrite utimensat.test without relying on libc utimensat wrapper

The new test also does more rigorous testing.

* tests/utimensat.c: Stop including <assert.h> and <errno.h>, include
<unistd.h> and <asm/unistd.h>, check __NR_utimensat instead
of HAVE_UTIMENSAT.
(errstr): New variable.
(k_utimensat): New function, a thin wrapper around
syscall(__NR_utimensat).
(main): Use them instead of utimensat.
* tests/gen_tests.in (utimensat): New entry.
* tests/utimensat.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove it.

7 years agotests: use fixed timestamps in utime related tests
Dmitry V. Levin [Sun, 16 Apr 2017 17:28:00 +0000 (17:28 +0000)]
tests: use fixed timestamps in utime related tests

* tests/clock.test: Remove futimesat, utime, utimensat, and utimes tests
from the list of exceptions.
* tests/utime.c (main): Do not use time(), use fixed timestamp instead.
* tests/futimesat.c (main): Do not use gettimeofday(), use fixed
timestamps instead.
* tests/utimensat.c (main): Likewise.
* tests/utimes.c (main): Likewise.

7 years agoxtensa: wire up new syscalls
Dmitry V. Levin [Sat, 15 Apr 2017 13:28:23 +0000 (13:28 +0000)]
xtensa: wire up new syscalls

* linux/xtensa/syscallent.h [348..350]: New pkey_* entries.

Reported-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>
7 years agoUpdate statx parser and syscall entries lists to the upstream
Victor Krapivensky [Sat, 15 Apr 2017 08:43:12 +0000 (11:43 +0300)]
Update statx parser and syscall entries lists to the upstream

* linux/32/syscallent.h [291]: Add statx entry.
* linux/64/syscallent.h [291]: Likewise.
* linux/arm/syscallent.h [397]: Likewise.
* linux/m68k/syscallent.h [379]: Likewise.
* linux/mips/syscallent-n32.h [6330]: Likewise.
* linux/mips/syscallent-n64.h [5326]: Likewise.
* linux/mips/syscallent-o32.h [4366]: Likewise.
* linux/powerpc/syscallent.h [383]: Likewise.
* linux/s390/syscallent.h [379]: Likewise.
* linux/s390x/syscallent.h [379]: Likewise.
* linux/xtensa/syscallent.h [351]: Likewise.
* statx.h (struct_statx): Update.
* statx.c (SYS_FUNC(statx)): Print struct_statx.stx_attributes_mask.
* tests/xstatx.c (print_stat, main): Update to test decoding
of struct_statx.stx_attributes_mask.

7 years agotests: add more regex match checks
Dmitry V. Levin [Fri, 14 Apr 2017 17:47:21 +0000 (17:47 +0000)]
tests: add more regex match checks

* tests/qual_syscall.test: Add regex match checks.

7 years agotests: make mq_sendrecv* test executables reenterable
Dmitry V. Levin [Fri, 14 Apr 2017 16:43:18 +0000 (16:43 +0000)]
tests: make mq_sendrecv* test executables reenterable

* tests/mq_sendrecv.c (MQ_NAME): Remove.
(mq_name): New static variable.
(cleanup): Use it instead of MQ_NAME.
(main): Initialize it dynamically using the pid of process.  Use it
instead of MQ_NAME.

7 years agotests: make mq test executable reenterable
Dmitry V. Levin [Fri, 14 Apr 2017 16:25:05 +0000 (16:25 +0000)]
tests: make mq test executable reenterable

* tests/mq.c (NAME): Remove.
(main): Replace the fixed message queue name with a dynamically
made name containing the pid of process.
* tests/gen_tests.in (mq): Update -a option.

7 years agotests: make net-yy-netlink test executable reenterable
Dmitry V. Levin [Fri, 14 Apr 2017 15:55:21 +0000 (15:55 +0000)]
tests: make net-yy-netlink test executable reenterable

* tests/net-yy-netlink.c (main): Use getpid() instead of a fixed
magic number.

7 years agotests: tabulate shmxt.test
Dmitry V. Levin [Fri, 14 Apr 2017 15:35:21 +0000 (15:35 +0000)]
tests: tabulate shmxt.test

* tests/gen_tests.in (shmxt): New entry.
* tests/shmxt.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove shmxt.test.

7 years agoRevert "Implement -e trace=%sched option"
Dmitry V. Levin [Fri, 14 Apr 2017 15:06:42 +0000 (15:06 +0000)]
Revert "Implement -e trace=%sched option"

-e trace=%sched became redundant as -e trace=/sched does the same.

This reverts commit 811638e9c1805438a63c14f9704b8b00ac922623.

* syscall.c (TSC): Remove.
* sysent.h (TRACE_SCHED): Remove.
* qualify.c (lookup_class): Remove %sched.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TSC flag from sched* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/sched.test: Replace trace=%sched with trace=/sched.
* tests/ksysent.c (TSC): Remove.
* tests/nsyscalls.c: Likewise.

7 years agoRevert "Implement -e trace=%clock option"
Dmitry V. Levin [Fri, 14 Apr 2017 15:06:42 +0000 (15:06 +0000)]
Revert "Implement -e trace=%clock option"

-e trace=%clock became redundant as -e trace=/clock does the same.

This reverts commit 0a13d2391c413e3847b71ec0c1d38f56e353b1b5.

* syscall.c (TCL): Remove.
* sysent.h (TRACE_CLOCK): Remove.
* qualify.c (lookup_class): Remove %clock.
* strace.1 (.SS Filtering): Likewise.
* NEWS: Likewise.
* linux/32/syscallent.h: Remove TCL flag from clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: Replace trace=%clock with trace=/clock.
* tests/ksysent.c (TCL): Remove.
* tests/nsyscalls.c: Likewise.

7 years agotests: robustify regex.test
Dmitry V. Levin [Fri, 14 Apr 2017 14:53:35 +0000 (14:53 +0000)]
tests: robustify regex.test

* tests/regex.test: Use trace_statfs.test as a template instead
of clock.test and sched.test, not because of more interesting
regular expressions but to fix build on platforms where
clock.test and sched.test are not reenterable.

7 years agoImplement -e trace=/regex option
JingPiao Chen [Fri, 14 Apr 2017 04:27:08 +0000 (12:27 +0800)]
Implement -e trace=/regex option

* qualify.c: Include <regex.h>.
(qualify_syscall_regex): New function.
(qualify_syscall): Use it.
* strace.1: Document -e trace=/regex option.
* NEWS: Mention -e trace=/regex option.
* tests/regex.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/options-syntax.test: Add checks for invaild regexp
and for regexp that doesn't match a syscall.

7 years agotests: fix ioctl_nsfs.test on hppa
Dmitry V. Levin [Fri, 14 Apr 2017 01:21:19 +0000 (01:21 +0000)]
tests: fix ioctl_nsfs.test on hppa

* tests/ioctl_nsfs.c (test_user_namespace): Specify an address
in the middle of a mapped page as child_stack address argument
of the clone call.
[IA64] (clone): Update.

7 years agotests: fix ioctl_nsfs.test on ia64
Dmitry V. Levin [Fri, 14 Apr 2017 00:52:37 +0000 (00:52 +0000)]
tests: fix ioctl_nsfs.test on ia64

glibc on ia64 provides no clone() function, but there is a __clone2
function instead.  It is documented but no prototype is provided by
glibc.

* tests/ioctl_nsfs.c [IA64] (__clone2): New prototype.
[IA64] (clone): New macro wrapper around __clone2.

7 years agotests: check decoding of the remaining V4L2_BUF_TYPE_* types
Edgar Kaziahmedov [Thu, 13 Apr 2017 23:39:04 +0000 (02:39 +0300)]
tests: check decoding of the remaining V4L2_BUF_TYPE_* types

* tests/ioctl_v4l2.c (init_v4l2_format, print_ioctl_v4l2): New functions
to avoid code duplication in VIDIOC_S_FMT and VIDIOC_TRY_FMT tests.
(main) <VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT>: Use them.  Add
checks for remaining V4L2_BUF_TYPE_* types.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
7 years agov4l2: Implement decoding of the remaining V4L2_BUF_TYPE_* types
Edgar Kaziahmedov [Thu, 13 Apr 2017 23:39:03 +0000 (02:39 +0300)]
v4l2: Implement decoding of the remaining V4L2_BUF_TYPE_* types

* v4l2.c: Include "xlat/v4l2_vbi_flags.h" and "xlat/v4l2_sliced_flags.h".
(struct_v4l2_clip): New typedef.  Mpersify it.
(print_v4l2_clip): New function.
(print_v4l2_format_fmt): Use it.  Add struct tcb argument.  Implement
decoding of the remaining V4L2_BUF_TYPE_* types.
* xlat/v4l2_vbi_flags.in: Add V4L2_VBI_UNSYNC and V4L2_VBI_INTERLACED
introduced by linux kernel commit v2.5.46~39^2~23^2~4.
Add V4L2_VBI_ITU_525_F1_START, V4L2_VBI_ITU_525_F2_START,
V4L2_VBI_ITU_625_F1_START, and V4L2_VBI_ITU_625_F2_START introduced by
linux kernel commit v3.17-rc1~112^2~217.
* xlat/v4l2_sliced_flags.in: Add V4L2_SLICED_TELETEXT_B, V4L2_SLICED_VPS,
V4L2_SLICED_CAPTION_525, V4L2_SLICED_WSS_625, V4L2_SLICED_VBI_525, and
V4L2_SLICED_VBI_625 introduced by linux kernel commit v2.6.14-rc2~64.
* configure.ac (AC_CHECK_DECLS): Add V4L2_BUF_TYPE_SDR_CAPTURE and
V4L2_BUF_TYPE_SDR_OUTPUT.
(AC_CHECK_MEMBERS): Add struct v4l2_window.global_alpha and
struct v4l2_sdr_format.buffersize.
* NEWS: Mention this change.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
7 years agotravis: use mainline kernel uapi headers for coverage
Dmitry V. Levin [Thu, 13 Apr 2017 18:24:09 +0000 (18:24 +0000)]
travis: use mainline kernel uapi headers for coverage

* .travis.yml (matrix) <CHECK=coverage>: Add KHEADERS=torvalds/linux.
* travis-build.sh: Handle $KHEADERS.
* travis-install.sh: Likewise.

7 years agotravis: switch from clang-3.6 to clang-3.8
Dmitry V. Levin [Thu, 13 Apr 2017 18:24:09 +0000 (18:24 +0000)]
travis: switch from clang-3.6 to clang-3.8

* .travis.yml (matrix): Change clang-3.6 to clang-3.8.

7 years agoImplement decoding of NS_* ioctl commands
Nikolay Marchuk [Thu, 13 Apr 2017 15:10:11 +0000 (22:10 +0700)]
Implement decoding of NS_* ioctl commands

* configure.ac (AC_CHECK_HEADERS): Add linux/nsfs.h.
* defs.h (DECL_IOCTL(nsfs)): New prototype.
(setns_types): Make global.
* ioctl.c (ioctl_decode): Call nsfs_ioctl for 0xb7 code.
* nsfs.c: New file.
* nsfs.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* tests/ioctl_nsfs.c: New file.
* tests/ioctl_nsfs.test: Likewise.
* tests/.gitignore: Add ioctl_nsfs.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_nsfs.test.
* NEWS: Mention this change.

7 years agotravis: copy coverage test suite log to the travis log
Dmitry V. Levin [Thu, 13 Apr 2017 04:43:46 +0000 (04:43 +0000)]
travis: copy coverage test suite log to the travis log

* travis-build.sh (coverage): Print tests*/test-suite.log
and tests*/ksysent.log.

7 years agotravis: add gcc-6
Dmitry V. Levin [Wed, 12 Apr 2017 03:06:32 +0000 (03:06 +0000)]
travis: add gcc-6

* .travis.yml (matrix): Add gcc-6 entries.
* travis-build.sh: Handle gcc*.
* travis-install.sh: Handle gcc-*.

7 years agotests: robustify gen_tests.sh against in-tree builds
Dmitry V. Levin [Tue, 11 Apr 2017 06:55:51 +0000 (06:55 +0000)]
tests: robustify gen_tests.sh against in-tree builds

* tests/gen_tests.sh: Use abs_srcdir instead of srcdir to construct
a path to gen_tests.sh in implicit make rules.

7 years agotrace_syscall_exiting: do not call get_regs for filtered syscalls
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
trace_syscall_exiting: do not call get_regs for filtered syscalls

This saves up to 25% of ptrace syscalls in case of trace filtering.

* syscall.c (trace_syscall_exiting): Do not call gettimeofday
and get_regs for filtered syscalls.
* NEWS: Mention this change.
* tests/get_regs.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.

7 years agoDelay get_regs invocation
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
Delay get_regs invocation

strace used to call get_regs on every stop of a tracee, including cases
when the result is going to be discarded.  Prepare to change this lavish
practice by delaying get_regs invocation until its result is actually
needed.

* defs.h (get_regs): Remove.
* strace.c (trace): Do not call get_regs.
* syscall.c (get_regs): Add static qualifier.
(trace_syscall_exiting, print_pc, get_scno): Call get_regs.

7 years agostartup_tcb: move get_scno invocation to a more convenient place
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
startup_tcb: move get_scno invocation to a more convenient place

* strace.c (trace): Move get_scno invocation ...
(startup_tcb): ... here.  This is a no-op change that slightly improves
readability.

7 years agoget_regs: guard against subsequent invocations
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
get_regs: guard against subsequent invocations

At this moment there is only one call to get_regs,
but there is going to be more of them, so a guard is needed.

This change also adds a clear_regs call before get_regs,
which essentially reverts commit v4.9-288-ge9bfff6.

* strace.c (trace): Call clear_regs before get_regs.
* syscall.c (get_regs): Skip if get_regs_error != -1.

7 years agosyscall: move definitions of automatic variables closer to their use
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
syscall: move definitions of automatic variables closer to their use

* syscall.c (trace_syscall_entering, trace_syscall_exiting): Move
definitions of automatic variables closer to their first use.  This
change slightly improves readability.

7 years agotests: check decoding of gettid syscall
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
tests: check decoding of gettid syscall

* tests/gettid.c: New file.
* tests/.gitignore: Add gettid.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (gettid): New entry.

7 years agotests: fix build on alpha
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
tests: fix build on alpha

* tests/getpid.c: Skip if __NR_getpid is not defined.
* tests/getppid.c: Skip if __NR_getppid is not defined.

Fixes: fd1041f6 ("tests: add tests for getpid and getppid syscalls")
7 years agoFix build with old linux/netlink.h
Dmitry V. Levin [Tue, 11 Apr 2017 04:04:37 +0000 (04:04 +0000)]
Fix build with old linux/netlink.h

* socketutils.c: Provide a fallback definition of NETLINK_SOCK_DIAG.

Fixes: 5c256356 ("Do not include xlat/netlink_protocols.h twice")
7 years agoDo not include xlat/netlink_protocols.h twice
Dmitry V. Levin [Mon, 10 Apr 2017 00:20:34 +0000 (00:20 +0000)]
Do not include xlat/netlink_protocols.h twice

Make netlink_protocols a global xlat array defined in net.c file.

* defs.h (netlink_protocols): New prototype.
* socketutils.c: Stop including "xlat/netlink_protocols.h".

7 years agoDo not include xlat/clocknames.h twice
Dmitry V. Levin [Mon, 10 Apr 2017 00:20:34 +0000 (00:20 +0000)]
Do not include xlat/clocknames.h twice

Make clocknames a global xlat array defined in time.c file.

* defs.h (clocknames): New prototype.
* perf.c: Stop including "xlat/clocknames.h".

7 years agoRemove unused xlat/openmodessol.in
Dmitry V. Levin [Sun, 9 Apr 2017 23:18:20 +0000 (23:18 +0000)]
Remove unused xlat/openmodessol.in

* xlat/openmodessol.in: Remove file unused since commit
v4.10-45-gdf4dd8b.

7 years agoRemove unused xlat/aclipc.in
Dmitry V. Levin [Sat, 8 Apr 2017 00:16:52 +0000 (00:16 +0000)]
Remove unused xlat/aclipc.in

* xlat/aclipc.in: Remove file unused since commit v4.9-46-g681452b.

7 years agotests: remove statfs.expected
Dmitry V. Levin [Fri, 7 Apr 2017 00:03:31 +0000 (00:03 +0000)]
tests: remove statfs.expected

statfs.expected is unused since commit v4.11-515-g67c2f67.

* tests/statfs.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.

7 years agotests: add tests for getpid and getppid syscalls
Sandhya Bankar [Sun, 2 Apr 2017 21:22:35 +0000 (02:52 +0530)]
tests: add tests for getpid and getppid syscalls

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
[ldv: rewritten everything]

* tests/getpid.c: New file.
* tests/getppid.c: Likewise.
* tests/.gitignore: Add getpid and getppid.
* tests/pure_executables.list: Likewise.
* tests/Makefile.am (check_PROGRAMS): Likewise.
* tests/gen_tests.in (getpid, getppid): New entries.

7 years agoUpdate V4L2_* constants
Edgar Kaziahmedov [Thu, 6 Apr 2017 01:35:00 +0000 (04:35 +0300)]
Update V4L2_* constants

* xlat/v4l2_buf_flags.in: Add V4L2_BUF_FLAG_PREPARED,
V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, and V4L2_BUF_FLAG_NO_CACHE_CLEAN
introduced by linux kernel commit v3.2-rc1~63^2~55.
Add V4L2_BUF_FLAG_TIMESTAMP_MASK, V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,
and V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC introduced by linux kernel commit
v3.9-rc1~93^2~536.
Add V4L2_BUF_FLAG_TIMESTAMP_COPY introduced by linux kernel commit
v3.10-rc1~136^2~560.
Add V4L2_BUF_FLAG_TSTAMP_SRC_MASK, V4L2_BUF_FLAG_TSTAMP_SRC_EOF,
and V4L2_BUF_FLAG_TSTAMP_SRC_SOE introduced by linux kernel commit
v3.15-rc1~85^2~186.
Add V4L2_BUF_FLAG_LAST introduced by linux kernel commit
v4.2-rc1~107^2~389.
* xlat/v4l2_buf_types.in: Add V4L2_BUF_TYPE_SDR_CAPTURE
and V4L2_BUF_TYPE_SDR_OUTPUT introduced by linux kernel commits
v3.15-rc1~85^2~213 and v4.4-rc1~118^2~14, respectively.
* xlat/xlat/v4l2_colorspaces.in: Add V4L2_COLORSPACE_ADOBERGB
and V4L2_COLORSPACE_BT2020 introduced by linux kernel commit
v3.19-rc1~29^2~72.
Add V4L2_COLORSPACE_RAW and V4L2_COLORSPACE_DCI_P3 introduced by linux
kernel commits v4.2-rc1~107^2~182 and v4.4-rc1~118^2~120, respectively.
* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_SDR_CAPTURE,
V4L2_CAP_EXT_PIX_FORMAT, and V4L2_CAP_SDR_OUTPUT introduced by linux
kernel commits v3.15-rc1~85^2~210, v3.17-rc1~112^2~327,
and v4.4-rc1~118^2~14, respectively.
* xlat/v4l2_memories.in: Add V4L2_MEMORY_OVERLAY introduced
in linux 2.5.46.  Add V4L2_MEMORY_DMABUF introduced by linux kernel
commit v3.8-rc1~115^2^2~52.

Signed-off-by: Edgar Kaziahmedov <edos@linux.com>
7 years agoImplement -e trace=%statfs option
Abhishek Tiwari [Wed, 29 Mar 2017 09:03:34 +0000 (14:33 +0530)]
Implement -e trace=%statfs option

linux/*/syscallent*.h part is modified automatically by:

sed -i 's/TF\(,[[:space:]]*SEN.*[_"]statv\?fs\)/TF|TSF\1/' \
linux/*/syscallent*.h

[ldv: rewritten trace_statfs.test using sched.test as a template]

* sysent.h (TRACE_STATFS): New macro.
* syscall.c: Alias TSF to TRACE_STATFS around syscallent.h inclusion.
* qualify.c (lookup_class): Add SCHED_STATFS for "%statfs".
* strace.1 (.SS Filtering): Add information about %statfs syscall class.
* NEWS: Mention this change.
* linux/64/syscallent.h (statfs): Add TSF flag.
* linux/aarch64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/32/syscallent.h (statfs64): Likewise.
* linux/arm/syscallent.h (statfs, statfs64): Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs): Likewise.
* linux/mips/syscallent-compat.h (*_statfs, *_statvfs): Likewise.
* tests/trace_statfs.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TSF): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agoImplement -e trace=%clock option
Rishi Bhatt [Mon, 27 Mar 2017 22:01:24 +0000 (03:31 +0530)]
Implement -e trace=%clock option

linux/*/syscallent.h part is modified automatically by
sed -i 's/0\(,[[:space:]]*SEN(clock_\)/TCL\1/' linux/*/syscallent*.h

[ldv: rewritten clock.test using sched.test as a template]

* sysent.h (TRACE_CLOCK): New macro.
* syscall.c: Alias TCL to TRACE_CLOCK around syscallent.h inclusion.
* qualify.c (lookup_class): Add TRACE_CLOCK for "%clock".
* strace.1 (.SS Filtering): Add information about %clock syscall class.
* NEWS: Mention this change.
* linux/32/syscallent.h: Add TCL flag for clock_* syscalls.
* linux/64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/crisv10/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* tests/clock.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
* tests/ksysent.c (TCL): New macro, defined to 0.
* tests/nsyscalls.c: Likewise.

7 years agotests: tabulate xattr.test
Dmitry V. Levin [Thu, 6 Apr 2017 22:22:50 +0000 (22:22 +0000)]
tests: tabulate xattr.test

* tests/gen_tests.in (xattr): New entry.
* tests/xattr.test: Remove.
* tests/Makefile.am (DECODER_TESTS): Remove xattr.test.

7 years agotests: generalize scripts that check non-abbreviated decoding of ioctls
Dmitry V. Levin [Wed, 5 Apr 2017 00:44:30 +0000 (00:44 +0000)]
tests: generalize scripts that check non-abbreviated decoding of ioctls

* tests/ioctl-v.sh: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
(DECODER_TESTS): Remove ioctl_evdev-v.test, ioctl_loop-v.test,
and ioctl_rtc-v.test.
* tests/gen_tests.in (ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v):
New entries.
* tests/ioctl_evdev-v.test: Remove.
* tests/ioctl_loop-v.test: Ditto.
* tests/ioctl_rtc-v.test: Ditto.

7 years agotests: tabulate stereotypical test scripts
Dmitry V. Levin [Wed, 5 Apr 2017 00:37:54 +0000 (00:37 +0000)]
tests: tabulate stereotypical test scripts

Convert test scripts that follow simple testing patterns to a table.
Generate all these scripts from gen_tests.in file using gen_tests.sh
script at bootstrap time.

The largest set of test scripts has been converted using
the following command:

grep -l ^run_strace_match_diff *.test |while read f; do
n="${f%.test}"
grep '^[^#]' "$f" |
grep -Evq '^(\. "\${srcdir=\.}/init\.sh"|run_strace_match_diff)' ||
sed -n 's/^run_strace_match_diff\(.*\)/'$n'\1/p' "$f"
done

The second largest set of test scripts has been converted using
the following command:

grep -l srcdir= *.test |while read f; do
n="${f%.test}"
grep '^[^#]' "$f" |
grep -Fvq srcdir= ||
sed -n 's/^. "\${srcdir=.}\/\([^"]\+\)".*/'$n'\t+\1/p' "$f"
done

* tests/gen_tests.in: New file.
* tests/gen_tests.sh: New file.
* bootstrap: Invoke it.
* tests/.gitignore: Add *.gen.test and gen_tests.am.
* tests/_newselect.test: Remove.
* tests/accept.test: Ditto.
* tests/accept4.test: Ditto.
* tests/access.test: Ditto.
* tests/acct.test: Ditto.
* tests/add_key.test: Ditto.
* tests/adjtimex.test: Ditto.
* tests/aio.test: Ditto.
* tests/alarm.test: Ditto.
* tests/bpf.test: Ditto.
* tests/btrfs.test: Ditto.
* tests/chmod.test: Ditto.
* tests/chown.test: Ditto.
* tests/chown32.test: Ditto.
* tests/chroot.test: Ditto.
* tests/clock_adjtime.test: Ditto.
* tests/clock_nanosleep.test: Ditto.
* tests/clock_xettime.test: Ditto.
* tests/copy_file_range.test: Ditto.
* tests/creat.test: Ditto.
* tests/delete_module.test: Ditto.
* tests/dup.test: Ditto.
* tests/dup2.test: Ditto.
* tests/dup3.test: Ditto.
* tests/epoll_create.test: Ditto.
* tests/epoll_create1.test: Ditto.
* tests/epoll_ctl.test: Ditto.
* tests/epoll_pwait.test: Ditto.
* tests/epoll_wait.test: Ditto.
* tests/erestartsys.test: Ditto.
* tests/execveat-v.test: Ditto.
* tests/execveat.test: Ditto.
* tests/faccessat.test: Ditto.
* tests/fadvise64_64.test: Ditto.
* tests/fallocate.test: Ditto.
* tests/fanotify_init.test: Ditto.
* tests/fanotify_mark.test: Ditto.
* tests/fchdir.test: Ditto.
* tests/fchmod.test: Ditto.
* tests/fchmodat.test: Ditto.
* tests/fchown.test: Ditto.
* tests/fchown32.test: Ditto.
* tests/fchownat.test: Ditto.
* tests/fcntl.test: Ditto.
* tests/fcntl64.test: Ditto.
* tests/fdatasync.test: Ditto.
* tests/file_handle.test: Ditto.
* tests/file_ioctl.test: Ditto.
* tests/finit_module.test: Ditto.
* tests/flock.test: Ditto.
* tests/fork-f.test: Ditto.
* tests/fstat64.test: Ditto.
* tests/fstatat64.test: Ditto.
* tests/fstatfs.test: Ditto.
* tests/fstatfs64.test: Ditto.
* tests/fsync.test: Ditto.
* tests/ftruncate.test: Ditto.
* tests/ftruncate64.test: Ditto.
* tests/futimesat.test: Ditto.
* tests/get_mempolicy.test: Ditto.
* tests/getcpu.test: Ditto.
* tests/getcwd.test: Ditto.
* tests/getdents.test: Ditto.
* tests/getdents64.test: Ditto.
* tests/getegid.test: Ditto.
* tests/getegid32.test: Ditto.
* tests/geteuid.test: Ditto.
* tests/geteuid32.test: Ditto.
* tests/getgid.test: Ditto.
* tests/getgid32.test: Ditto.
* tests/getgroups.test: Ditto.
* tests/getgroups32.test: Ditto.
* tests/getpeername.test: Ditto.
* tests/getpgrp.test: Ditto.
* tests/getrandom.test: Ditto.
* tests/getresgid.test: Ditto.
* tests/getresgid32.test: Ditto.
* tests/getresuid.test: Ditto.
* tests/getresuid32.test: Ditto.
* tests/getrlimit.test: Ditto.
* tests/getrusage.test: Ditto.
* tests/getsid.test: Ditto.
* tests/getsockname.test: Ditto.
* tests/getuid32.test: Ditto.
* tests/getxxid.test: Ditto.
* tests/inet-cmsg.test: Ditto.
* tests/init_module.test: Ditto.
* tests/inotify.test: Ditto.
* tests/inotify_init1.test: Ditto.
* tests/int_0x80.test: Ditto.
* tests/ioctl_block.test: Ditto.
* tests/ioctl_evdev.test: Ditto.
* tests/ioctl_loop.test: Ditto.
* tests/ioctl_mtd.test: Ditto.
* tests/ioctl_rtc.test: Ditto.
* tests/ioctl_scsi.test: Ditto.
* tests/ioctl_sg_io_v3.test: Ditto.
* tests/ioctl_sg_io_v4.test: Ditto.
* tests/ioctl_uffdio.test: Ditto.
* tests/ioctl_v4l2.test: Ditto.
* tests/ioperm.test: Ditto.
* tests/iopl.test: Ditto.
* tests/ioprio.test: Ditto.
* tests/ip_mreq.test: Ditto.
* tests/ipc.test: Ditto.
* tests/ipc_msg.test: Ditto.
* tests/ipc_sem.test: Ditto.
* tests/ipc_shm.test: Ditto.
* tests/kcmp.test: Ditto.
* tests/kexec_file_load.test: Ditto.
* tests/kexec_load.test: Ditto.
* tests/keyctl.test: Ditto.
* tests/kill.test: Ditto.
* tests/lchown.test: Ditto.
* tests/lchown32.test: Ditto.
* tests/link.test: Ditto.
* tests/linkat.test: Ditto.
* tests/lookup_dcookie.test: Ditto.
* tests/lstat.test: Ditto.
* tests/lstat64.test: Ditto.
* tests/mbind.test: Ditto.
* tests/membarrier.test: Ditto.
* tests/memfd_create.test: Ditto.
* tests/migrate_pages.test: Ditto.
* tests/mincore.test: Ditto.
* tests/mkdir.test: Ditto.
* tests/mkdirat.test: Ditto.
* tests/mknod.test: Ditto.
* tests/mknodat.test: Ditto.
* tests/mlock.test: Ditto.
* tests/mlock2.test: Ditto.
* tests/mlockall.test: Ditto.
* tests/mmap64.test: Ditto.
* tests/mmsg-silent.test: Ditto.
* tests/mmsg.test: Ditto.
* tests/mmsg_name-v.test: Ditto.
* tests/mmsg_name.test: Ditto.
* tests/mount.test: Ditto.
* tests/move_pages.test: Ditto.
* tests/mq.test: Ditto.
* tests/mq_sendrecv-read.test: Ditto.
* tests/mq_sendrecv-write.test: Ditto.
* tests/mq_sendrecv.test: Ditto.
* tests/msg_control-v.test: Ditto.
* tests/msg_control.test: Ditto.
* tests/msg_name.test: Ditto.
* tests/munlockall.test: Ditto.
* tests/nanosleep.test: Ditto.
* tests/net-icmp_filter.test: Ditto.
* tests/net-sockaddr.test: Ditto.
* tests/newfstatat.test: Ditto.
* tests/old_mmap.test: Ditto.
* tests/oldfstat.test: Ditto.
* tests/oldlstat.test: Ditto.
* tests/oldstat.test: Ditto.
* tests/open.test: Ditto.
* tests/openat.test: Ditto.
* tests/pause.test: Ditto.
* tests/perf_event_open.test: Ditto.
* tests/perf_event_open_nonverbose.test: Ditto.
* tests/perf_event_open_unabbrev.test: Ditto.
* tests/pipe2.test: Ditto.
* tests/pkey_alloc.test: Ditto.
* tests/pkey_free.test: Ditto.
* tests/pkey_mprotect.test: Ditto.
* tests/ppoll-v.test: Ditto.
* tests/ppoll.test: Ditto.
* tests/preadv-pwritev.test: Ditto.
* tests/preadv.test: Ditto.
* tests/preadv2-pwritev2.test: Ditto.
* tests/printstr.test: Ditto.
* tests/prlimit64.test: Ditto.
* tests/process_vm_readv.test: Ditto.
* tests/process_vm_writev.test: Ditto.
* tests/pselect6.test: Ditto.
* tests/ptrace.test: Ditto.
* tests/pwritev.test: Ditto.
* tests/quotactl-v.test: Ditto.
* tests/quotactl-xfs-v.test: Ditto.
* tests/quotactl-xfs.test: Ditto.
* tests/quotactl.test: Ditto.
* tests/readahead.test: Ditto.
* tests/readdir.test: Ditto.
* tests/readlink.test: Ditto.
* tests/readlinkat.test: Ditto.
* tests/reboot.test: Ditto.
* tests/recvfrom.test: Ditto.
* tests/recvmmsg-timeout.test: Ditto.
* tests/recvmsg.test: Ditto.
* tests/remap_file_pages.test: Ditto.
* tests/rename.test: Ditto.
* tests/renameat.test: Ditto.
* tests/renameat2.test: Ditto.
* tests/request_key.test: Ditto.
* tests/rmdir.test: Ditto.
* tests/rt_sigpending.test: Ditto.
* tests/rt_sigprocmask.test: Ditto.
* tests/rt_sigqueueinfo.test: Ditto.
* tests/rt_sigreturn.test: Ditto.
* tests/rt_sigsuspend.test: Ditto.
* tests/rt_sigtimedwait.test: Ditto.
* tests/rt_tgsigqueueinfo.test: Ditto.
* tests/sched_get_priority_mxx.test: Ditto.
* tests/sched_rr_get_interval.test: Ditto.
* tests/sched_xetaffinity.test: Ditto.
* tests/sched_xetattr.test: Ditto.
* tests/sched_xetparam.test: Ditto.
* tests/sched_xetscheduler.test: Ditto.
* tests/sched_yield.test: Ditto.
* tests/seccomp-filter-v.test: Ditto.
* tests/seccomp-filter.test: Ditto.
* tests/select.test: Ditto.
* tests/semop.test: Ditto.
* tests/sendfile.test: Ditto.
* tests/sendfile64.test: Ditto.
* tests/set_mempolicy.test: Ditto.
* tests/setdomainname.test: Ditto.
* tests/setfsgid.test: Ditto.
* tests/setfsgid32.test: Ditto.
* tests/setfsuid.test: Ditto.
* tests/setfsuid32.test: Ditto.
* tests/setgid.test: Ditto.
* tests/setgid32.test: Ditto.
* tests/setgroups.test: Ditto.
* tests/setgroups32.test: Ditto.
* tests/sethostname.test: Ditto.
* tests/setns.test: Ditto.
* tests/setregid.test: Ditto.
* tests/setregid32.test: Ditto.
* tests/setresgid.test: Ditto.
* tests/setresgid32.test: Ditto.
* tests/setresuid.test: Ditto.
* tests/setresuid32.test: Ditto.
* tests/setreuid.test: Ditto.
* tests/setreuid32.test: Ditto.
* tests/setrlimit.test: Ditto.
* tests/setuid.test: Ditto.
* tests/setuid32.test: Ditto.
* tests/shutdown.test: Ditto.
* tests/siginfo.test: Ditto.
* tests/signal_receive.test: Ditto.
* tests/signalfd4.test: Ditto.
* tests/sigreturn.test: Ditto.
* tests/socketcall.test: Ditto.
* tests/splice.test: Ditto.
* tests/stat.test: Ditto.
* tests/stat64.test: Ditto.
* tests/statfs64.test: Ditto.
* tests/statx.sh: Ditto.
* tests/statx.test: Ditto.
* tests/swap.test: Ditto.
* tests/symlink.test: Ditto.
* tests/symlinkat.test: Ditto.
* tests/sync.test: Ditto.
* tests/sync_file_range.test: Ditto.
* tests/sync_file_range2.test: Ditto.
* tests/sysinfo.test: Ditto.
* tests/syslog.test: Ditto.
* tests/tee.test: Ditto.
* tests/time.test: Ditto.
* tests/timer_create.test: Ditto.
* tests/timer_xettime.test: Ditto.
* tests/timerfd_xettime.test: Ditto.
* tests/times-fail.test: Ditto.
* tests/times.test: Ditto.
* tests/truncate.test: Ditto.
* tests/truncate64.test: Ditto.
* tests/ugetrlimit.test: Ditto.
* tests/umask.test: Ditto.
* tests/umoven-illptr.test: Ditto.
* tests/umovestr-illptr.test: Ditto.
* tests/umovestr3.test: Ditto.
* tests/unlink.test: Ditto.
* tests/unlinkat.test: Ditto.
* tests/unshare.test: Ditto.
* tests/userfaultfd.test: Ditto.
* tests/ustat.test: Ditto.
* tests/utime.test: Ditto.
* tests/utimes.test: Ditto.
* tests/vfork-f.test: Ditto.
* tests/vhangup.test: Ditto.
* tests/vmsplice.test: Ditto.
* tests/wait4-v.test: Ditto.
* tests/wait4.test: Ditto.
* tests/waitid-v.test: Ditto.
* tests/waitid.test: Ditto.
* tests/waitpid.test: Ditto.
* tests/xattr-strings.test: Ditto.
* tests/xet_robust_list.test: Ditto.
* tests/xetitimer.test: Ditto.
* tests/xetpgid.test: Ditto.
* tests/xetpriority.test: Ditto.
* tests/xettimeofday.test: Ditto.
* tests/Makefile.am (DECODER_TESTS, MISC_TESTS): Remove them.
Include gen_tests.am.
(TESTS): Add $(GEN_TESTS).
(XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Rename int_0x80.test
to int_0x80.gen.test.
(EXTRA_DIST): Add gen_tests.in and gen_tests.sh, remove statx.sh.
(clean-local-check): Remove $(GEN_TESTS:.gen.test=.dir).

7 years agotests: handle test scripts with .gen.test suffix
Dmitry V. Levin [Tue, 4 Apr 2017 18:03:45 +0000 (18:03 +0000)]
tests: handle test scripts with .gen.test suffix

* tests/init.sh: If script name ends with .gen.test,
set NAME variable with .gen.test suffix stripped.

7 years agompers.awk: add support for multidimensional arrays
Eugene Syromyatnikov [Tue, 4 Apr 2017 03:08:20 +0000 (05:08 +0200)]
mpers.awk: add support for multidimensional arrays

* mpers.awk (update_upper_bound): New function, which maintains new "count"
property for storing total element count and updates "upper_bound"
property which now contains string with array dimensions.
(/^DW_AT_upper_bound/, /^DW_AT_count/): Use it.
(what_is) <case "array_type">: Use "count" property in order to calculate
returned_size, do not embody returned string in square brackets.
* mpers_test.sh: Add checks for multidimensional arrays.

7 years agompers.awk: prepare for adding support of multidimensional arrays
Dmitry V. Levin [Tue, 4 Apr 2017 01:39:56 +0000 (01:39 +0000)]
mpers.awk: prepare for adding support of multidimensional arrays

* mpers.awk (what_is) <case "structure_type", case "union_type">:
Move formatting of array upper_bound ...
<case "array_type">: ... here.

7 years agotests: cleanup temporary files removals
Dmitry V. Levin [Mon, 3 Apr 2017 16:24:28 +0000 (16:24 +0000)]
tests: cleanup temporary files removals

As every test now runs in its own subdirectory, there is no need
to remove leftover files manually by each test.

* tests/init.sh (run_strace_match_diff): Do not remove $EXP.
* tests/brk.test: Likewise.
* tests/options-syntax.test: Likewise.
* tests/qual_inject-retval.test (check_injection): Likewise.
* tests/qual_signal.test (test_one_sig): Likewise.
* tests/sched.test: Likewise.
* tests/seccomp-strict.test: Likewise.
* tests/strace-V.test: Likewise.
* tests/strace-tt.test: Likewise.
* tests/strace-ttt.test: Likewise.
* tests/threads-execve.test: Likewise.
* tests/attach-f-p.test: Use $EXP instead of $OUT, do not remove it.
* tests/personality.test: Likewise.
* tests/poll.test: Likewise.
* tests/fstat.test: Likewise.
* tests/ipc.sh: Likewise.
* tests/restart_syscall.test: Likewise.
* tests/utimensat.test: Likewise.
* tests/attach-p-cmd.test: Likewise.  Do not remove
attach-p-cmd.test-lock.
* tests/detach-running.test: Do not remove $LOG.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
* tests/redirect.test: Do not remove $OUT.
* tests/strace-S.test: Likewise.
* tests/getdents.test: Do not remove $LOG.dir.
* tests/getdents64.test: Likewise.
* tests/readdir.test: Likewise.
* tests/btrfs-v.test: Do not remove $EXP and $OUT.
* tests/btrfs-vw.test: Likewise.
* tests/btrfs-w.test: Likewise.
* tests/execve-v.test: Likewise.
* tests/execve.test: Likewise.
* tests/fadvise64.test: Likewise.
* tests/getuid.test: Likewise.
* tests/ioctl.test: Likewise.
* tests/ioctl_dm-v.test: Likewise.
* tests/ioctl_dm.test: Likewise.
* tests/ioctl_evdev-v.test: Likewise.
* tests/ioctl_loop-nv.test: Likewise.
* tests/ioctl_loop-v.test: Likewise.
* tests/ioctl_loop.test: Likewise.
* tests/ioctl_rtc-v.test: Likewise.
* tests/ioctl_sock_gifconf.test: Likewise.
* tests/llseek.test: Likewise.
* tests/lseek.test: Likewise.
* tests/mmap.test: Likewise.
* tests/net-y-unix.test: Likewise.
* tests/net-yy-inet.test: Likewise.
* tests/net-yy-netlink.test: Likewise.
* tests/net-yy-unix.test: Likewise.
* tests/opipe.test: Likewise.
* tests/prctl-arg2-intptr.test: Likewise.
* tests/prctl-dumpable.test: Likewise.
* tests/prctl-name.test: Likewise.
* tests/prctl-no-args.test: Likewise.
* tests/prctl-pdeathsig.test: Likewise.
* tests/prctl-seccomp-filter-v.test: Likewise.
* tests/prctl-seccomp-strict.test: Likewise.
* tests/prctl-securebits.test: Likewise.
* tests/prctl-tid_address.test: Likewise.
* tests/prctl-tsc.test: Likewise.
* tests/umovestr2.test: Likewise.
* tests/uname.test: Likewise.
* tests/pread64-pwrite64.test: Do nore remove pread64-pwrite64-tmpfile.
* tests/read-write.test: Do nore remove read-write-tmpfile.
* tests/qual_fault.test (check_fault_injection): Do not remove $EXP,
$outexp, and $outgot.
* tests/redirect-fds.test (check_fd): Reorder removal of work files.
* tests/pc.test: Use $EXP instead of $EXPECTED, do not remove it.
* tests/strace-t.test: Likewise.
* tests/scm_rights-fd.test: Likewise.  Use dir instead of $LOG.dir,
do not remove it.
* tests/strace-ff.test: Do not remove $OUT and $LOG.* files.