801d42d947
tests: change the type of fill_memory{,_ex} first argument to void *
...
As these functions behave like memset, it's more convenient to have
the first argument of type void * like memset.
* tests/fill_memory.c (fill_memory, fill_memory_ex): Change the type
of first argument from "char *" to "void *".
* tests/tests.h (fill_memory, fill_memory_ex): Likewise.
2017-01-04 22:08:32 +00:00
bd43e0954b
tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h
...
* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
(f8ill_ptr_to_kulong): New static inline function.
2016-12-25 11:32:45 +00:00
f55ef46feb
Include "kernel_types.h" in defs.h and tests/tests.h
...
As kernel_ulong_t type is going to be used in the definition
of struct tcb and in many function prototypes, make it readily
available for every source file by including "kernel_types.h"
in defs.h and tests/tests.h files.
* defs.h: Include "kernel_types.h".
* tests/tests.h: Likewise.
* desc.c: Do not include "kernel_types.h".
* dirent.c: Likewise.
* keyctl.c: Likewise.
* syscall.c: Likewise.
* linux/asm_stat.h: Likewise.
* tests/answer.c: Likewise.
* tests/epoll_pwait.c: Likewise.
* tests/fanotify_init.c: Likewise.
* tests/fanotify_mark.c: Likewise.
* tests/file_handle.c: Likewise.
* tests/ftruncate.c: Likewise.
* tests/getdents.c: Likewise.
* tests/init_delete_module.h: Likewise.
* tests/inotify.c: Likewise.
* tests/inotify_init1.c: Likewise.
* tests/ioprio.c: Likewise.
* tests/ipc_msgbuf.c: Likewise.
* tests/kcmp.c: Likewise.
* tests/kexec_file_load.c: Likewise.
* tests/kexec_load.c: Likewise.
* tests/keyctl.c: Likewise.
* tests/lookup_dcookie.c: Likewise.
* tests/lseek.c: Likewise.
* tests/mq_sendrecv.c: Likewise.
* tests/nsyscalls.c: Likewise.
* tests/pkey_alloc.c: Likewise.
* tests/pkey_free.c: Likewise.
* tests/pkey_mprotect.c: Likewise.
* tests/prctl-pdeathsig.c: Likewise.
* tests/prctl-tsc.c: Likewise.
* tests/preadv2-pwritev2.c: Likewise.
* tests/process_vm_readv_writev.c: Likewise.
* tests/read-write.c: Likewise.
* tests/setfsugid.c: Likewise.
* tests/setns.c: Likewise.
* tests/truncate.c: Likewise.
* tests/unshare.c: Likewise.
* tests/xgetrlimit.c: Likewise.
2016-12-16 12:01:44 +00:00
c422618120
Check dumping of io syscalls when descriptor arguments are sensibly large
...
* tests/tests.h (pipe_maxfd): New prototype.
* tests/pipe_maxfd.c: New file.
* tests/print_maxfd.c: Likewise.
* tests/.gitignore: Add print_maxfd.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(libtests_a_SOURCES): Add pipe_maxfd.c.
* tests/readv.c (main): Use pipe_maxfd() instead of pipe(),
fds[0] instead of 0, fds[1] instead of 1.
* tests/readv.test: Use print_maxfd to specify dump descriptor numbers.
2016-11-30 00:56:04 +00:00
Eugene Syromyatnikov
d212c95b84
tests: move ARG_STR and similar macros to tests.h
...
* tests/add_key.c (_STR, ARG_STR): Move ...
* tests/tests.h: ... here.
(ARG_ULL_STR): New macro.
* tests/keyctl.c (ARG_STR): Remove.
* tests/quotactl.h (ARG_STR): Likewise.
* tests/request_key.c (ARG_STR): Likewise.
2016-10-26 04:18:34 +03:00
Eugene Syromyatnikov
f0fb4e9de4
tests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h
...
* tests/fadvise.h (LL_PAIR, LL_VAL_TO_PAIR): Move ...
* tests/tests.h: ... here.
2016-10-26 04:13:24 +03:00
Eugene Syromyatnikov
06934669ea
tests: move fill_memory and fill_memory_ex into a separate file
...
* tests/fill_memory.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/quotactl.h (fill_memory, fill_memory_ex): Move to fill_memory.c.
* tests/tests.h (fill_memory, fill_memory_ex): New prototypes.
2016-10-26 01:06:09 +00:00
906dc4aaa1
Enhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
...
* defs.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Add support of char types.
* tests/tests.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
Likewise.
2016-09-27 00:57:28 +00:00
91eb1eddb0
tests: add VERBOSE macro
...
Introduce VERBOSE macro (defaults to 0) that is expected to be defined
to 1 by code testing "strace -v" output.
* tests/tests.h [!VERBOSE] (VERBOSE): New macro.
2016-09-26 15:23:18 +00:00
Eugene Syromyatnikov
6d995ae68b
tests: add sprintrc_grep function to libtests
...
New sprintrc_grep function is sprintrc function equivalent suitable for
tests where grep-base pattern matching is employed.
* tests/tests.h (sprintrc_grep): New prototype.
* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
(sprintrc_ex): New function, renamed from sprintrc and updated to
support different formats.
(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.
2016-09-08 01:37:18 +00:00
Eugene Syromyatnikov
6f9aefde21
tests: move sprintrc function to libtests
...
* tests/tests.h (sprintrc): New prototype.
* tests/futex.c (sprintrc): Move to ...
* tests/sprintrc.c: ... new file.
* tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c.
2016-09-02 17:42:42 +00:00
ca7c8952ea
tests: add sign_extend_unsigned_to_ll macro
...
* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.
2016-08-31 16:09:24 +00:00
b2dd46398f
zero_extend_signed_to_ull: add short int support
...
* defs.h (zero_extend_signed_to_ull): Add short int support.
* tests/tests.h: Likewise.
2016-08-23 00:24:17 +00:00
031fc80059
Rename widen_to_ull to zero_extend_signed_to_ull
...
* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
All callers changed.
* tests/tests.h: Likewise.
2016-08-23 00:24:10 +00:00
7b1401e965
tests: add #include guards
...
* tests/tests.h: Add #include guard.
2016-08-06 21:51:29 +00:00
aaf526ce32
tests: add recv_mmsg and send_mmsg functions to libtests
...
* tests/tests.h (recv_mmsg, send_mmsg): New prototype.
* tests/libmmsg.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/mmsg.c Do not check for __NR_sendmmsg, __NR_recvmmsg,
HAVE_SENDMMSG, and HAVE_RECVMMSG. Do not include unused headers.
(recv_mmsg, send_mmsg): Remove.
2016-07-19 17:45:02 +00:00
736d8e4d3f
tests: add socketcall function to libtests
...
* tests/tests.h (socketcall): New prototype.
* tests/libsocketcall.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-07-19 15:15:17 +00:00
ea7002822f
tests: add read_int_from_file function to libtests
...
* tests/overflowuid.c (read_int_from_file): New function.
(check_overflow_id): Use it.
* tests/tests.h (read_int_from_file): New prototype.
2016-07-03 22:15:38 +00:00
Fei Jie
0d8eaa9c01
tests: add signal2name function to libtests
...
* tests/tests.h (signal2name): New prototype.
* tests/signal2name.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-06-16 12:39:56 +00:00
af0d066dc2
tests: add widen_to_ull macro to tests.h
...
* tests.h (widen_to_ull): New macro, copied from defs.h
2016-06-10 09:14:20 +00:00
Jeff Mahoney
f21a2f4119
tests: define PRI__[dux]64 macros to print __s64 and __u64 values
...
Rather than cast every __u64 or __s64 before printing,
define printing helpers for those types directly.
This complements commit 1f3482bedad505a41caf1d61b3a4e7e09a2f4330.
* tests/tests.h (PRI__d64, PRI__u64, PRI__x64): New macros.
2016-05-22 22:54:23 +00:00
72cb81151f
tests: add print_quoted_memory function to libtests
...
* tests/print_quoted_string.c (print_quoted_memory): New function.
(print_quoted_string): Use it.
* tests/tests.h (print_quoted_memory): New prototype.
2016-05-10 22:12:01 +00:00
a182d8c6c1
tests: add printxval function to libtests
...
* tests/tests.h (printxval): New prototype.
* tests/printxval.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-04-27 20:31:34 +00:00
121e1961d7
tests: add printflags function to libtests
...
* tests/printflags.c: New file.
* tests/tests.h (printflags): New prototype.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-04-26 00:13:47 +00:00
2b69fd4c43
tests: add errno2name function to libtests
...
Add a simple translator of errno to its name, so one could
simply use errno2name() instead of complex expressions like
errno == EINVAL ? "EINVAL" : "EFAULT".
* tests.h (errno2name): New prototype.
* errno2name.c: New file.
* Makefile.am (libtests_a_SOURCES): Add it.
2016-04-21 04:08:55 +03:00
c1f1cc1b4c
tests: move kernel uid overflow check to libtests
...
This code used in two different places, so move it to the library.
* tests/overflowuid.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/tests.h (check_overflowuid, check_overflowgid): New prototypes.
* tests/uid.c (main): Use check_overflowuid.
* tests/uid16.c (main): Likewise.
2016-04-18 01:10:41 +00:00
0de582907a
tests: add hexdump_memdup function to libtests
...
* tests/hexdump_strdup.c (hexdump_memdup): New function.
(hexdump_strdup): Use it.
* tests/tests.h (hexdump_memdup): New prototype.
2016-04-02 18:24:36 +00:00
JayRJoshi
17654da621
tests: add print_quoted_string function to libtests
...
* tests/tests.h (print_quoted_string): New prototype.
* tests/print_quoted_string.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-03-23 13:34:15 +00:00
7637b1d9e8
tests: add hexquote_strndup function to libtests
...
* tests/tests.h (hexquote_strndup): New prototype.
* tests/hexquote_strndup.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-02-04 03:36:25 +00:00
e364920b67
tests: add inode_of_sockfd function to libtests
...
* tests/tests.h (inode_of_sockfd): New prototype.
* tests/inode_of_sockfd.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-02-02 00:24:48 +00:00
3d54c92691
tests: add error_msg_and_fail function to libtests
...
* tests/tests.h (error_msg_and_fail): New prototype.
* tests/error_msg.c (error_msg_and_fail): New function.
2016-01-21 23:46:43 +00:00
a5417308e4
tests/tests.h: add ARRAY_SIZE and LENGTH_OF macros
...
* tests/tests.h (ARRAY_SIZE, LENGTH_OF): New macros.
* tests/aio.c (ARRAY_SIZE): Remove.
* tests/mmsg.c (LENGTH_OF): Remove.
2016-01-20 15:24:45 +00:00
590b240444
tests: add hexdump_strdup function to libtests
...
* tests/tests.h (hexdump_strdup): New prototype.
* tests/hexdump_strdup.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
2016-01-20 15:24:41 +00:00
536a0353dd
tests: add tprintf function to libtests
...
* tests/tests.h (tprintf): New prototype.
* tests/tprintf.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/mmsg.c: Use tprintf.
2016-01-20 15:17:28 +00:00
35eb03fdf7
mmsg.test: check memory access by sendmmsg and recvmmsg decoders
...
* tests/tests.h (tail_memdup): New prototype.
* tests/tail_alloc.c (tail_memdup): New function.
* tests/mmsg.c (main): Place all objects passed to sendmmsg and recvmmsg
at the end of memory pages followed by inaccessible pages.
2016-01-11 01:05:34 +00:00
87e6b230ff
tests: introduce libtests
...
Introduce tests/libtests.a with common functions for use in tests.
* tests/tests.h: New file.
* tests/error_msg.c: Likewise.
* tests/tail_alloc.c: Likewise.
* tests/get_page_size.c: Likewise.
* tests/Makefile.am (libtests_a_SOURCES, libtests_a_CPPFLAGS,
check_LIBRARIES, LDADD): New variables.
(clock_xettime_LDADD, filter_unavailable_LDADD, mq_LDADD,
pc_LDADD, times_LDADD): Add $(LDADD).
* tests/.gitignore: Add libtests.a.
2016-01-05 23:17:07 +00:00