Commit Graph

1149 Commits

Author SHA1 Message Date
7519e54937 tests: rewrite ppoll syscall decoding check from match_grep to match_diff
Unlike the former test that was based on match_grep,
the new one uses match_diff and does more rigorous testing.

* tests/ppoll-v.c: New file.
* tests/ppoll-v.test: New test.
* tests/ppoll.c: Rewrite.
* tests/ppoll.test: Likewise.
* tests/ppoll.expected: Remove.
* tests/ppoll-v.expected: Remove.
* tests/.gitignore: Add ppoll-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ppoll-v.test.
(EXTRA_DIST): Remove ppoll.expected and ppoll-v.expected.
2017-02-21 22:39:45 +00:00
667b764c41 tests: move get_sigset_size function to libtests
* tests/get_sigset_size.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (get_sigset_size): New prototype.
* tests/ptrace.c: Do not check for __NR_rt_sigprocmask.
(main): Use get_sigset_size.
* tests/signalfd4.c: Do not check for __NR_rt_sigprocmask.
(get_sigset_size): Remove.
2017-02-20 00:10:35 +00:00
556652be53 sched: enhance decoding of sched_setattr syscall
Implement read/write semantics of struct sched_attr.size argument
of sched_setattr syscall.  Do not print members of struct sched_attr
besides sched_attr.size when the specified structure size is less than
the minimal size allowed by the kernel.

* sched.c (print_sched_attr): Fetch struct sched_attr.size and use it
as the structure size.  Print struct sched_attr.size only when the
structure size is less than SCHED_ATTR_MIN_SIZE.
(SYS_FUNC(sched_setattr)): Call print_sched_attr with zero size
argument.  Print struct sched_attr.size returned by the kernel
on exiting syscall in case of E2BIG. Print the last syscall argument
on exiting syscall.
(SYS_FUNC(sched_getattr)): Do not call print_sched_attr with zero size
argument.
* NEWS: Mention it.
* tests/sched_xetattr.c (main): Check it.
2017-02-19 00:31:40 +00:00
f31755fda2 tests: check decoding of sched_[gs]etattr corner cases
* tests/sched_xetattr.c (main): Check that integer arguments
of sched_getattr and sched_setattr syscalls are decoded properly
by adding a few cases with filled higher 32 bits.
Check that pointer argument is decoded properly
on F8ILL_KULONG_SUPPORTED architectures.
2017-02-18 09:58:52 +00:00
3e80074350 Move definition of struct sched_attr to a separate header file
Avoid multiple defintions of struct sched_attr by creating a separate
header file with its definition and using it in other places.

* sched_attr.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* sched.c: Include it.
(print_sched_attr): Use it.
* tests/sched_xetattr.c: Include it.
(main): Use it.
2017-02-18 09:58:52 +00:00
6e9ad7be61 tests: rewrite sched_xetattr.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/adjtimex.c: Include "xlat.h" and "xlat/schedulers.h",
(sys_sched_getattr, sys_sched_setattr): New functions.
(main): Use them.  Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.
2017-02-18 09:58:52 +00:00
5b2e59a413 bpf: update BPF_PROG_ATTACH decoding
Implement decoding of BPF_F_ALLOW_OVERRIDE flag of BPF_PROG_ATTACH
command introduced by linux kernel commit v4.10-rc7-174-g7f67763.

* configure.ac: Check for union bpf_attr.attach_flags
instead of union bpf_attr.attach_type.
* xlat/bpf_attach_flags.in: New file.
* bpf.c: Include "xlat/bpf_attach_flags.h".
(bpf_prog_attach_detach): Rename print_attach_bpf_fd argument
to print_attach.  Add attach_flags field to the structure,
print it in case of BPF_PROG_ATTACH.
* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_ATTACH_FLAGS
instead of HAVE_UNION_BPF_ATTR_ATTACH_TYPE.
(prog_cgroup): Initialize attach_flags field.
(main): Update expected output.
2017-02-17 00:05:00 +00:00
f19251a808 tests: rewrite adjtimex.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/adjtimex.c: Include "xlat.h", "xlat/adjtimex_state.h",
and "xlat/adjtimex_status.h".
(main): Update expected output.
* tests/adjtimex.test: Use run_strace_match_diff.
2017-02-16 21:02:44 +00:00
18b582ec11 tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK
* tests/init_delete_module.h (bogus_zero): Remove.
* tests/delete_module.c (main): Replace bogus_zero and
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/finit_module.c (main): Replace bogus_zero
with F8ILL_KULONG_MASK.
* tests/init_module.c (main): Likewise.
* tests/pipe2.c (main): Likewise.
* tests/epoll_ctl.c (invoke_syscall): Replace
(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
* tests/fanotify_init.c (main): Likewise.
* tests/xetpgid.c (main): Likewise.
* tests/xetpriority.c (main): Likewise.
(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
* tests/fanotify_mark.c (main): Likewise.
* tests/file_handle.c (main): Likewise.
* tests/kexec_load.c (main): Likewise.
* tests/setfsugid.c (main): Likewise.
* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
with F8ILL_KULONG_MASK.
* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
2017-02-16 16:36:14 +00:00
1d5e810ce8 tests: fill higher bits of integer arguments of fcntl* syscalls
Check that integer arguments of fcntl and fcntl64 syscalls are decoded
properly by casting them to kernel_ulong_t and filling higher bits.

* tests/struct_flock.c (invoke_test_syscall): Cast "fd" and "cmd"
syscall arguments to kernel_ulong_t, fill their higher 32 bits.
2017-02-16 12:51:00 +00:00
ec75764697 tests: use sprintrc in tests of fcntl and fcntl64 syscalls
* tests/struct_flock.c (EINVAL_STR): Remove.
(test_flock_einval, test_flock): Use sprintrc instead of EINVAL_STR.
* tests/fcntl.c (test_flock64_einval): Likewise.
* tests/fcntl64.c (test_flock64_einval, test_flock64): Likewise.
2017-02-16 12:51:00 +00:00
9ff5dbe36d tests: skip scno tampering tests on compat mips abi
* tests/scno_tampering.sh: In case of mips abi, skip the test
unless it is the native abi.
2017-02-13 17:30:00 +00:00
2063341fef Fix -Werror=duplicate-decl-specifier compilation issues
capability.c:82:28: error: duplicate "const" declaration specifier
capability.c:110:33: error: duplicate "const" declaration specifier
rt_tgsigqueueinfo.c:42:61: error: duplicate "const" declaration specifier
utime.c:66:23: error: duplicate "const" declaration specifier
waitid.c:147:20: error: duplicate "const" declaration specifier

* capability.c (cap_user_header_t, cap_user_data_t): Remove.
(get_cap_header): Change return type
to "const struct user_cap_header_struct *".
(print_cap_header, print_cap_data): Change the type of last argument
to "const struct user_cap_header_struct * const".
(SYS_FUNC(capget)): Change type of "h" variable
to "const struct user_cap_header_struct *".
(SYS_FUNC(capset)): Change type of "h" variable
to "const struct user_cap_header_struct * const".
* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Change the type of last
argument to "const void *const".
* tests/utime.c (main): Change the type of "tail_u" variable
to "const struct utimbuf *const".
* tests/waitid.c (do_waitid): Change the type of 3rd argument
to "const siginfo_t *const".
2017-02-12 19:14:15 +00:00
c10dd66fb7 tests: rewrite pipe syscall decoding check from match_grep to match_diff
* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
instead of [!HAVE_PIPE2].
(main): Do not call pipe2.
* tests/pipe.test: Skip the test if libc pipe wrapper does not use
pipe syscall, rewrite from match_grep to match_diff.
* tests/pipe.expected: Update expected output.
2017-02-12 14:12:41 +00:00
3c5dbffe61 tests: rewrite pipe2 syscall decoding check from match_grep to match_diff
Unlike pipe.test that is based on match_grep, the new test
is based on match_diff and does more rigorous testing.

* tests/pipe2.c: New file.
* tests/pipe2.test: New test.
* tests/.gitignore: Add pipe2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add pipe2.test.
2017-02-11 13:40:42 +00:00
649fe41781 tests: rewrite mq.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.

* tests/mq.c: Include <stdio.h>.
(NAME): New macro.
(main): Use it.  Print expected output.
* tests/mq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
* tests/mq.test: Use run_strace_match_diff.
2017-02-10 00:14:45 +00:00
98313939b3 tests: check signal injection along with fault injection
* tests/qual_inject-error-signal.c: New file.
* tests/qual_inject-error-signal.expected: Likewise.
* tests/qual_inject-error-signal.test: New test.
* tests/.gitignore: Add qual_inject-error-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-error-signal.test.
(EXTRA_DIST): Add qual_inject-error-signal.expected.
2017-02-09 22:26:14 +00:00
8b1f878809 tests: simplify qual_inject-signal.test
* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.
2017-02-09 22:26:14 +00:00
1124db4483 Make symbolic errno values match case-insensitive
Follow the example of case-insensitive symbolic signal values in signal
and inject expressions and make symbolic errno values in inject
expressions case-insensitive.

* qualify.c (find_errno_by_name): Use strcasecmp instead of strcmp
to match symbolic errno values.
* tests/qual_fault.c (main): Likewise.
* tests/qual_fault.test: Test case-insensitive symbolic errno match.
2017-02-09 14:38:08 +00:00
e2040dede4 tests: check case-insensitive symbolic signal match
* tests/qual_signal.test: Test case-insensitive symbolic signal match.
2017-02-09 14:38:08 +00:00
e0fc01c0ef tests: update ipc_sem.test for new glibc
Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
address to semctl like other libcs.

* tests/ipc_sem.c (main) [__GLIBC__]: Remove.
2017-02-08 15:54:35 +00:00
75c3844167 tests: fix typo in bpf.test
* tests/bpf.c (main): Add missing semicolon.

Fixes: ad427721 ("tests: rewrite bpf.test from match_grep to match_diff")
2017-02-08 15:12:40 +00:00
34878f17b9 tests: check signal injection
* tests/qual_inject-signal.c: New file.
* tests/qual_inject-signal.expected: Likewise.
* tests/qual_inject-signal.test: New test.
* tests/.gitignore: Add qual_inject-signal.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add qual_inject-signal.test.
(EXTRA_DIST): Add qual_inject-signal.expected.
2017-02-08 13:51:33 +00:00
be73ca4bae Implement -e inject= option
Introduce -e inject= as a general injection option,
limit -e fault= option to syscall fault injection.

Change default return code of syscall fault injection to ENOSYS.

* qualify.c (parse_inject_token): Add fault_tokens_only argument,
do not accept retval= and signal= tokens when fault_tokens_only
is set to true.
(parse_inject_expression): Add fault_tokens_only argument,
forward it to parse_inject_token.
(qualify_inject_common): New function.
(qualify_fault): Use it.
(qualify_inject): New function.
(qual_options): New entry.
* strace.1: Describe -e inject= option.
* NEWS: Mention -e inject= option.
* tests/qual_fault-syntax.test: Test that -e fault= option does not
support retval=, signal=, and multiple error= tokens.
* tests/qual_fault.c (DEFAULT_ERRNO): Set to ENOSYS unconditionally.
* tests/qual_inject-retval.test: Replace -e fault= option
with -e inject= option.
* tests/qual_inject-syntax.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
2017-02-08 09:28:38 +00:00
d1dfcc533e tests: prepare for introduction of -e inject= option
Rename files related to fault injection to avoid further confusion.

* tests/fault_injection-exit_group.expected: Rename
to tests/qual_fault-exit_group.expected.
* tests/fault_injection-exit_group.test: Rename
to tests/qual_fault-exit_group.test.
* tests/fault_syntax.test: Rename to tests/qual_fault-syntax.test.
* tests/fault_injection.c: Rename to tests/qual_fault.c.
* tests/fault_injection.test: Rename to tests/qual_fault.test.
* tests/fault_injection-retval.c: Rename to tests/qual_inject-retval.c.
* tests/fault_injection-retval.test: Rename
to tests/qual_inject-retval.test.
* tests/fault_injection.sh: Rename to tests/scno_tampering.sh.
* tests/.gitignore: Update.
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Update.
2017-02-08 09:28:30 +00:00
779a28e117 tests: make Makefile.am lists sorted in C locale
* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
EXTRA_DIST): Make sorted in C locale.
2017-02-07 17:56:32 +00:00
86477a6228 tests: use ARG_STR in msg_control.test
Drop local VAL_STR macro in favour of ARG_STR macro from tests/tests.h.

* tests/msg_control.c (VAL_STR): Remove.
(test_sol_socket, test_sol_ip): Replace VAL_STR with ARG_STR.
2017-02-07 15:25:41 +00:00
bf4e76e4e7 tests: check decoding of bpf corner cases
* tests/bpf.c (bogus_bpf): New function.
(BOGUS_BPF): New macro.
(main): Use them.
* tests/bpf.test: Add -a option.
2017-01-31 19:38:45 +00:00
ad4277214e tests: rewrite bpf.test from match_grep to match_diff
* tests/bpf.c (errstr): New variable.
(sys_bpf): New function.
(map_create, map_any, prog_load, obj_manage, prog_cgroup): Use it.
(main): Update expected output.
* tests/bpf.test: Use run_strace_match_diff.
2017-01-29 23:12:07 +00:00
Quentin Monnet
0a8dd6a68c Update bpf syscall decoding
Implement decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
and BPF_PROG_DETACH commands.

* bpf.c: Include "xlat/bpf_attach_type.h".
(bpf_obj_manage, bpf_prog_attach, bpf_prog_detach): New functions.
(SYS_FUNC(bpf)): Use them.
* configure.ac: Check for union bpf_attr.bpf_fd and union
bpf_attr.attach_type.
* xlat/bpf_attach_type.in: New file.
* xlat/bpf_commands.in: Update list of BPF_* command constants.
* xlat/bpf_map_types.in: Update list of BPF_MAP_TYPE_* constants.
* xlat/bpf_prog_types.in: Update list of BPF_PROG_TYPE_* constants.
* tests/bpf.c [HAVE_UNION_BPF_ATTR_BPF_FD] (obj_manage): New function.
[HAVE_UNION_BPF_ATTR_ATTACH_TYPE] (prog_cgroup): Likewise.
(main): Use them.
2017-01-29 21:54:43 +00:00
Elvira Khabirova
fe871501ff tests: check success injection
* tests/fault_injection-retval.c: New file.
* tests/fault_injection-retval.test: New test.
* tests/.gitignore: Add fault_injection-retval.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add fault_injection-retval.test.
2017-01-28 09:55:20 +00:00
JingPiao Chen
8b7be09c7b Implement decoding of ustat syscall
* configure.ac (AC_CHECK_HEADERS): Add ustat.h.
* ustat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h: Remove sys_ustat.
* tests/ustat.c: New file.
* tests/ustat.test: New test.
* tests/.gitignore: Add ustat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ustat.test.
2017-01-20 18:30:11 +00:00
ca2bf7c9e9 tests: drop non-USE_ASM_STAT case support
With the switch of fstatat family tests to USE_ASM_STAT variant,
there are no non-USE_ASM_STAT users left.  Remove support of unused
non-USE_ASM_STAT case.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_mtim.tv_nsec.
* tests/fstatat.c (USE_ASM_STAT): Remove.
* tests/fstatx.c: Likewise.
* tests/lstatx.c: Likewise.
* tests/xstatx.c: Assume USE_ASM_STAT.
[!USE_ASM_STAT]: Remove.
2017-01-13 20:07:09 +00:00
e72b9262eb tests: call newfstatat and fstatat64 syscalls directly
Do not use glibc wrappers to call newfstatat and fstatat64.
These wrappers have various problems, e.g. they segfault on sparc64
and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
conversion of timestamps on mips64.

* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
directly.
(USE_ASM_STAT): Define.
* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.

Based on patch by James Cowgill <james410@cowgill.org.uk>.
2017-01-13 19:54:57 +00:00
3fb78d7305 tests: remove redundant SAMPLE_SIZE definitions
Remove all definitions of SAMPLE_SIZE that are identical to the fallback
definition in tests/xstatx.c.

* tests/fstat64.c (SAMPLE_SIZE): Remove.
* tests/lstat64.c (SAMPLE_SIZE): Remove.
* tests/stat64.c (SAMPLE_SIZE): Remove.
2017-01-13 19:39:18 +00:00
41e15ecd44 tests: change SAMPLE_SIZE type to libc_off_t
As ftruncate libc function and our create_sample function that calls
ftruncate both take size argument of type libc_off_t, change the type
of SAMPLE_SIZE constant to libc_off_t.

* tests/fstat.c (SAMPLE_SIZE): Cast to libc_off_t.
* tests/lstat.c (SAMPLE_SIZE): Likewise.
* tests/oldfstat.c (SAMPLE_SIZE): Likewise.
* tests/oldlstat.c (SAMPLE_SIZE): Likewise.
* tests/oldstat.c (SAMPLE_SIZE): Likewise.
* tests/stat.c (SAMPLE_SIZE): Likewise.
* tests/xstatx.c (SAMPLE_SIZE): Likewise.
2017-01-13 19:31:30 +00:00
e64a2e8db5 tests: treat struct stat mismatch as an error
If the test detects struct stat mismatch, this is likely an error
in definitions of a stat structure that might affect strace as well.
Fail the test instead of skipping it to attract more attention.

* tests/xstatx.c (main): Return 1 instead of 77
in case of struct stat mismatch.
2017-01-13 01:14:51 +00:00
d57f262ce5 tests: rewrite diagnostics about struct stat mismatch
* tests/xstatx.c (LOG_STAT_OFFSETOF_SIZEOF): New macro.
(main): Use it to print struct stat mismatch details.
2017-01-12 23:03:20 +00:00
ada8aeb715 tests: fix typo in tests/xstatx.c
* tests/xstatx.c [!IS_FSTAT]: Define IS_FSTAT instead of IS_STAT.
2017-01-12 23:03:20 +00:00
JingPiao Chen
e4863d412d tests: fix typo in mlock.c
* tests/mlock.c [!(__NR_mlock && __NR_munlock)]: Fix spelling
of SKIP_MAIN_UNDEFINED.
2017-01-12 22:46:28 +00:00
791e45ec4f Remove redundant commas at the end of structure initializers
Automatically remove redundant commas using the following
sed expression:

git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'

* linux/32/syscallent.h: Remove redundant commas at the end of structure
initializers.
* 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/microblaze/userent.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/kexec_file_load.c: Likewise.

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-01-11 23:48:41 +00:00
7c3e4edd3b tests: check decoding of scsi ioctl commands
* tests/ioctl_scsi.c: New file.
* tests/ioctl_scsi.test: New test.
* tests/.gitignore: Add ioctl_scsi.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_scsi.test.
2017-01-10 00:05:17 +00:00
6b39e463b6 tests: check decoding of ioctl SG_IO v3 commands
* tests/ioctl_sg_io_v3.c: New file.
* tests/ioctl_sg_io_v3.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v3.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v3.test.
2017-01-10 00:05:17 +00:00
3dd797830d tests: check decoding of ioctl SG_IO v4 commands
* tests/ioctl_sg_io_v4.c: New file.
* tests/ioctl_sg_io_v4.test: New test.
* tests/.gitignore: Add ioctl_sg_io_v4.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_sg_io_v4.test.
2017-01-10 00:05:17 +00:00
a286680b04 aio: print hexadecimal integer using %#x
The formerly used format string %x led to misleading output as there was
no clear indication sometimes whether the printed integer was decimal or
hexadecimal.

* aio.c (print_common_flags): Print struct iocb.aio_flags using %#x
format specifier instead of %x.
* tests/aio.c (main): Likewise.
2017-01-07 16:44:44 +00:00
Eugene Syromyatnikov
c119a6da7c getrandom: print string as hex-escaped
Since there is no reason to interpret the value returned by getrandom as
ASCII string, it makes sense to always print it as a hex-escaped string.

* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
to force hex-escaped string formatting.
* tests/getrandom.test: Remove no longer needed -xx flag as the string
is always printed in hexadecimal format now.

Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
2017-01-06 11:43:50 +00:00
ae663f17fe tests: skip fault injection tests on hppa if the kernel is too old
* tests/fault_injection.sh: Add the minimal kernel version for hppa.
2017-01-05 20:46:48 +00:00
e752ef61c3 tests: skip readahead.test on MIPS n64 when built with glibc < 2.25
Due to a bug in glibc readahead syscall wrapper on MIPS n64,
this wrapper cannot be used in readahead.test.

* tests/readahead.c [HAVE_READAHEAD && LINUX_MIPSN64 && glibc < 2.25]:
Undefine HAVE_READAHEAD.

Reported-by: James Cowgill <james410@cowgill.org.uk>
2017-01-05 18:20:57 +00:00
92ac6131a1 tests: replace init_magic with fill_memory
Use the same fill_memory/fill_memory_ex interface in all affected tests.

* tests/ioctl_block.c (init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_evdev.c: Likewise.
* tests/ioctl_v4l2.c: Likewise.
* tests/ioctl_mtd.c (magic, init_magic): Remove.
(main): Replace init_magic with fill_memory.
* tests/ioctl_rtc.c: Likewise.
2017-01-05 01:34:24 +00:00
ff9f61dce9 tests: rewrite ioctl_v4l2 test without reliance on init_magic
* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros.
(main): Use them.  Rewrite expected output without assumptions
on any particular magic data.
2017-01-05 01:34:24 +00:00