Commit Graph

14 Commits

Author SHA1 Message Date
d44707d889 Fix dumping of recvmmsg syscall in case of short read
* net.c (dumpiov_in_mmsghdr): Call dumpiov_upto instead of dumpiov,
pass data size limit to dumpiov_upto.
* NEWS: Mention this fix.
* tests/mmsg.c (main): Update.
2016-01-20 17:36:41 +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
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
19d10f8965 mmsg.test: fix regression introduced by commit v4.11-138-g6e815ce
This fixes the test on platforms where both __NR_sendmmsg and
HAVE_SENDMMSG are defined but the former is not implemented by the
kernel and the second is implemented as an indirect syscall.

* tests/mmsg.c (LENGTH_OF): New macro.
(send_mmsg, recv_mmsg): Print expected output in case of ENOSYS.
(main): Redirect stdout to a new descriptor.  Use LENGTH_OF.
Print expected output.
* tests/mmsg.test: Update.
* tests/mmsg.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mmsg.expected.
2016-01-14 00:06:20 +00:00
55f3c8901d tests: fix clang "duplicate 'const' declaration specifier" warnings
* tests/ksysent.c (pstr_t): Remove second const specifier.
* tests/mmsg.c (main): Remove second const specifier from one[], two[],
and three[].
2016-01-12 05:06:10 +00:00
eb4649a0dc tests/mmsg.c: fix build on rhel6/ppc
There are weird platforms that define __NR_sendmmsg but at the same time
do not define __NR_recvmmsg.  Add a workaround for them.

* configure.ac (AC_CHECK_FUNCS): Add recvmmsg.
* tests/mmsg.c: Check for __NR_recvmmsg || HAVE_RECVMMSG.
2016-01-12 05:06:10 +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
3a184fe9cc mmsg.test: check decoding of flags passed to sendmmsg and recvmmsg
* tests/mmsg.c (main): Pass MSG_DONTROUTE|MSG_NOSIGNAL to sendmmsg.
Pass MSG_DONTWAIT to recvmmsg.
* tests/mmsg.expected: Update.
2016-01-11 01:05:34 +00:00
6e815ce640 mmsg.test: prefer direct sendmmsg/recvmmsg syscalls to libc wrappers
* tests/mmsg.c: Include <sys/syscall.h>.
Check for __NR_sendmmsg as an alternative to HAVE_SENDMMSG.
[!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(send_mmsg, recv_mmsg): New functions.
(main): Use them instead of sendmmsg and recvmmsg.

Reported-by: Szabolcs Nagy <nsz@port70.net>
2016-01-11 01:03:19 +00:00
4e66672923 tests/mmsg.c: use libtests
* tests/mmsg.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.
2016-01-06 11:43:08 +00:00
0c8853c3c3 tests: include tests.h instead of config.h
Automatically edit tests/*.c files using the following perl one-liner:

perl -0777 -pi -e \
's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \
tests/*.c
2016-01-05 23:17:11 +00:00
38a34c9349 Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't.  This
change fixes the inconsistency by adding missing copyright headers.

It doesn't mean that copyright headers became maintained.  In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
2015-12-17 17:56:48 +00:00
95cbf6ebfd tests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel
* tests/mmsg.c: #include <errno.h>
(main): Return 77 if sendmmsg failed with ENOSYS.
2015-01-14 13:18:05 +00:00
Masatake YAMATO
993198deb3 tests: add a test for decoding and dumping of recvmmsg/sendmmsg
* configure (AC_CHECK_FUNCS): Add sendmmsg.
* tests/mmsg.c: New file.
* tests/mmsg.expected: New file.
* tests/mmsg.test: New test.
* tests/.gitignore: Add mmsg.
* tests/Makefile.am (CHECK_PROGRAMS): Add mmsg.
(TESTS): Add mmsg.test.
(EXTRA_DIST): Add mmsg.expected.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-11 15:45:26 +00:00