All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 0/4] Increase bind() converage - GH#538
@ 2019-09-26 15:13 Martin Doucha
  2019-09-26 15:13 ` [LTP] [PATCH v2 1/4] Update syscalls/bind02 to new API Martin Doucha
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Martin Doucha @ 2019-09-26 15:13 UTC (permalink / raw)
  To: ltp

This patchset updates syscalls/bind02 to new API and adds a test that bind()
opens sockets for incoming connections. The test is split into two programs,
one for stream-oriented sockets and the other for datagram-oriented sockets.

Changes from previous version:
- minor code style fixes in syscalls/bind02
- refactoring of include/tst_net.h (patch #2)
- code from libbind.c and some setup code moved to tst_net.c (patch #3)
- added UDPLITE and SCTP test cases
- common constants and test_case data structure moved to libbind.h

Petr Vorel wrote:
> Both tests also share a lot of code. I understand you don't want to mix TCP
> and UDP tests (I would probably do), but could you at least move setup()
> and constants into libbind.h?

I tried to write a single test file for both at first but the code flow is
slightly different which would result in a huge if/else mess. In SOCK_STREAM
test file, main thread gets a new socket from accept() so it can (and should)
use read()/write() to communicate with peer. On the other hand, SOCK_DGRAM
test file has to do its own handshake and main thread has to use recvfrom()
and sendto() because the main thread never gets a point-to-point connection
to peer.

I've decided not to write test cases for SOCK_SEQPACKET+IPPROTO_SCTP (yet)
because this type of socket doesn't support connect() at all. The call will
succeed but write() will then raise SIGPIPE. So I'd have to write a third
test file with yet another slightly different code flow.


Martin Doucha (4):
  Update syscalls/bind02 to new API
  Create separate .c file for include/tst_net.h
  Add socket address initialization functions to tst_net library
  Add connection tests for bind()

 include/tst_net.h                         | 122 ++-----------
 lib/tst_net.c                             | 205 ++++++++++++++++++++++
 runtest/syscalls                          |   2 +
 testcases/kernel/syscalls/bind/.gitignore |   2 +
 testcases/kernel/syscalls/bind/Makefile   |   2 +
 testcases/kernel/syscalls/bind/bind02.c   | 154 +++++-----------
 testcases/kernel/syscalls/bind/bind04.c   | 180 +++++++++++++++++++
 testcases/kernel/syscalls/bind/bind05.c   | 192 ++++++++++++++++++++
 testcases/kernel/syscalls/bind/libbind.h  |  29 +++
 9 files changed, 672 insertions(+), 216 deletions(-)
 create mode 100644 lib/tst_net.c
 create mode 100644 testcases/kernel/syscalls/bind/bind04.c
 create mode 100644 testcases/kernel/syscalls/bind/bind05.c
 create mode 100644 testcases/kernel/syscalls/bind/libbind.h

-- 
2.23.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-10-04 13:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26 15:13 [LTP] [PATCH v2 0/4] Increase bind() converage - GH#538 Martin Doucha
2019-09-26 15:13 ` [LTP] [PATCH v2 1/4] Update syscalls/bind02 to new API Martin Doucha
2019-10-04 12:36   ` Cyril Hrubis
2019-09-26 15:13 ` [LTP] [PATCH v2 2/4] Create separate .c file for include/tst_net.h Martin Doucha
2019-10-04 12:40   ` Cyril Hrubis
2019-09-26 15:13 ` [LTP] [PATCH v2 3/4] Add socket address initialization functions to tst_net library Martin Doucha
2019-10-04 12:42   ` Cyril Hrubis
2019-09-26 15:13 ` [LTP] [PATCH v2 4/4] Add connection tests for bind() Martin Doucha
2019-10-04 13:03   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.