Commit Graph

116 Commits

Author SHA1 Message Date
Gleb Smirnoff
62b2dd31af Make the test to leave one connection on the incomplete queue
before exiting.  This examines some race conditions in kernel.
2017-06-08 06:13:53 +00:00
Gleb Smirnoff
f7ff0c669e Improve this unit test: make sure that the accept filter actually works.
Before this test just checked scenario of setting and removing the accept
filter at different states of the socket.  Now it also checks that accept
filter works: we connect to the server, and then check that we can't accept,
then we send 1 byte of data and check again.
2017-06-08 05:12:11 +00:00
Gleb Smirnoff
b748360b8a Add a regression test for putting a socket on kqueue, and then doing
listen(2) on it (see r313043).  Based on Hartmut's code.
2017-02-14 21:56:01 +00:00
Maxim Sobolev
339efd75a4 Add a new socket option SO_TS_CLOCK to pick from several different clock
sources to return timestamps when SO_TIMESTAMP is enabled. Two additional
clock sources are:

o nanosecond resolution realtime clock (equivalent of CLOCK_REALTIME);
o nanosecond resolution monotonic clock (equivalent of CLOCK_MONOTONIC).

In addition to this, this option provides unified interface to get bintime
(equivalent of using SO_BINTIME), except it also supported with IPv6 where
SO_BINTIME has never been supported. The long term plan is to depreciate
SO_BINTIME and move everything to using SO_TS_CLOCK.

Idea for this enhancement has been briefly discussed on the Net session
during dev summit in Ottawa last June and the general input was positive.

This change is believed to benefit network benchmarks/profiling as well
as other scenarios where precise time of arrival measurement is necessary.

There are two regression test cases as part of this commit: one extends unix
domain test code (unix_cmsg) to test new SCM_XXX types and another one
implementis totally new test case which exchanges UDP packets between two
processes using both conventional methods (i.e. calling clock_gettime(2)
before recv(2) and after send(2)), as well as using setsockopt()+recv() in
receive path. The resulting delays are checked for sanity for all supported
clock types.

Reviewed by:    adrian, gnn
Differential Revision:  https://reviews.freebsd.org/D9171
2017-01-16 17:46:38 +00:00
Maxim Sobolev
79847968f9 Check that SCM_XXX timestamp returned by the kernel is less 1 second
away in the past from the current time. This should be plenty for the
scheduler to do its job. It provides assurance that the timestamp
returned is actually a valid one, not just some random garbage.
2016-12-09 22:13:00 +00:00
Maxim Sobolev
0d49655f96 Auto-generate 2 test cases that differ only in structure and SCM_XXX constant
used. We can do it programmatically, but that would make code convoluted
and more complex. I have two more of those types coming for the CLOCK_REALTIME
and CLOCK_MONOTONIC. This seems like an elegant and scallable approach.
2016-12-06 18:22:25 +00:00
Maxim Sobolev
1fab62b1e1 Refactor the regression test code by splitting huge monolithic C
file into smaller pieces that are hopefully easier to understand
and extend. This is to pave the ground for adding few more
socket timestamp formats that I am working on here.

No functional changes (I hope).
2016-12-05 17:21:04 +00:00
Pedro F. Giffuni
bd0ca2385a tools: minor spelling fixes.
Mostly comments but also some user-visible strings.

MFC after:	2 weeks
2016-05-01 16:20:14 +00:00
Enji Cooper
ca62bc5f7e Use different ports in the TCP/UDP testcases with the first set and
the second set (increment the original ports by 10)

This avoids issues where the first listening socket might not be torn
down by the time it makes it to the second set of testcases.

The sockets should likely only be setup once, but this keeps in the
spirit of the original testcases, so this will be easier to backport
to ^/stable/9

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2016-01-23 22:51:22 +00:00
Enji Cooper
0d6796ed05 Don't run the t_cmsg_len testcase on 64-bit architectures
It always fails when trying to send through the sendit(9) private KPI in the
kernel due to a size mismatch between the msghdr and data being sent [*], which
suspiciously seems like it's related to sizeof pointers instead of scalars, or
something of that ilk

MFC after: 1 week
PR: 206543, 206544 [*]
Sponsored by: EMC / Isilon Storage Division
2016-01-23 22:49:13 +00:00
Enji Cooper
78cd93ff95 - Don't return immediately in check_xucred, check_scm_creds_cmsgcred, and
check_scm_creds_sockcred after initial != NULL checks have been done for
  debugging purposes
- Use more terse names for bintime (bt), cmesgcred (cmcred),
  sockcred (sc), and timeval (tv) [*]
- Add some debug messages to better understand some of the flow of the test
  program

MFC after: 1 week
Requested by: bde [*]
Use of the word "terse" (^.^) corrected by: jhb, rpokala [*]
Sponsored by: EMC / Isilon Storage Division
2016-01-23 22:44:00 +00:00
Enji Cooper
f4ce06a920 Fix -Wunused warning with clang/gcc
- Get rid of unused argc/argv variables in main
- Bump WARNS to 6

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-01-16 02:19:56 +00:00
Enji Cooper
cc67e311d5 Fix warnings with clang/gcc
- Get rid of unused argc/argv variables in main
- Exit on failure with a return code of 1 instead of -1 with err/errx as a
  return code of -1 is implementation dependent
- Bump WARNS to 6

MFC after: 5 days
Sponsored by: EMC / Isilon Storage Division
2016-01-16 02:18:36 +00:00
Enji Cooper
eb1c509ffd Fix warnings with gcc 5.0
reconnect.c:
- Convert the K&R prototype of main to an ANSI prototype to mute a
  warning from gcc 4.2.1
- Close s_sock2 after finishing off the last test to plug a leak and
  mute a warning from gcc 5.0 about a -Wunused-but-set variable

sendfile.c:
- Fix a -Wunused-but-set warning with gcc 5.0 with pagesize in main(..)

MFC after: 5 days
Sponsored by: EMC / Isilon Storage Division
2016-01-16 02:15:13 +00:00
Enji Cooper
c084ac2883 Test for EPROTOTYPE not EPROTONOSUPPORT
- `SOCK_RAW` is the implied supported type parameter for socket(2) per route(4)
- localsw in `sys/kern/uipc_usrreq.c` doesn't have an entry for `SOCK_RAW`, so
  the prototype is invalid (this isn't explicitly documented anywhere I could
  find)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2016-01-16 02:02:50 +00:00
Enji Cooper
7c5cecc0f9 Add missing newline to message about requiring root privileges
This will help ensure that scripts/parsers don't get confused when the message
is printed out

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-01-16 01:37:17 +00:00
Enji Cooper
0e47853e87 - Check for accf_filter before running the tests, otherwise it will always
fail at subtest 9/11
- Use strncpy instead of strcpy with afa.af_name
2016-01-15 21:59:18 +00:00
Enji Cooper
b9083c2190 Integrate tools/regression/sockets/unix_passfd into the FreeBSD test
suite as tests/sys/kern/unix_passfd_test

- Convert testcases to ATF
- Fix an alignment issues
- Mark rights_creds_payload(..) as an expected failure (see PR # 181741)

Based [in part] on the following Differential Revision:
https://reviews.freebsd.org/D689

MFC after: 1 week
Submitted by: markj
Sponsored by: EMC / Isilon Storage Division
2015-12-30 11:15:07 +00:00
Enji Cooper
f3b9984bce - Explicitly initialize ch to 0
- Delete some spurious whitespace
- Use calloc instead of malloc in the last test to ensure that
  sendspace is properly zero'ed out

Differential Revision: https://reviews.freebsd.org/D689 (part of a larger diff)
MFC after: 1 week
Reviewed by: asomers, ngie
Submitted by: markj
Sponsored by: EMC / Isilon Storage Division
2015-12-28 00:53:37 +00:00
Bryan Drewery
eacae6dc66 Fix LDADD/DPADD that should be LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:47 +00:00
Enji Cooper
a954133569 Fix even more warnings..
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 07:37:21 +00:00
Enji Cooper
13517893dd Fix more warnings I didn't catch in the first go-around
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 07:35:30 +00:00
Enji Cooper
75171ec59a Fix warnings, bump WARNS to 6, and use a temporary socket instead of one in /tmp
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 07:33:04 +00:00
Enji Cooper
f7f1145f94 - Remove the .t wrapper and put the "magic" of determining the number of
testcases into the .c file
- Require root for now because it fails with SOCK_RAW without root privileges
- Increment the test count properly on socket create failure

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 06:40:38 +00:00
Enji Cooper
ddecfa0403 Fix the knob twiddling to work properly per src.opts.mk
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 06:38:50 +00:00
Enji Cooper
93b278f08d Generate temporary files with mkstemp instead of mktemp
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 05:20:01 +00:00
Enji Cooper
1103e0c1bc Garbage collect argc/argv and bump WARNS to 6
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:57:35 +00:00
Enji Cooper
f305e6eaf8 Garbage collect argc/argv and bump WARNS to 6
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:56:23 +00:00
Enji Cooper
5a3935b6d6 - Garbage collect argc/argv
- Use random paths instead of one in /tmp

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:54:43 +00:00
Enji Cooper
1e0d206337 - Garbage collect argc/argv; bump WARNS to 6
- Make the socket path random and move it out of /tmp as that's outside ATF's
  prescribed path

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:43:43 +00:00
Enji Cooper
38a7f1e446 Fix warnings and bump WARNS to 6
- Staticize variables as needed
- Garbage collect argc/argv
- Fix -Wsign-compare warnings by casting small sizeof to (int)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:38:49 +00:00
Enji Cooper
d09e3a296c Garbage collect argc/argv and bump WARNS to 6
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:35:33 +00:00
Enji Cooper
abbb25c74d Mark signum unused in signal_handler; bump WARNS to 6
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:24:49 +00:00
Enji Cooper
bcd1483d9d Fix a -Wuninitialized warning by setting the socket to -1 and bump WARNS to 6
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:19:48 +00:00
Enji Cooper
b74bcac4bd - Don't use /tmp because it's outside ATF's prescribed sandbox
- Replace a hardcoded PATH_MAX value with sizeof(path)
- Use path like an array, not a pointer, and always try to unlink it in cleanup

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:18:14 +00:00
Enji Cooper
c7ded8ba9e Fix warnings and bump WARNS to 6
- Garbage collect argc/argv (-Wunused)
- sleep(3) will always return an unsigned int; don't check for return codes <0
  (-Wsign-compare)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 03:13:09 +00:00
Enji Cooper
572e1f51aa - Garbage collect argc/argv (-Wunused)
- Bump WARNS to 6

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 02:59:45 +00:00
Enji Cooper
f6b2ef31db - Use static buffers for temporary file paths instead of strdup of constant strings
- Don't use /tmp because it's outside ATF's prescribed sandbox
- Use mkstemp instead of mktemp to eliminate warning

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-11 02:50:44 +00:00
Enji Cooper
e04e98929f Use _exit, not exit in forked process
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 09:37:53 +00:00
Enji Cooper
62b65008d0 Remove argc/argv (-Wunused)
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 09:27:23 +00:00
Enji Cooper
7d075cff6e Fix warnings
- Remove argc/argv (-Wunused)
- Mark some parameters to socket_listen_update __unused (-Wunused)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 09:26:21 +00:00
Enji Cooper
cc469a3b3a Remove argc/argv (-Wunused)
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 09:23:00 +00:00
Enji Cooper
41119c8725 - Parameterize out the number of accept/connect attempts
- Randomize the bind port to allow 2+ consecutive calls in < 10 minutes, and
  to also not fail if (for instance) there's a server already listening on port
  8080
- Don't leak the listening socket / fds into the child process
- Fix warnings:
-- Remove argc/argv (-Wunused)
-- Mark sig __unused (-Wunused)
-- Mark quit static (-Wmissing-variable-declarations)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 09:21:07 +00:00
Enji Cooper
957885bf58 Fix -Wunused warnings, bump WARNS to 6
The output is still broken if prove -rv is run and the testcase aborts
prematurely with fail_assertion (the testcase doesn't really conform to TAP
protocol properly, except when it completes fully)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 08:01:49 +00:00
Enji Cooper
1aa40dada2 Fix -Wunused warnings, bump WARNS to 6
The testcase fails today on subtest # 9

The output is still broken if prove -rv is run and the testcase aborts
prematurely (the testcase doesn't really conform to TAP protocol properly,
except when it completes fully)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 07:59:46 +00:00
Enji Cooper
2084db1777 Fix warnings, fix a typo in a testcase description, bump WARNS to 3
- Remove argc/argv (-Wunused)
- Cast len in comparison to size_t (-Wsign-compare)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-04-10 07:35:53 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +00:00
Gleb Smirnoff
76c1988620 Add test case for kern/181741. Right now test fails.
PR:		181741
Sponsored by:	Nginx, Inc.
2014-02-06 13:18:10 +00:00
Alan Somers
a8eb96d593 Replace the old unix_seqpacket and unix_seqpacket_exercise tests, which
were a little broken and not automatable, with unix_seqpacket_test.
It's coverage is a superset of the old tests and it uses ATF.  It
includes test cases for bugs kern/185813 and kern/185812.

PR:		kern/185812
PR:		kern/185813
Sponsored by:	Spectra Logic
MFC after:	2 weeks
2014-01-23 17:26:28 +00:00
Ed Maste
50185946a4 Add a sendfile regression test for transmit length > file size.
This test identified the issue fixed in FreeBSD-SA-13:11.sendfile.

Sponsored by:	The FreeBSD Foundation
Approved by:	re (glebius)
2013-09-10 13:51:19 +00:00