History log of /freebsd-11-stable/tests/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
370009 16-Jun-2021 donner

tests/netgraph: Tests for ng_vlan_rotate

Test functionality of ng_vlan_rotate(4):
- Rotate 1 to 9 stagged vlans in any possible direction and length
- Rotate random combinations of ethertypes (8100, 88a8, 9100)
- Automatic reverse rotating for backward data flow
- Test too many and too few vlans

Reviewed by: kp (earlier version)
Differential Revision: https://reviews.freebsd.org/D30670

(cherry picked from commit 6b08e68be111d50931b0d30145f8b7e3402decaf)

Git Hash: 7438333663b4d22f6863aeffba55d6a04149e3a2
Git Author: donner@FreeBSD.org

370008 16-Jun-2021 donner

tests/netgraph: Tests for ng_hub

Test functionality of ng_hub(4):
- replicting traffic to anything but the sending hook
- persistence
- an unrestricted loop
- implementation limits with many hooks.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D30633

(cherry picked from commit 7863faa78ae271017c404c635b2a9d07379d4316)

Git Hash: d68f32b4ac357ebd54dd1c640bb87ba92d7eb76d
Git Author: donner@FreeBSD.org

370007 16-Jun-2021 donner

tests/netgraph: Tests for ng_bridge

Test functionality of ng_bridge(4):
- replicating traffic to anything but the sending hook
- persistence
- detect loops
- unicast to only one link of many
- stretch to implementation limits on broadcast

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D30647
Differential Revision: https://reviews.freebsd.org/D30699

(cherry picked from commit 61814702398ce29430b2bef75cbdd6fd2c07ad12)
(cherry picked from commit 5554abd9cc9702af30af90925b33c5efff4e7d88)

Git Hash: 49736a31a5c29319c6dc8f9080b3a85da2305b47
Git Author: donner@FreeBSD.org

370006 16-Jun-2021 donner

tests/netgraph: Inital framework for testing libnetgraph

Provide a framework of functions to test various netgraph modules.
Tests contain:
- creating, renaming, and destroying nodes
- connecting and removing hooks
- sending and receiving data
- sending ASCII messages and receiving binary responses
- errors can be passed for indiviual inspection or fail the test

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D30629
Differential Revision: https://reviews.freebsd.org/D30657
Differential Revision: https://reviews.freebsd.org/D30671
Differential Revision: https://reviews.freebsd.org/D30699

(cherry picked from commit 24ea1dbf257aa6757f469bcd859f90e9ad851e59)
(cherry picked from commit 09307dbfb888a98232096c751a96ecb3344aa77c)
(cherry picked from commit 9021c46603bf29b9700f24b8dce8796b434d7c8f)
(cherry picked from commit 5554abd9cc9702af30af90925b33c5efff4e7d88)

Also contains some fixups:
- indent all files correctly
- finish factoring out
- remove debugging code
- check for renaming issues reported in PR241954

PR: 241954
Differential Revision: https://reviews.freebsd.org/D30692
Differential Revision: https://reviews.freebsd.org/D30714
Differential Revision: https://reviews.freebsd.org/D30713

(cherry picked from commit a664ade93972ce617f0888ff79e715dff9cf0f87)
(cherry picked from commit 0afa9be03937d60cb5aeba64c81e3e2165bd3737)
(cherry picked from commit 43e4821315c31db067e23564b9bfafb519e77b2b)

Git Hash: 4a0c1d0543afd83156b50b3f9b74c79e74cf526f
Git Author: donner@FreeBSD.org

370005 16-Jun-2021 donner

tests/netgraph: Prebuild tests directory

(partially cherry picked from commit e8db04c38959c882fe17e7c2b26fbabe74f26311)

Git Hash: abeb0d0c29ba28f3f502931adfa8d98758ff116e
Git Author: donner@FreeBSD.org

369900 29-May-2021 donner

Revert "test/libalias: Tests for instantiation and outgoing NAT"

11-STABLE to too different. libalias misses to many patches to keep
in touch with the planned improvement. Even the tests infrastructure
needs adjustments to prevent build (install) failures.

This reverts commit b4b99d2333faeb6ba383dcabde5d0e4c90cf23de.

Git Hash: 1d2ac87f1f8596b2b2ac08cd9e715e5278f27486
Git Author: donner@FreeBSD.org

369899 29-May-2021 donner

test/libalias: Tests for instantiation and outgoing NAT

In order to modify libalias for performance, the existing
functionality must not change. Enforce this.

Testing LibAliasOut functionality. This concentrates the typical use
case of initiating data transfers from the inside. Provide a
exhaustive test for the data structure in order to check for
performance improvements.

In order to compare upcoming changes for their effectivness, measure
performance by counting opertions and the runtime of each operation
over the time. Accumulate all tests in a single instance, so make it
complicated over the time. If you wait long enough, you will notice
the expiry of old flows.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D30307
Differential Revision: https://reviews.freebsd.org/D30335
Differential Revision: https://reviews.freebsd.org/D30379

(cherry picked from commit 7fd8baee756efa18b6bbb17cbf3a652eb2058d87)
(cherry picked from commit c1fbb54f4b100d576da7ab065d1887a21f691936)
(cherry picked from commit 33c1bdfc3e098862100bab7a8dc729d8c78ffa7c)

Git Hash: b4b99d2333faeb6ba383dcabde5d0e4c90cf23de
Git Author: donner@FreeBSD.org

367457 07-Nov-2020 dim

MFC r344855 (by jhb):

Drop "All rights reserved" from my copyright statements.

Reviewed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D19485


/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_mips64el.c
/freebsd-11-stable/lib/libdevctl/devctl.3
/freebsd-11-stable/lib/libdevctl/devctl.c
/freebsd-11-stable/lib/libdevctl/devctl.h
/freebsd-11-stable/lib/libkvm/kvm_aarch64.h
/freebsd-11-stable/lib/libkvm/kvm_amd64.h
/freebsd-11-stable/lib/libkvm/kvm_arm.h
/freebsd-11-stable/lib/libkvm/kvm_i386.h
/freebsd-11-stable/lib/libkvm/kvm_mips.h
/freebsd-11-stable/lib/libkvm/kvm_native.3
/freebsd-11-stable/lib/libkvm/kvm_sparc64.h
/freebsd-11-stable/lib/libsysdecode/errno.c
/freebsd-11-stable/lib/libsysdecode/signal.c
/freebsd-11-stable/lib/libsysdecode/syscallnames.c
/freebsd-11-stable/lib/libsysdecode/sysdecode.3
/freebsd-11-stable/lib/libsysdecode/sysdecode.h
/freebsd-11-stable/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_cap_rights.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_enum.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_fcntl_arg.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_ioctlname.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_kevent.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_mask.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_quotactl_cmd.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_sigcode.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_socket_protocol.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_sockopt_name.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_syscallnames.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_utrace.3
/freebsd-11-stable/lib/libutil/kinfo_getvmobject.3
/freebsd-11-stable/sbin/hastd/refcnt.h
/freebsd-11-stable/share/man/man3/sigevent.3
/freebsd-11-stable/share/man/man4/ktr.4
/freebsd-11-stable/share/man/man4/witness.4
/freebsd-11-stable/share/man/man9/BUS_GET_CPUS.9
/freebsd-11-stable/share/man/man9/BUS_RESCAN.9
/freebsd-11-stable/share/man/man9/atomic.9
/freebsd-11-stable/share/man/man9/bus_map_resource.9
/freebsd-11-stable/share/man/man9/critical_enter.9
/freebsd-11-stable/share/man/man9/ithread.9
/freebsd-11-stable/share/man/man9/ktr.9
/freebsd-11-stable/share/man/man9/runqueue.9
/freebsd-11-stable/share/man/man9/scheduler.9
/freebsd-11-stable/share/man/man9/sleepqueue.9
/freebsd-11-stable/share/man/man9/swi.9
/freebsd-11-stable/stand/efi/libefi/devpath.c
/freebsd-11-stable/stand/i386/cdboot/cdboot.S
/freebsd-11-stable/stand/i386/libi386/pxe.c
/freebsd-11-stable/stand/i386/libi386/pxe.h
/freebsd-11-stable/stand/i386/pxeldr/pxeldr.S
/freebsd-11-stable/sys/amd64/include/intr_machdep.h
/freebsd-11-stable/sys/arm/arm/ptrace_machdep.c
/freebsd-11-stable/sys/dev/acpica/acpi_isab.c
/freebsd-11-stable/sys/dev/acpica/acpi_pcivar.h
/freebsd-11-stable/sys/dev/pci/vga_pci.c
/freebsd-11-stable/sys/dev/rc/rc.c
/freebsd-11-stable/sys/dev/rc/rcreg.h
/freebsd-11-stable/sys/i386/pci/pci_pir.c
/freebsd-11-stable/sys/kern/kern_ktr.c
/freebsd-11-stable/sys/kern/kern_rwlock.c
/freebsd-11-stable/sys/kern/subr_lock.c
/freebsd-11-stable/sys/kern/subr_sleepqueue.c
/freebsd-11-stable/sys/kern/subr_smp.c
/freebsd-11-stable/sys/sys/_rwlock.h
/freebsd-11-stable/sys/sys/refcount.h
/freebsd-11-stable/sys/sys/rwlock.h
/freebsd-11-stable/sys/sys/sleepqueue.h
/freebsd-11-stable/sys/sys/turnstile.h
/freebsd-11-stable/sys/x86/acpica/madt.c
/freebsd-11-stable/sys/x86/include/apicvar.h
/freebsd-11-stable/sys/x86/include/intr_machdep.h
/freebsd-11-stable/sys/x86/isa/atpic.c
/freebsd-11-stable/sys/x86/isa/elcr.c
/freebsd-11-stable/sys/x86/x86/intr_machdep.c
/freebsd-11-stable/sys/x86/x86/io_apic.c
/freebsd-11-stable/sys/x86/x86/local_apic.c
/freebsd-11-stable/sys/x86/x86/mptable.c
/freebsd-11-stable/sys/x86/x86/mptable_pci.c
/freebsd-11-stable/sys/x86/xen/pvcpu_enum.c
sys/capsicum/ioctls_test.c
sys/kern/ptrace_test.c
/freebsd-11-stable/tools/tools/decioctl/decioctl.c
/freebsd-11-stable/usr.sbin/devctl/devctl.8
/freebsd-11-stable/usr.sbin/devctl/devctl.c
361128 17-May-2020 asomers

MFC r360613:

Fix intermittent cleanup failures in the ggated test

359754 09-Apr-2020 kevans

MFC -fno-common fixes: r359389, r359394, r359397-r359399, r359403-r359404,
r359406, r359413-r359416, r359425, r359427, r359432-r359433, r359443,
r359675-r359677

Note: this is not necessarily a complete fix to get these programs to build
with -fno-common applied.

r359389:
config(8): fixes for -fno-common

Move this handful of definitions into main.c, properly declare these as
extern in config.h. This fixes the config(8) build with -fno-common.

Unexplained in my previous commit to gas, -fno-common will become the
default in GCC10 and LLVM11, so it's worth addressing these in advance.

r359394:
MFV r359393: tcsh: import 6974bc35a5cd

This removes an extra variable definition that causes the -fno-common build
to fail, which will be a new default in GCC10/LLVM11.

r359397:
zfs: fix -fno-common issues

A similar (or identical?) fix has already landed in OpenZFS.

-fno-common will become the default in GCC10/LLVM11.

r359398:
sh: remove duplicate el definition

el is declared extern in myhistedit.h and defined in histedit.c. Remove the
duplicate definition in input.c to appease the -fno-common build.

-fno-common will become the default in GCC10/LLVM11.

r359399:
telnet: remove some duplicate definitions, mark terminaltype extern

Most of these were already properly declared and defined elsewhere, this is
effectively just a minor cleanup that fixes the -fno-common build.

-fno-common will become the default in GCC10/LLVM11.

r359403:
Revert 359399: telnet -fno-common bits

There was a large misfire from my local diff that I need to investigate, and
this version committed did not build.

r359404:
Re-apply r359399: telnet -fno-common fix

line and auth_level's redefinitions are just extraneous

telnetd will #define extern and then include ext.h to allocate storage for
all of these extern'd vars; however, two of them are actually defined in
libtelnet instead. Instead of doing an #ifdef extern dance around those
function pointers, just add an EXTERN macro to make it easier to
differentiate by sight which ones will get allocated in globals.c and which
ones are defined elsewhere.

r359406:
telnet: kill off remaining duplicate definition

r359413:
ipfilter: remove duplicate definition of 'thishost'

thishost is already defined in lib/initparse.c; no need for this one. This
fixes the ipfilter build with -fno-common.

-fno-common will become the default in GCC10/LLVM11.

r359414:
iscontrol: move definition of vflag/iscsidev to iscontrol.c

Mark the declaration extern as these are used elsewhere; this fixes the
build with -fno-common.

r359415:
userboot: mark host_fsops as extern

This is already defined elsewhere; mark this declaration extern to the fix
the -fno-common build.

r359416:
systat: remove redundant definition of kd

kd is already properly declared in extern.h and defined in main.c, rendering
this definition useless. This fixes the -fno-common build.

r359425:
locate: fix -fno-common build

Just a single variable declaration to extern and define elsewhere here,
myctype.

-fno-common will become a default in GCC10/LLVM11.

r359427:
fsck_ffs/fsdb: fix -fno-common build

This one is also a small list:

- 3x duplicate definition (ufs2_zino, returntosingle, nflag)
- 5x 'needs extern', 3/5 of which are referenced in fsdb

-fno-common will become the default in GCC10/LLVM11.

r359432:
gdb: compile with -fcommon explicitly

As described in the comment, gdb relies on some of the linker magic that
happens with -fcommon. I suspect the life expectancy of gdb-in-base is low
enough that this isn't worth spending much time addressing, especially given
the vintage. Hit it with the -fcommon hammer so that it continues to just
work.

r359433:
bmake: fix -fno-common build

debug was declared extern, but debug_file was not; correct this and define
debug_file in main.c (as debug is) to fix the -fno-common build.

-fno-common will become the default with GCC10/LLVM11.

r359443:
MFV r359442: bmake: import -fno-common fix build back from upstream

sjg@ committed the local patch previously committed upstream; pull it in to
vendor/ to ease any potential stress of future imports.

r359675:
kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-fno-common will become the default in GCC10/LLVM11.

r359676:
ntpd: fix build with -fno-common

Only a small nit here: psl should be declared extern and defined exactly
once.

-fno-common will become the default in GCC10/LLVM11.

r359677:
yp*: fix -fno-common build

This is mostly two problems spread out far and wide:
- ypldap_process should be declared properly
- debug is defined differently in many programs

For the latter, just extern it and define it everywhere that actually needs
it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
assignment at the beginning of main in favor of defining it properly.

-fno-common will become the default in GCC10/LLVM11.


/freebsd-11-stable/bin/sh/input.c
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h
/freebsd-11-stable/contrib/bmake/main.c
/freebsd-11-stable/contrib/bmake/make.h
/freebsd-11-stable/contrib/ipfilter/ipf.h
/freebsd-11-stable/contrib/ipfilter/tools/ipnat.c
/freebsd-11-stable/contrib/ntp/include/ntp_config.h
/freebsd-11-stable/contrib/ntp/ntpd/ntp_config.c
/freebsd-11-stable/contrib/tcsh/tc.sig.c
/freebsd-11-stable/contrib/telnet/telnetd/ext.h
/freebsd-11-stable/contrib/telnet/telnetd/global.c
/freebsd-11-stable/contrib/telnet/telnetd/sys_term.c
/freebsd-11-stable/contrib/telnet/telnetd/telnetd.c
/freebsd-11-stable/gnu/usr.bin/gdb/Makefile.inc
/freebsd-11-stable/libexec/ypxfr/ypxfr_main.c
/freebsd-11-stable/sbin/fsck_ffs/fsck.h
/freebsd-11-stable/sbin/fsck_ffs/gjournal.c
/freebsd-11-stable/sbin/fsck_ffs/globs.c
/freebsd-11-stable/sbin/fsck_ffs/setup.c
/freebsd-11-stable/sbin/fsdb/fsdb.c
/freebsd-11-stable/sbin/iscontrol/iscontrol.c
/freebsd-11-stable/sbin/iscontrol/iscontrol.h
/freebsd-11-stable/stand/userboot/userboot/libuserboot.h
sys/kqueue/libkqueue/common.h
sys/kqueue/libkqueue/proc.c
sys/kqueue/libkqueue/read.c
sys/kqueue/libkqueue/signal.c
sys/kqueue/libkqueue/timer.c
sys/kqueue/libkqueue/user.c
sys/kqueue/libkqueue/vnode.c
/freebsd-11-stable/usr.bin/locate/locate/locate.c
/freebsd-11-stable/usr.bin/locate/locate/locate.h
/freebsd-11-stable/usr.bin/systat/swap.c
/freebsd-11-stable/usr.sbin/config/config.h
/freebsd-11-stable/usr.sbin/config/main.c
/freebsd-11-stable/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
/freebsd-11-stable/usr.sbin/rpc.ypupdated/ypupdated_main.c
/freebsd-11-stable/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
/freebsd-11-stable/usr.sbin/ypldap/ypldap.c
/freebsd-11-stable/usr.sbin/ypldap/ypldap.h
/freebsd-11-stable/usr.sbin/ypserv/yp_access.c
/freebsd-11-stable/usr.sbin/ypserv/yp_error.c
/freebsd-11-stable/usr.sbin/ypserv/yp_main.c
357489 04-Feb-2020 kp

MFC r357234, r357365, r357375:

tests: Test for an epair panic

if_epair abused the ifr_data field to insert its second interface in
IFC_IFLIST. If userspace provides a value for ifr_data it would get
dereferenced by the kernel leading to a panic.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

354134 28-Oct-2019 lwhsu

MFC r350211, r350220, r350235, r350238-r350239, r350295, r350512, r350700, r352219

r350211:
Temporarily skip flakey test case
sys.kern.ptrace_test.ptrace__follow_fork_child_detached_unrelated_debugger

PR: 239292
Sponsored by: The FreeBSD Foundation

r350220:
Fix URL.

Sponsored by: The FreeBSD Foundation

r350235:
Temporarily skip flakey test case
sys.kern.ptrace_test.ptrace__PT_KILL_competing_stop

PR: 220841
Sponsored by: The FreeBSD Foundation

r350238:
Temporarily skip flakey test case
sys.kern.ptrace_test.ptrace__follow_fork_both_attached_unrelated_debugger

PR: 239397
Sponsored by: The FreeBSD Foundation

r350239:
Temporarily skip flakey test case
sys.kern.ptrace_test.ptrace__parent_sees_exit_after_child_debugger

PR: 239399
Sponsored by: The FreeBSD Foundation

r350295:
Temporarily skip flakey test case
sys.kern.ptrace_test.ptrace__follow_fork_parent_detached_unrelated_debugger

PR: 239425
Sponsored by: The FreeBSD Foundation

r350512:
Only skip test cases sometimes failing in CI when they are running in CI

Suggested by: jhb
Sponsored by: The FreeBSD Foundation

r350700:
Get configuration variable with default value for not breaking default setting

Reported by: markj
Sponsored by: The FreeBSD Foundation

r352219:
Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__getppid

PR: 240510
Sponsored by: The FreeBSD Foundation

351794 03-Sep-2019 kevans

tests: shm_open(2): Verify FD_CLOEXEC

Motivated by the fact that I'm messing around near the implementation and
wanting to ensure this doesn't get messed up in the process.

351792 03-Sep-2019 kevans

MFC r351408-r351410: reduce pollution from mips machine/regnum.h

r351408:
libsa: mips: use _JB_* from machine/asm.h, remove regnum dep

This brings the libsa/mips _setjmp implementation closer to parity with the
libc version.

r351409:
mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM

machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via
machine/reg.h. Many of the regnum definitions are too short and too generic
to be exposing to any userland application including one of these two
headers. Moreover, these actively cause build failures in googletest
(template <typename T1 ...> expanding to template <typename 9 ...>).

Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of
the userland consumers to define as needed.

r351410:
libsa: mips: fix typo that had slipped into the diff on local machine

351506 26-Aug-2019 kib

MFC r351211:
sys.kern.pdeathsig.signal_delivered_ptrace: fix startup.

PR: 237657

351505 26-Aug-2019 kib

MFC r351210:
sys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach

PR: 237657

350209 22-Jul-2019 lwhsu

MFC r346431, r349872

r346431
Specify using Python2, these .py files have not been converted to use Python3
yet, but the default Python version in ports has been switched to 3.

Sponsored by: The FreeBSD Foundation

r349872
Correct definitions in sys.opencrypto.runtests.main for 32bit platform

Reviewed by: cem, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20894

350124 19-Jul-2019 asomers

MFC r349009:

Add test cases for epair

Implements the missing test cases for epair in a similar fashion to the
existing tests. Fixes shared abstractions to work with epair tests.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reviewed by: asomers
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D20498

348588 03-Jun-2019 jhb

MFC 348206,348231,348454: GELI crypto deprecation warnings.

348206:
Add deprecation warnings for weaker algorithms to geli(4).

- Triple DES has been formally deprecated in Kerberos (RFC 8429)
and is soon to be deprecated in IPsec (RFC 8221).
- Blowfish is deprecated. FreeBSD doesn't support its successor
(Twofish).
- MD5 is generally considered a weak digest that has known attacks.

geli refuses to create new volumes using these algorithms via 'geli
init'. It also warns when attaching to existing volumes or creating
temporary volumes via 'geli onetime' . The plan is to fully remove
support for these algorithms in FreeBSD 13.

Note that none of these algorithms have ever been the default
algorithm used by geli(8). Users would have had to explicitly select
these algorithms when creating volumes in the past.

348231:
Correct the argument passed to g_eli_algo2str()

348454:
Remove tests for the deprecated algorithms in r348206

The tests are failing because the return value and output have changed, but
before test code structure adjusted, removing these test cases help people
be able to focus on more important cases.

Approved by: re (gjb)
Relnotes: yes

346541 22-Apr-2019 markj

MFC r346009:
Set the p_oppid field of orphans when exiting.

346256 16-Apr-2019 ngie

MFC r345644,r346061:

r345644 (by olivier):

Skip this test if if_tap module is not available

PR: 236842

r346061:

Polish netmap(4) testcases a bit

1. Not all kernels have netmap(4) support. Check for netmap(4) support before
attempting to run the tests via the `PLAIN_REQUIRE_KERNEL_MODULE(..)` macro.
2. Libraries shouldn't be added to LDFLAGS; they should be added to LIBADD
instead. This allows the build system to evaluate dependencies for sanity.
3. Sort some of the Makefile variables per bsd.README.

1., in particular, will resolve failures when running this testcase on kernels
lacking netmap(4) support, e.g., the i386 GENERIC kernels on ^/stable/11 and
^/stable/12.

PR: 237129

345394 21-Mar-2019 asomers

MFC r341390, r341392, r341667

r341390:
Remove some dead code from the geli tests

This is detritus in the Makefile, leftover from 327662.

r341392:
Unbreak geli/gmirror testcases if their geom classes cannot be loaded

The problem with the logic prior to this commit was twofold:

1. The wrong set of idioms (TAP-compatible) were being applied to the ATF
testcases when run, resulting in confusing ATF failure results on setup.
2. The cleanup subroutines were broken when the geom classes could not be
loaded as they exited with 0 unexpectedly.

This commit changes the test code to source the class-specific configuration
(conf.sh) once globally, instead of sourcing it per testcase and per cleanup
subroutine, and to call the ATF-specific setup subroutine(s) inline in
the testcases.

The refactoring done is effectively a no-op for the TAP testcases, modulo
any refactoring done to create common code between the ATF and TAP
testcases.

This unbreaks the geli testcases converted to ATF in r327662 and r327683,
and the gmirror testcases added in r327780, respectively, when the geom
class could not be loaded.

tests/sys/geom/class/mirror/...
While here, ignore errors when turning debug failpoint sysctl off, which
could occur if the gmirror class was not loaded.

Submitted by: ngie
Pull Request: https://github.com/freebsd/freebsd/pull/241

r341667:
geom tests: Fix cleanup of ATF tests since r341392

r341392 changed common test cleanup routines in a way that allowed them to
be used by TAP tests as well as ATF tests. However, a late change made
during code review resulted in cleanup being broken for ATF tests, which
source geom_subr.sh separately during the body and cleanup phases of the
test. The result was that md(4) devices wouldn't get cleaned up.

X-MFC-With: 341392

342914 10-Jan-2019 vmaffione

MFC r342737

netmap: unit tests: fix issues found by coverity scan

Reported by: asomers
MFC after: 1 week
Sponsored by: Sunny Valley Networks

342861 08-Jan-2019 vmaffione

MFC r342650

Errata for 342860, which did not really merge r342650.

342860 08-Jan-2019 vmaffione

MFC r342649, r342650

netmap: add suite of unit tests

Import the unit tests from upstream (https://github.com/luigirizzo/netmap
ba02539859d46d33), and make them ready for use with Kyua.
There are currently 38 regression tests, which test the kernel control ABI
exposed by netmap to userspace applications:

1: test for port info get
2-5: tests for basic port registration
6-9: tests for VALE
10-11: tests for getting netmap allocator info
12-15: tests for netmap pipes
16: test on polling mode
17-18: tests on options
19-27: tests for sync-kloop subsystem
28-39: tests for null ports
31-38: tests for the legacy NIOCREGIF registers

Reviewed by: ngie
Sponsored by: Sunny Valley Networks
Differential Revision: https://reviews.freebsd.org/D18490

342704 02-Jan-2019 jhb

MFC 341800: Don't report stale signal information in ptrace_lwpinfo.

Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared. This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'. For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo. This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.

341275 30-Nov-2018 dab

MFC r337812,r337814,r337820,r341068:

Fix several memory leaks (r337812 & r337814).

The libkqueue tests have several places that leak memory by using an
idiom like:

puts(kevent_to_str(kevp));

Rework to save the pointer returned from kevent_to_str() and then
free() it after it has been used.

r337812 also fixed a bug in the netmap kevent code. The inclusion of
that fix was an oversight that I didn't notice until this
MFC. Reference the code review and PR here in the MFC for
completeness.

r337820 & r341068 were white-space only changes as a follow-up to
r337812 & r337814:

After r337820, which "corrected" some spaces-instead-of-tab whitespace
issues in the libkqueue tests, jmg@ pointed out that these files were
originally space-based, not tab-spaced, and so the correction should
have been to get rid of the tabs that had been introduced in previous
changes, not the spaces. This change does that. This is a whitespace
only change; no functional change is intended.

PR: 206053
Differential Revision: https://reviews.freebsd.org/D16531
Sponsored by: Dell EMC Isilon

339095 02-Oct-2018 asomers

MFC r336875:

audit(4): add tests for sysctl(3) and sysarch(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16116

339094 02-Oct-2018 asomers

MFC r336728:

Introduce test program for auditpipe(4)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16395

339092 02-Oct-2018 asomers

MFC r335792, r336564, r336579

r335792:
audit(4): add tests for several more administrative syscalls

Includes ntp_adjtime, auditctl, acct, auditon, and clock_settime. Includes
quotactl, mount, nmount, swapon, and swapoff in failure mode only. Success
tests for those syscalls will follow. Also includes reboot(2) in failure
mode only. That one can't be tested in success mode.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15898

r336564:
Separate the audit(4) tests for auditon(2)'s individual commands

auditon(2) is an ioctl-like syscall with several different variants, each of
which has a distinct audit event. Write separate audit(4) tests for each
variant.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16255

r336579:
audit(4): add more test cases for auditon(2)

auditon(2) is an ioctl-like syscall with several different variants, each of
which has a distinct audit event. This commit tests the remaining variants
that weren't tested in r336564.

Submitted by: aniketp
X-MFC-With: 336564
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16381

339090 02-Oct-2018 asomers

MFC r335319, r335354, r335374

r335319:
audit(4): add tests for send, recv, sendto, and recvfrom

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15869

r335354:
audit(4): add tests for ioctl(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15872

r335374:
audit(4): add tests for utimes(2) and friends, mprotect, and undelete

Includes utimes(2), futimes(2), lutimes(2), futimesat(2), mprotect(2), and
undelete(2). undelete, for now, is tested only in failure mode.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15893

339089 02-Oct-2018 asomers

MFC r335261, r335275, r335284-r335285, r335294, r335318, r335320, r335703

r335261:
audit(4): add tests for pathconf(2) and friends

pathconf, lpathconf, and fpathconf are included

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15842

r335275:
audit(4): add tests for chflags and friends

chflags, fchflags, and lchflags (but not chflagsat) are included.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15854

r335284:
audit(4): add tests for extattr_get_file(2) and friends

This commit includes extattr_{get_file, get_fd, get_link, list_file,
list_fd, list_link}. It does not include any syscalls that modify, set, or
delete extended attributes, as those are in a different audit class.

Submitted by: aniketpt
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15859

r335285:
audit(4): Add tests for a few syscalls in the ad class

The ad audit class is for administrative commands. This commit adds test
for settimeofday, adjtime, and getfh.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15861

r335294:
audit(4): add tests for connect, connectat, and accept

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15853

r335318:
audit(4): add tests for extattr_set_file and friends

Includes extattr_{set_file, _set_fd, _set_link, _delete_file, _delete_fd,
_delete_link}

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15867

r335320:
audit(4): Add tests for {get/set}auid, {get/set}audit, {get/set}audit_addr

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15871

r335703:
audit(4): fix Coverity issues

Fix several incorrect buffer size arguments and a file descriptor leak.

Submitted by: aniketp
Reported by: Coverity
CID: 1393489 1393501 1393509 1393510 1393514 1393515 1393516
CID: 1393517 1393518 1393519
X-MFC-With: 335284
X-MFC-With: 335318
X-MFC-With: 335320
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16000

339087 02-Oct-2018 asomers

MFC many audit(4) tests.

MFC r334471, r334487, r334496, r334592, r334668, r334933, r335067, r335105,
r335136, r335140, r335145, r335207-r335208, r335215, and r335255-r335256.

r334471:
audit(4): Add tests for the fr class of syscalls

readlink and readlinkat are the only syscalls in this class. open and
openat are as well, but they'll be handled in a different file. Also, tidy
up the copyright headers of recently added files in this area.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15636

r334487:
audit(4): Add tests for the fw class of syscalls.

truncate and ftruncate are the only syscalls in this class, apart from
certain variations of open and openat, which will be handled in a different
file.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15640

r334496:
audit(4): add tests for the fd audit class

The only syscalls in this class are rmdir, unlink, unlinkat, rename, and
renameat. Also, set is_exclusive for all audit(4) tests, because they can
start and stop auditd.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15647

r334592:
audit(4): add tests for the cl audit class

The only syscalls in this class are close, closefrom, munmap, and revoke.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15650

r334668:
audit(4): add tests for open(2) and openat(2)

These syscalls are atypical, because each one corresponds to several
different audit events, and they each pass several different audit class
filters.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15657

r334933:
audit(4): add tests for stat(2) and friends

This revision adds auditability tests for stat, lstat, fstat, and fstatat,
all from the fa audit class. More tests from that audit class will follow.

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15709

r335067:
audit(4): Fix file descriptor leaks in ATF tests

Submitted by: aniketp
Reported by: Coverity
CID: 1393343 1393346 1392695 1392781 1391709 1392078 1392413
CID: 1392014 1392521 1393344 1393345 1393347 1393348 1393349
CID: 1393354 1393355 1393356 1393357 1393358 1393360 1393362
CID: 1393368 1393369 1393370 1393371 1393372 1393373 1393376
CID: 1393380 1393384 1393387 1393388 1393389
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15782

r335105:
audit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)

Submitted by: aniketp
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15750

r335136:
audit(4): add tests for flock, fcntl, and fsync

Submitted by: aniketp
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15795

r335140:
audit(4): fix typo from r335136

Typo in Makefile accidentally disabled some older tests

X-MFC-With: 335136

r335145:
audit(4): add tests for fhopen, fhstat, and fhstatfs

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15798

r335207:
audit(4): add tests for access(2), chmod(2), and friends

access(2), eaccess(2), faccessat(2), chmod(2), fchmod(2), lchmod(2), and
fchmodat(2).

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15805
Differential Revision: https://reviews.freebsd.org/D15808

r335208:
audit(4): improve formatting in tests/sys/audit/open.c

[skip ci]

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15797

r335215:
audit(4): Add a few tests for network-related syscalls

Add tests for socket(2), socketpair(2), and setsockopt(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15803

r335255:
audit(4): add tests for bind(2), bindat(2), and listen(2)

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15843

r335256:
audit(4): add tests for chown(2) and friends

Includes chown, fchown, lchown, and fchownat

Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15825

339084 02-Oct-2018 asomers

MFC r334360, r334362, r334388, r334395

r334360:
Add initial set of tests for audit(4)

This change includes the framework for testing the auditability of various
syscalls, and includes changes for the first 12. The tests will start
auditd(8) if needed, though they'll be much faster if it's already running.
The syscalls tested in this commit include mkdir(2), mkdirat(2), mknod(2),
mknodat(2), mkfifo(2), mkfifoat(2), link(2), linkat(2), symlink(2),
symlinkat(2), rename(2), and renameat(2).

Submitted by: aniketp
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15286

r334362 by emaste:
Temporarily disconnect audit tests

Audit tests added in r334360 broke the build on a number of archs.
Remove the subdir from the top level tests/sys/Makefile until they're
fixed.

r334388:
Fix OpenBSM with GCC with -Wredundant-decls

Upstream change ed47534 consciously added some redundant functional
declarations, and I'm not sure why. AFAICT they were never required. On
FreeBSD, they break the build with GCC (but not Clang) for any program
including libbsm.h with WARNS=6.

Fix by cherry-picking upstream change
https://github.com/openbsm/openbsm/commit/0553c27

Reported by: emaste
Reviewed by: cem
Obtained from: OpenBSM
Pull Request: https://github.com/openbsm/openbsm/pull/31

r334395:
Revert r334362

Reconnect tests/sys/audit now that the GCC issue is fixed by 334388

X-MFC-With: 334362, 334360, 334388

339067 01-Oct-2018 asomers

MFC r337222:

Fix LOCAL_PEERCRED with socketpair(2)

Enable the LOCAL_PEERCRED socket option for unix domain stream sockets
created with socketpair(2). Previously, it only worked with unix domain
stream sockets created with socket(2)/listen(2)/connect(2)/accept(2).

PR: 176419
Reported by: Nicholas Wilson <nicholas@nicholaswilson.me.uk>
Differential Revision: https://reviews.freebsd.org/D16350

339055 01-Oct-2018 asomers

MFC r337911:

Fix the sys/opencrypto/runtests test when aesni(4) is already loaded

Apparently kldstat requires the full module name, including busname

Reported by: Jenkins

338619 12-Sep-2018 markj

MFC r337329:
Fix the regression test for PR 181741.

MFC r337424:
Update PR 131876 regression tests after r337423.

PR: 131876

338516 06-Sep-2018 jhb

MFC 332908: Add two tests for TRAP_* signal codes for SIGTRAP.

- ptrace__breakpoint_siginfo tests that a SIGTRAP for a software breakpoint
in userland triggers a SIGTRAP with a signal code of TRAP_BRKPT.
- ptrace__step_siginfo tests that a SIGTRAP reported for a step after
stepping via PT_STEP or PT_SETSTEP has a signal code of TRAP_TRACE.

338514 06-Sep-2018 jhb

MFC 332906,332907,332976,333679,336053: Expand testing of breakpoints.

332906:
Extend support for ptrace() tests using breakpoints.

- Use a single list of platforms to define HAVE_BREAKPOINT for platforms
that expose a functional breakpoint() inline to userland. Replace
existing lists of platform tests with HAVE_BREAKPOINT instead.
- Add support for advancing PC past a breakpoint inserted via breakpoint()
to support the existing ptrace__PT_CONTINUE_different_thread test on
non-x86 platforms (x86 advances the PC past the breakpoint instruction,
but other platforms do not). This is implemented by defining a new
SKIP_BREAK macro which accepts a pointer to a 'struct reg' as its sole
argument and modifies the contents to advance the PC. The intention is
to use it in between PT_GETREGS and PT_SETREGS.

332907:
Expose breakpoint() to userland from <machine/cpufunc.h> on MIPS.

Enable ptrace() tests using breakpoint on MIPS as well.

332976:
Shorten some recently-added lines that are an extra indent over 80 columns.

333679:
Export a breakpoint() function to userland for riscv.

As a result, enable tests using breakpoint() on riscv.

336053:
Export a breakpoint() function to userland for arm and arm64.

Enable ptrace() tests using breakpoint() on these architectures.

337464 08-Aug-2018 markj

MFC r337059:
Fix some nits in the unix_passfd tests.

337421 07-Aug-2018 markj

MFC r336957:
Add a regression test related to PR 131876.

PR: 131876

337418 07-Aug-2018 dab

MFC r336761 & r336781:

Allow a EVFILT_TIMER kevent to be updated.

If a timer is updated (re-added) with a different time period
(specified in the .data field of the kevent), the new time period has
no effect; the timer will not expire until the original time has
elapsed. This violates the documented behavior as the kqueue(2) man
page says (in part) "Re-adding an existing event will modify the
parameters of the original event, and not result in a duplicate
entry."

This modification, adapted from a patch submitted by cem@ to PR214987,
fixes the kqueue system to allow updating a timer entry. The kevent
timer behavior is changed to:

* When a timer is re-added, update the timer parameters to and
re-start the timer using the new parameters.
* Allow updating both active and already expired timers.
* When the timer has already expired, dequeue any undelivered events
and clear the count of expirations.

All of these changes address the original PR and also bring the
FreeBSD and macOS kevent timer behaviors into agreement.

A few other changes were made along the way:

* Update the kqueue(2) man page to reflect the new timer behavior.
* Fix man page style issues in kqueue(2) diagnosed by igor.
* Update the timer libkqueue system test to test for the updated
timer behavior.
* Fix the (test) libkqueue common.h file so that it includes
config.h which defines various HAVE_* feature defines, before the
#if tests for such variables in common.h. This enables the use of
the actual err(3) family of functions.
* Fix the usages of the err(3) functions in the tests for incorrect
type of variables. Those were formerly undiagnosed due to the
disablement of the err(3) functions (see previous bullet point).

PR: 214987
Relnotes: yes
Sponsored by: Dell EMC

337239 03-Aug-2018 asomers

MFC r332631:

lio_listio: return EAGAIN instead of EIO when out of resources

This behavior is already documented by the man page, and suggested by POSIX.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D15099

336873 29-Jul-2018 markj

MFC r336614:
Add a regression test for PR 131876.

PR: 131876

334541 02-Jun-2018 eadler

MFC r332399:

[tests] change tests/sys/acl/run to run on perl 5.26

Previously unescaped regex just resulted in a warning. Now it results in
a failed test.

Approved by: re (marius)
PR: 228491

333625 15-May-2018 kib

Handle the difference between HEAD and stable/11 tests build.
This is a direct commit to stable/11.

PR: 228018, 228233
Tested by: Helge Oldach <freebsd@oldach.net>
Sponsored by: The FreeBSD Foundation
Approved by: re (marius)

333162 02-May-2018 kib

MFC r332740:
Add PROC_PDEATHSIG_SET to procctl interface.

MFC r332825:
Rename PROC_PDEATHSIG_SET -> PROC_PDEATHSIG_CTL.

MFC r333067:
Remove redundant pipe from pdeathsig.c test.

333069 27-Apr-2018 jhb

MFC 332657:
Properly do a deep copy of the ioctls capability array for fget_cap().

fget_cap() tries to do a cheaper snapshot of a file descriptor without
holding the file descriptor lock. This snapshot does not do a deep
copy of the ioctls capability array, but instead uses a different
return value to inform the caller to retry the copy with the lock
held. However, filecaps_copy() was returning 1 to indicate that a
retry was required, and fget_cap() was checking for 0 (actually
'!filecaps_copy()'). As a result, fget_cap() did not do a deep copy
of the ioctls array and just reused the original pointer. This cause
multiple file descriptor entries to think they owned the same pointer
and eventually resulted in duplicate frees.

The only code path that I'm aware of that triggers this is to create a
listen socket that has a restricted list of ioctls and then call
accept() which calls fget_cap() with a valid filecaps structure from
getsock_cap().

To fix, change the return value of filecaps_copy() to return true if
it succeeds in copying the caps and false if it fails because the lock
is required. I find this more intuitive than fixing the caller in
this case. While here, change the return type from 'int' to 'bool'.

Finally, make filecaps_copy() more robust in the failure case by not
copying any of the source filecaps structure over. This avoids the
possibility of leaking a pointer into a structure if a similar future
caller doesn't properly handle the return value from filecaps_copy()
at the expense of one more branch.

I also added a test case that panics before this change and now passes.

332604 16-Apr-2018 asomers

MFC r329874:

Add tests for lagg(4) and other cloned network interfaces

Unfortunately, most of the tests are disabled because they fairly frequently
trigger panics.

Sponsored by: Spectra Logic Corp

330733 10-Mar-2018 asomers

MFC r329273, r329275, r329277, r329284, r329344

r329273:
geli: append "/eli" to the underlying provider's physical path

If the underlying provider's physical path is null, then the geli device's
physical path will be, too. Otherwise, it will append "/eli". This will make
geli work better with zfsd(8).

PR: 224962
Differential Revision: https://reviews.freebsd.org/D13979

r329275:
gpart: append partition name to the underlying provider's physical path

If the underlying provider's physical path is null, then the gpart device's
physical path will be, too. Otherwise, it will append the partition name,
such as "/p1" or "/s1/a". This will make gpart work better with zfsd(8).

PR: 224965
Differential Revision: https://reviews.freebsd.org/D14010

r329277:
Add mtree entry for 329275

X-MFC-With: 329275
Sponsored by: Spectra Logic Corp

r329284:
zfsd: Allow zfsd to work on any type of GEOM provider

cddl/usr.sbin/zfsd/zfsd_event.cc
Remove the check for da and ada devices. This way zfsd can work on md,
geli, glabel, gstripe, etc devices. geli in particular is useful
combined with ZFS. gnop is also useful for simulating drive pulls in
the ZFSD test suite.

Also, eliminate the DevfsEvent class entirely. Move its
responsibilities into GeomEvent. We can get everything we need to know
just from listening to GEOM events.

lib/libdevdctl/event.cc
Fix GeomEvent::DevName for CREATE events. Oddly, the relevant field is
named "cdev" for CREATE events but "devname" for disk events.

Relnotes: Yes (probably worth mentioning the geli part)
Sponsored by: Spectra Logic Corp

r329344:
Optimize zfsd for the happy case

If there are no damaged pools, then ignore all GEOM events. We only use
them to fix damaged pools. However, still pay attention to ZFS events.

X-MFC-With: 329284
Sponsored by: Spectra Logic Corp

330731 10-Mar-2018 asomers

MFC r328896, r329236

r328896:
Fix and enable SysV IPC tests.

Don't declare some types that FreeBSD incorrectly declares.

Fix an incorrect call to open() (missing mode).

ANSIfy prototypes.

Enable SysV message queue, semaphore, and shared memory tests.

With exception of the workaround for union semun, these fixes have been
committed to NetBSD.

Reviewed by: asomers
Approved by: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13471

r329236:
Fix Coverity CIDs in the sys/kern/sysv_test tests

CID 979810: strcpy => strlcpy
CID 1193367: don't leak a file descriptor
CID 1299856: Check the return value of read(2)

Reported by: Coverity
Coverity CID: 978910 1193367 1299856
X-MFC-With: 328896
Sponsored by: Spectra Logic Corp

330222 01-Mar-2018 eadler

MFC r319590:

329789 22-Feb-2018 asomers

MFC r328108:

gnop(8): add the ability to set a nop provider's physical path

While I'm here, expand the existing tests a bit.

Differential Revision: https://reviews.freebsd.org/D13579

329008 08-Feb-2018 jhb

MFC 319454: Honor the requested crid when running a test.

Otherwise, the kernel is free to choose an aribtrary crypto device
rather than the requested device subverting tests that force the use
of a specific device.

328811 02-Feb-2018 asomers

MFC geli test suite changes

MFC r306188, r306395, r327346-r327347, r327352-r327353, r327662, r327666, r327682-r327683, r327685

r306188 by br:
Use bsdlabel as we don't have hardlink disklabel -> bsdlabel
on some platforms.

Reviewed by: ngie
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D7968

r306395 by br:
Increase timeouts for geli tests. It takes 2-3x more time to proceed the
tests on MIPS64EB in QEMU.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

r327346:
Fix potential TOCTTOU bug in the geli tests

This change mostly reverts r293436, which introduced the bug due to a belief
that geli(8) would allocate md(4) devices by itself. However, that belief is
incorrect. Instead of using linear probing to find available md(4) numbers,
it's best to use the existing attach_md function.

Reviewed by: ngie
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13666

r327347:
geli: factor out some common code in the geli tests

No functional change.

Sponsored by: Spectra Logic Corp

r327352:
Fix a harmless typo from r310786

I copy/pasted a reference to an undefined shell variable.

r327353:
geli: fix the resize test on arm64

The resize test used bsdlabel(8), which is not available on all
architectures. Change it to use gpart(8) instead, which should be available
everywhere.

PR: 221763
Reported by: andrew

r327662:
geli: convert most tests from TAP to ATF

I'm leaving readonly_test and nokey_test alone for now. In a future commit
they should be broken up into several smaller test cases and distributed
between multiple files.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D13717

r327666:
geli: fix parallel execution of tests

The trick is not to destroy an md(4) device during a test. That can create
a "double-free" situation, because we also destroy md devices during test
cleanup.

r327682:
Fix typo from r327666

X-MFC-With: 327666

r327683:
geli: convert remaining TAP tests to ATF

r327685:
geli: optimize tests

Reduce the geli tests' runtime by about a third:

* In integrity_test:copy, use a file-backed md(4) device instead of a
malloc'd one. That way we can corrupt the underlying storage without
needing to detach and reattach the geli device.

* In integrity_test:{copy, hmac, data} and onetime_test:{onetime,
onetime_a}, move reads of /dev/random out of the loop.

328379 24-Jan-2018 jhb

MFC 325028,328344: Discard the correct thread event reported for a ptrace stop.

325028:
Discard the correct thread event reported for a ptrace stop.

When multiple threads wish to report a tracing event to a debugger,
both threads call ptracestop() and one thread will win the race to be
the reporting thread (p->p_xthread). The debugger uses PT_LWPINFO
with the process ID to determine which thread / LWP is reporting an
event and the details of that event. This event is cleared as a side
effect of the subsequent ptrace event that resumed the process
(PT_CONTINUE, PT_STEP, etc.). However, ptrace() was clearing the
event identified by the LWP ID passed to the resume request even if
that wasn't the 'p_xthread'. This could result in clearing an event
that had not yet been observed by the debugger and leaving the
existing event for 'p_thread' pending so that it was reported a second
time.

Specifically, if the debugger stopped due to a software breakpoint in
one thread, but then switched to another thread that was used to
resume (e.g. if the user switched to a different thread and issued a
step), the resume request (PT_STEP) cleared a pending event (if any)
for the thread being stepped. However, the process immediately
stopped and the first thread reported it's breakpoint event a second
time. The debugger decremented the PC for "both" breakpoint events
which resulted in the PC now pointing into the middle of an
instruction (on x86) and a SIGILL fault when the process was resumed a
second time.

To fix, always clear the pending event for 'p_xthread' when resuming a
process. ptrace() still honors the requested LWP ID when enabling
single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE).

328344:
Mark the unused argument to continue_thread() as such.

clang in HEAD and 11 does not warn about this, but clang in 10 does.

328334 24-Jan-2018 markj

MFC r327779, r327780:
Fix handling of read errors during synchronization.

328309 24-Jan-2018 jhb

MFC 326953:
Catch up to r325719 which makes the kern.proc.pid sysctl "work" for zombies.

Some of the ptrace tests need to wait for a child process to become a
zombie before preceding. The parent process polls the child process
via the kern.proc.pid sysctl to wait for it to become a zombie.
Previously the code polled until the sysctl failed with ESRCH. Now it
will poll until either the sysctl fails with ESRCH (for compatiblity
with older kernels) or returns a kinfo_proc structure with the ki_stat
field set to SZOMB.

327861 12-Jan-2018 asomers

MFC r315292

r315292 (by glebius)

Fix buildworld broken in r315230 when /sys doesn't point into a right
source tree. Usage of SYSDIR is apparently wrong here.

Discussed with: allanjude

327856 12-Jan-2018 asomers

MFC r313962, r313972-r313973, r315230

r313962 by allanjude:
improve PBKDF2 performance

The PBKDF2 in sys/geom/eli/pkcs5v2.c is around half the speed it could be

GELI's PBKDF2 uses a simple benchmark to determine a number of iterations
that will takes approximately 2 seconds. The security provided is actually
half what is expected, because an attacker could use the optimized
algorithm to brute force the key in half the expected time.

With this change, all newly generated GELI keys will be approximately 2x
as strong. Previously generated keys will talk half as long to calculate,
resulting in faster mounting of encrypted volumes. Users may choose to
rekey, to generate a new key with the larger default number of iterations
using the geli(8) setkey command.

Security of existing data is not compromised, as ~1 second per brute force
attempt is still a very high threshold.

PR: 202365
Original Research: https://jbp.io/2015/08/11/pbkdf2-performance-matters/
Submitted by: Joe Pixton <jpixton@gmail.com> (Original Version), jmg (Later Version)
Reviewed by: ed, pjd, delphij
Approved by: secteam, pjd (maintainer)
Differential Revision: https://reviews.freebsd.org/D8236

r313972 by ngie:
Unbreak the build when "make obj" is executed beforehand

Using relative paths imply working directory (in this case .OBJDIR), whereas the
sources live in the .CURDIR-relative path.

X-MFC with: r313962
Pointyhat to: allanjude
Sponsored by: Dell EMC Isilon

r313973 by ngie:
A forced commit to note other portion of the Makefile change accidentally
committed in r313972

The code committed in r313962 implicitly relies on python 2.x to generate
testvect.h . There are a handful of issues with this approach:

- python is not an explicit build dependency for FreeBSD
- python 2.x is deprecated and will be removed sometime in the future
(potentially before 11.x's EOL), and the script does not function with
python 3.5 (it uses deprecated idioms and incompatible function calls).
- python(1) (by default) lives in /usr/local/bin (${LOCALBASE}/bin) and
gentestvect.py is a dependency of testvect.h (prior to r313972) which
means that if the mtime of the generator script was newer than the
mtime of the test vector, it could cause a spurious build failure in
build time or at install time.

A better solution using C/C++ should be devised.

Discussed with: allanjude
X-MFC with: r313962, r313972
Sponsored by: Dell EMC Isilon

r315230 by ngie:
Move .../sys/geom/eli/pbkdf2... to .../sys/geom/class/eli/...

This change moves the tests added in r313962 to an existing directory
structure used by the geli TAP tests. It also, renames the test from
pbkdf2 to pbkdf2_test .

The changes to ObsoleteFiles.inc are being committed separately as they
aren't needed for the MFC to ^/stable/11, etc, if the MFC for the tests
is done all in one commit.

X-MFC with: r313962, r313972-r313973
Reviewed by: allanjude
Sponsored by: Dell EMC Isilon
Differential Revision: D9985

327553 04-Jan-2018 markj

MFC r326861-r326863:
Add some gmirror tests and fix indentation in existing tests.

327081 22-Dec-2017 markj

MFC r326877:
Skip gnop tests if the corresponding kernel module isn't available.

326677 08-Dec-2017 asomers

MFC r325817, r325827

r325817:
AIO tests: increase limits

tests/sys/aio/aio_kqueue_test.c
Instead of using a hard-coded queue depth, use
vfs.aio.max_aio_queue_per_proc

tests/sys/aio/lio_kqueue_test.c
The old, small limit on lio_listio's operation count was lifted by
change 324941. Raise the operation count as high as possible without
exceeding the process's operation limit.

Sponsored by: Spectra Logic Corp

r325827:
Fix build on arm after r325817

Reported by: rpokala
X-MFC-With: 325817
Sponsored by: Spectra Logic Corp

325885 16-Nov-2017 jhb

MFC 324993:
Add a test for sending a signal while stepping a thread via PT_STEP.

324943 24-Oct-2017 bdrewery

MFC r318246,r324566,r324668,r324701:

r318246:
Add a regression test for r318191.
r324566:
Fix shadowed variable hidden by WARNS changing to 3 in r313006.
r324668:
This child is expected to exit on SIGTRAP, don't leave a core behind.
r324701:
Add a test for r324671 along with some other masked tests.

324691 17-Oct-2017 ngie

MFC r324478:

Check the exit code from fsck_ffs instead of relying on MODIFIED being in the output

^/head@r323923 changed when MODIFIED is printed at exit. It's better to follow the
documented way of determining whether or not a filesystem is clean per fsck_ffs, i.e.,
ensure that the exit code is either 0 or 7.

The pass/fail determination is brittle prior to this commit, and ^/head@r323923 made
the issue apparent -- thus this needs to be fixed independent of ^/head@r323923.

PR: 222780
MFC with: r323923

324404 07-Oct-2017 ngie

MFC note: tests/sys/kern/coredump_phnum_test.sh changes omitted

MFC r322214:

Make test scripts under tests/... non-executable

Executable bits should be set at install time instead of in the repo.
Setting executable bits on files triggers false positives with Phabricator.

324403 07-Oct-2017 ngie

MFC r317713:
r317713 (by markj):

Add regression tests for r317712 and r306743.

323300 08-Sep-2017 ngie

MFC r321702,r321703:

r321702:

Load geom_gate(4) if necessary before running tests; skip if it can't be loaded

The test code prior to r311893 loaded geom_gate at test start if necessary and
skipped the tests if it couldn't be loaded.

The ATF-ifcation of this test done in r311893 unfortunately dropped this
functionality.

This change restores the geom_gate module load and skips the test(s) if unavailable
in an ATF-like way.

PR: 220164

r321703:

Remove superfluous `exit 0` added in r321702

atf_skip triggers equivalent functionality, which means the `exit 0`
is unreachable code.

PR: 220164
MFC with: r321702

323284 07-Sep-2017 asomers

MFC r322255:

tests/sys/netinet/fibs_test: skip selected tests when firewalls are enabled

Some tests send packets over epair(4) interfaces. Firewalls can cause
spurious failures.

Reviewed by: ngie
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11917

323186 05-Sep-2017 rlibby

MFC r316397 (by bde):

Remove the unportable -msse4 here too after fixing crc32_sse42.c to
not depend on it. This should have been part of r315983.

Note, r315983 was MFC'd to stable/11 in r317149.

Approved by: markj (mentor)

322892 25-Aug-2017 asomers

MFC r321332:

Implement SIGEV_THREAD notifications for lio_listio(2)

Our man pages have always indicated that this was supported, but in fact the
feature was never implemented for lio_listio(2).

Reviewed by: jhb, kib (earlier version)
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11680

322891 25-Aug-2017 asomers

MFC r321082:

Add regression tests for bugs 220459 and 220398

Bug 220398 - lio_listio(2) never sends asynchronous notification if nent==0
Bug 220459 - lio_listio(2) doesn't support SIGEV_THREAD

PR: 220459
PR: 220398
Reviewed by: cem, jhb
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11470

322890 25-Aug-2017 asomers

MFC r320974-r320975, r321001, r321206

r320974:
Use ATF cleanup routines in aio_test.c

Remove aio_test's legacy timeout handling and cleanup routines. Instead,
use ATF's builtin capabilities. ATF automatically cleans up newly created
files, too, so we don't have to explicitly unlink them. The only tests than
need a cleanup routine are the md(4) tests, which must destroy their md
device.

Reviewed by: jhb
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11468

r320975:
Add tests for aio(4) completion notification via signals and threads

Reviewed by: jhb
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D11468

r321001:
Fix the build with GCC after r320975

Reported by: pfg
X-MFC-With: 320975
Sponsored by: Spectra Logic Corp

r321206:
Remove dead code that was killed by r320975

Reported by: Coverity
CID: 1377977
X-MFC-With: 320975
Sponsored by: Spectra Logic Corp

322691 19-Aug-2017 ngie

MFC r321959:

Annotate tests that require root privileges appropriately

This unbreaks running the tests with unprivileged users.

321643 28-Jul-2017 ngie

MFC r320446:

trailing_slash is a TAP-compliant testcase; mark it as such, instead
of calling is a plain testcase.

321642 28-Jul-2017 ngie

MFC r320445:

Don't hardcode path to file in /tmp; this violates the kyua sandbox

321165 18-Jul-2017 ngie

MFC r319063:

Send all of `data`, not just a portion of it

It was sending only a long's worth (4 or 8 bytes) of data previously
(instead of the entire buffer) via send(2).

CID: 1229966, 1229967, 1230004, 1230005

321095 17-Jul-2017 ngie

MFC r318180:

Mark all md tests as requiring unsafe AIO in order to function

These tests have been flapping (failing<->passing) on Jenkins for months.
It passes reliably for me if unsafe AIO is permitted, but it doesn't
pass on Jenkins reliably if unsafe AIO is disabled (the current default).

Mark the tests as requiring unsafe AIO to mitigate the intermittent
failures when unsafe AIO isn't permitted. If the kernel code is changed
to reliably function with md(4) devices using unsafe AIO, this commit can
be reverted.

PR: 217261

320862 10-Jul-2017 ngie

MFC r319455,r319456:

r319455:

Fix up `TEST_METADATA`

- `TEST_METADATA.foo` should be `TEST_METADATA.run_tests`: this will unbreak
trying to run the tests on a system without python installed in $PATH.
- The tests require root because they load aesni(4) and/or cryptodev(4) if
not already loaded.

r319456:

tests/sys/opencrypto/runtests: apply minor polish to test script

- Refactor kld loading/unloading logic:
-- Use a loop instead of an unrolled one.
-- Check for the module being loaded before trying to load it, to reduce
noise when loading modules that are already loaded.
-- Don't mute stderr from kldload -- it could be potentially useful to
the tester.
-- In the event that the test script was terminated early, it would leave
the modules still attached to the system (which is undesirable).
Always unload the modules at test end with EXIT/SIGINT/SIGTERM so the
system is returned to its former operating state as best possible.
Unload the modules in reverse order, in part for consistency and/or
dependency reasons.

319497 02-Jun-2017 asomers

MFC r312919 (by rwatson)

Fix build of aio_test on MIPS, where the compiler warns about the local
variable 'err' shadowing the global function err(3). Which it does.

Sponsored by: DARPA, AFRL
Approved by: re

319404 01-Jun-2017 tuexen

MFC r317512:

armv8 has support for optional CRC32C instructions. This patch checks if they are
available and if that is true make use of them.
Thank you very much to Andrew Turner for providing help and review the patch!

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D10499

319300 31-May-2017 ngie

MFC r319056,r319058,r319059,r319060,r319061,r319078:

r319056:

tests/sys/file/ftruncate_test: use an exit code of 1 instead
of -1 with err*(3).

An exit code of -1 is implementation defined -- it's best to stick
with something well-defined (1).

r319058:

Create a deterministic file in the kyua sandbox, instead of a
temporary file outside the kyua sandbox

This helps ensure that the file is removed at test exit, and as
a side effect, cures a warning about umasks with Coverity.

r319059:

Use an exit code of 1 instead of -1 for reasons noted in r319056

r319060:

Use main(void) instead of main(argc __unused, argv __unused)

r319061:

Don't leak accept_fd on thread completion

CID: 1296068

r319078:

Tweak r319058 slightly

- Specify an explicit mode when using O_CREAT per open(2).
- Fix the error message (add missing enclosing parentheses).

MFC with: r319058

319296 31-May-2017 ngie

MFC r319062:

Initial `srv` before using it in bind(2)

CID: 1357526

319218 30-May-2017 asomers

MFC r318593:

Fix build of AIO tests with -DDEBUG

Also, redefine some constants for clarity. No functional change.

319173 30-May-2017 ngie

MFC r312913,r318100,r318107:

r312913 (by asomers):

Improve the aio tests

* Add tests for aio_suspend(2).
* Add tests for polled completion notification.
* Test the full matrix of file descriptor types and completion notification
mechanisms.
* Don't bother with mkstemp, because ATF runs every test in its own temp dir.
* Fix some typos.
* Remove extraneous ATF_REQUIRE_KERNEL_MODULE calls.

r318100:

style(9): move function definition curly braces to column 0

r318107:

Remove unused constant (PATH_TEMPLATE)

It was made unnecessary in r312913.

MFC with: r312913

319172 30-May-2017 ngie

MFC r318094,r318098,r318099:

r318094:

style(9): clean up trailing whitespace

r318098:

Refactor ATF_REQUIRE_UNSAFE_AIO and PLAIN_REQUIRE_UNSAFE_AIO

This is being done to reduce duplication between the two macros.

r318099:

Print out when unsafe AIO is enabled to debugging purposes

319005 27-May-2017 ngie

MFC r318546:

sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic

The previous logic was flawed in the sense that it assumed that /dev/md3
was always available. This was a caveat I noted in r306038, that I hadn't
gotten around to solving before now.

Cache the device for the mountpoint after executing mdmfs, then use the
cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
device.

Apply sed expressions to use reuse logic in the NetBSD code that could
also be applied to FreeBSD, just with different tools.

317831 05-May-2017 brooks

MFC r317566:

Don't pass size_t arguments to setsockopt(SO_SNDBUF/SO_RCVBUF).

These commands take an int. The tests work by accident on little-endian,
64-bit systems.

PR: 218919
Tested with: qemu-cheri and CheriBSD built for mips64
Reviewed by: asomers, ngie
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

317149 19-Apr-2017 markj

MFC r313006 (by cem), r315983 (by bde):
Add an SSE4.2 implementation of crc32 for x86.

317067 17-Apr-2017 asomers

MFC r313025, r313395, r314113, r314442, r315458, r315656

r313025:
Add tests for multi-fib IPv6 routing

PR: 196361
Submitted by: jhujhiti@adjectivism.org
Reported by: Jason Healy <jhealy@logn.net>
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

r313395:
Add fibs_test:udp_dontroute6, another IPv6 multi-FIB test

PR: 196361
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

r314113:
Remove tests/sys/netinet/fibs_tests's dependency on net/socat

Instead of bridging two tap interfaces with socat, just use an epair pair.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

r314442:
Add an ATF test for IPv6 SLAAC with multiple fibs

Tests that an interface can get a SLAAC address and that it inserts its
routes into the correct fib. Does not test anything to do with NDP.

PR: 196361
Reviewed by: Erick Turnquist <jhujhiti@adjectivism.org>
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9776

r315458:
Constrain IPv6 routes to single FIBs when net.add_addr_allfibs=0

sys/netinet6/icmp6.c
Use the interface's FIB for source address selection in ICMPv6 error
responses.

sys/netinet6/in6.c
In in6_newaddrmsg, announce arrival of local addresses on the
interface's FIB only. In in6_lltable_rtcheck, use a per-fib ND6
cache instead of a single cache.

sys/netinet6/in6_src.c
In in6_selectsrc, use the caller's fib instead of the default fib.
In in6_selectsrc_socket, remove a superfluous check.

sys/netinet6/nd6.c
In nd6_lle_event, use the interface's fib for routing socket
messages. In nd6_is_new_addr_neighbor, check all FIBs when trying
to determine whether an address is a neighbor. Also, simplify the
code for point to point interfaces.

sys/netinet6/nd6.h
sys/netinet6/nd6.c
sys/netinet6/nd6_rtr.c
Make defrouter_select fib-aware, and make all of its callers pass in
the interface fib.

sys/netinet6/nd6_nbr.c
When inputting a Neighbor Solicitation packet, consider the
interface fib instead of the default fib for DAD. Output NS and
Neighbor Advertisement packets on the correct fib.

sys/netinet6/nd6_rtr.c
Allow installing the same host route on different interfaces in
different FIBs. If rt_add_addr_allfibs=0, only install or delete
the prefix route on the interface fib.

tests/sys/netinet/fibs_test.sh
Clear some expected failures, but add a skip for the newly revealed
BUG217871.

PR: 196361
Submitted by: Erick Turnquist <jhujhiti@adjectivism.org>
Reported by: Jason Healy <jhealy@logn.net>
Reviewed by: asomers
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9451

r315656:
Fix back-to-back runs of sys/netinet/fibs_test;slaac_on_nondefault_fib6

This test was failing if run twice because rtadvd takes too long to die.
The rtadvd process from the first run was still running when the
second run created its interfaces. The solution is to use SIGKILL during
the cleanup instead of SIGTERM so rtadvd will die faster.

While I'm here, randomize the addresses used for the test, which makes bugs
like this easier to spot, and fix the cleanup order to be the opposite of
the setup order

PR: 217871
MFC after: 18 days
X-MFC-With: 315458
Sponsored by: Spectra Logic Corp

316390 02-Apr-2017 asomers

MFC r314056:

Improve pjdfstest run instructions

In the Kyua era, it's no longer necessary to set PJDFSTEST_TEST_PATH. Just
use TMPDIR instead.

Reviewed by: ngie
MFC after: 3 weeks
Relnotes: yes
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9340

315963 25-Mar-2017 badger

MFC r315412, r314852:

r315412:
Don't clear p_ptevents on normal SIGKILL delivery

The ptrace() user has the option of discarding the signal. In such a
case, p_ptevents should not be modified. If the ptrace() user decides to
send a SIGKILL, ptevents will be cleared in ptracestop(). procfs events
do not have the capability to discard the signal, so continue to clear
the mask in that case.

r314852:
don't stop in issignal() if P_SINGLE_EXIT is set

Suppose a traced process is stopped in ptracestop() due to receipt of a
SIGSTOP signal, and is awaiting orders from the tracing process on how
to handle the signal. Before sending any such orders, the tracing
process exits. This should kill the traced process. But suppose a second
thread handles the SIGKILL and proceeds to exit1(), calling
thread_single(). The first thread will now awaken and will have a chance
to check once more if it should go to sleep due to the SIGSTOP. It must
not sleep after P_SINGLE_EXIT has been set; this would prevent the
SIGKILL from taking effect, leaving a stopped orphan behind after the
tracing process dies.

Also add new tests for this condition.

Sponsored by: Dell EMC

315949 25-Mar-2017 badger

MFC r313992, r314075, r314118, r315484:

r315484:
ptrace_test: eliminate assumption about thread scheduling

A couple of the ptrace tests make assumptions about which thread in a
multithreaded process will run after a halt. This makes the tests less
portable across branches, and susceptible to future breakage. Instead,
twiddle thread scheduling and priorities to match the tests'
expectation.

r314118:
Actually fix buildworlds other than i386/amd64/sparc64 after r313992

Disable offending test for platforms without a userspace visible
breakpoint().

r314075:
Fix world build for archs where __builtin_debugtrap() does not work.

The offending code was introduced in r313992.

r313992:
Defer ptracestop() signals that cannot be delivered immediately

When a thread is stopped in ptracestop(), the ptrace(2) user may request
a signal be delivered upon resumption of the thread. Heretofore, those signals
were discarded unless ptracestop()'s caller was issignal(). Fix this by
modifying ptracestop() to queue up signals requested by the ptrace user that
will be delivered when possible. Take special care when the signal is SIGKILL
(usually generated from a PT_KILL request); no new stop events should be
triggered after a PT_KILL.

Add a number of tests for the new functionality. Several tests were authored
by jhb.

PR: 212607
Sponsored by: Dell EMC

314818 07-Mar-2017 ngie

MFC r313439,r314450:

r313439:

Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head

The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.

The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
back to NetBSD as possible, then pull the upstream applied changes
back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
that could not be upstreamed to NetBSD.

As a bonus for this work, this change also introduces testcases for
uniq(1).

Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.

In collaboration with: Christos Zoulas <christos@netbsd.org>

r314450:

Add additional __FreeBSD_version guards around the hsearch_r testcases

The reasoning for this is the same as r276046: to ease MFCing the tests
to ^/stable/10 .

This was accidentally missed in r313439


/freebsd-11-stable/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue
/freebsd-11-stable/contrib/netbsd-tests/dev/cgd/t_cgd_3des.c
/freebsd-11-stable/contrib/netbsd-tests/dev/cgd/t_cgd_aes.c
/freebsd-11-stable/contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c
/freebsd-11-stable/contrib/netbsd-tests/dev/clock_subr
/freebsd-11-stable/contrib/netbsd-tests/dev/scsipi/t_cd.c
/freebsd-11-stable/contrib/netbsd-tests/dev/sysmon/t_swwdog.c
/freebsd-11-stable/contrib/netbsd-tests/fs/common/h_fsmacros.h
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_fifos.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_mount.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_quota2_1.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_snapshot.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c
/freebsd-11-stable/contrib/netbsd-tests/fs/hfs/t_pathconvert.c
/freebsd-11-stable/contrib/netbsd-tests/fs/kernfs/t_basic.c
/freebsd-11-stable/contrib/netbsd-tests/fs/lfs/t_pr.c
/freebsd-11-stable/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c
/freebsd-11-stable/contrib/netbsd-tests/fs/nfs/t_mountd.c
/freebsd-11-stable/contrib/netbsd-tests/fs/nullfs/t_basic.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c
/freebsd-11-stable/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c
/freebsd-11-stable/contrib/netbsd-tests/fs/puffs/t_basic.c
/freebsd-11-stable/contrib/netbsd-tests/fs/puffs/t_fuzz.c
/freebsd-11-stable/contrib/netbsd-tests/fs/puffs/t_io.c
/freebsd-11-stable/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
/freebsd-11-stable/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
/freebsd-11-stable/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c
/freebsd-11-stable/contrib/netbsd-tests/fs/umapfs/t_basic.c
/freebsd-11-stable/contrib/netbsd-tests/fs/union/t_pr.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_full.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_io.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_renamerace.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_ro.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_rwtoro.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_union.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_unpriv.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_vfsops.c
/freebsd-11-stable/contrib/netbsd-tests/fs/vfs/t_vnops.c
/freebsd-11-stable/contrib/netbsd-tests/include/sys/t_socket.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/arch
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/read/t_file2.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/t_sig.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/write/t_fifo.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/write/t_pipe.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/kqueue/write/t_ttypty.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_extent.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_filedesc.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_lock.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_mqueue.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_ptrace.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_ptrace_wait.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_pty.c
/freebsd-11-stable/contrib/netbsd-tests/kernel/t_rnd.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/db/t_db.sh
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/gen/exect
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/gen/t_glob.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/gen/t_sleep.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/hash/h_hash.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/hash/t_hmac.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/hash/t_sha2.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/locale/t_io.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/regex/debug.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/regex/t_exhaust.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/regex/t_regex_att.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/ssp/h_memset.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/ssp/h_read.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/stdlib/h_getopt_long.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/string/t_strlen.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_connect.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_dup.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_link.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_listen.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_mlock.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_mmap.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_msync.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_posix_fadvise.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_select.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_stat.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_truncate.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_umask.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_wait.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libc/sys/t_write.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libm/t_ilogb.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libm/t_pow.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libm/t_precision.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libm/t_scalbn.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libposix/t_rename.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/h_common.h
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_condwait.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_detach.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_fork.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_fpu.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_join.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_mutex.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_once.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_sem.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
/freebsd-11-stable/contrib/netbsd-tests/lib/libpthread_dbg
/freebsd-11-stable/contrib/netbsd-tests/lib/librefuse
/freebsd-11-stable/contrib/netbsd-tests/lib/librt/t_sem.c
/freebsd-11-stable/contrib/netbsd-tests/lib/librumpclient/t_fd.c
/freebsd-11-stable/contrib/netbsd-tests/lib/semaphore/sem.c
/freebsd-11-stable/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-cleared.c
/freebsd-11-stable/contrib/netbsd-tests/libexec/ld.elf_so/t_dlerror-false.c
/freebsd-11-stable/contrib/netbsd-tests/libexec/ld.elf_so/t_dlinfo.c
/freebsd-11-stable/contrib/netbsd-tests/libexec/ld.elf_so/t_ifunc.c
/freebsd-11-stable/contrib/netbsd-tests/modules/t_builtin.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpf/t_bpf.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpf/t_mbuf.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpfjit/t_cop.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpfjit/t_extmem.c
/freebsd-11-stable/contrib/netbsd-tests/net/bpfjit/t_mbuf.c
/freebsd-11-stable/contrib/netbsd-tests/net/carp/t_basic.c
/freebsd-11-stable/contrib/netbsd-tests/net/carp/t_basic.sh
/freebsd-11-stable/contrib/netbsd-tests/net/config/netconfig.c
/freebsd-11-stable/contrib/netbsd-tests/net/icmp/t_forward.c
/freebsd-11-stable/contrib/netbsd-tests/net/icmp/t_ping.c
/freebsd-11-stable/contrib/netbsd-tests/net/if/t_ifconfig.sh
/freebsd-11-stable/contrib/netbsd-tests/net/if_loop/t_pr.c
/freebsd-11-stable/contrib/netbsd-tests/net/if_tun
/freebsd-11-stable/contrib/netbsd-tests/net/if_vlan
/freebsd-11-stable/contrib/netbsd-tests/net/ndp/t_ra.sh
/freebsd-11-stable/contrib/netbsd-tests/net/net/t_raw.c
/freebsd-11-stable/contrib/netbsd-tests/rump/modautoload/t_modautoload.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_kern.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_modcmd.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_modlinkset.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_signals.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_threads.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_tsleep.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpkern/t_vm.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpvfs/t_basic.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpvfs/t_etfs.c
/freebsd-11-stable/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c
/freebsd-11-stable/contrib/netbsd-tests/sys/uvm
/freebsd-11-stable/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
/freebsd-11-stable/contrib/netbsd-tests/usr.bin/mixerctl
/freebsd-11-stable/contrib/netbsd-tests/usr.bin/uniq
/freebsd-11-stable/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh
/freebsd-11-stable/etc/mtree/BSD.tests.dist
/freebsd-11-stable/lib/libc/tests/hash/Makefile
/freebsd-11-stable/lib/libc/tests/regex/Makefile
sys/fs/tmpfs/Makefile
/freebsd-11-stable/usr.bin/uniq/Makefile
/freebsd-11-stable/usr.bin/uniq/tests
313753 15-Feb-2017 asomers

MFC r311893, r313008, r313081

r311893:
ATFify the geom gate tests.

This ensures their cleanup routines will be run even if they should timeout.

tests/sys/geom/class/gate/ggate_test.sh
tests/sys/geom/class/gate/Makefile
Add an ATF test with three testcases, one for each TAP test. Use
ATF-style cleanup functions, and convert sleeps to polling loops.

ObsoleteFiles.inc
tests/sys/geom/class/gate/conf.sh
tests/sys/geom/class/gate/1_test.sh
tests/sys/geom/class/gate/2_test.sh
tests/sys/geom/class/gate/3_test.sh
Delete TAP test files

Reviewed by: ngie
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8891

r313008:
Wait for /dev/ggate* to appear after calling `ggatel create` in :ggatel_{file,md}

The test assumed that `ggatel create` created a device on completion, but that's
incorrect. This squashes the race by waiting for the device to appear, as
`ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called
with `-v`.

Discussed with: asomers
MFC after: 1 week
PR: 204616
Sponsored by: Dell EMC Isilon

r313081:
Replace for/retry loops with "wait_for_ggate_device" calls and check
results of commands

As noted in r313008, the underlying issue was that geom_gate device
creation wasn't created at ggatel command completion, but some short
time after. ggatec(8) employs similar logic when creating geom_gate(4)
devices.

Switch from retry loops (after the ggatec/dd write calls) to
wait_for_ggate_device function calls after calling ggatec(8) instead
to detect the presence of the /dev/ggate* device, as this function is
sufficient for determining whether or not the character device is ready
for testing

While here, use atf_check consistently with all dd calls to ensure that
data output is as expected.

MFC after: 1 week
Reviewed by: asomers
Differential Revision: D9409
Sponsored by: Dell EMC Isilon

313302 05-Feb-2017 jilles

MFC r310096: reaper: Make REAPER_KILL_SUBTREE actually work.

313236 04-Feb-2017 ngie

MFC r312114:

Enable WARNS?= 6 across all of tests/sys

313235 04-Feb-2017 ngie

MFC r312120:

Fix warnings

- Staticize test_num
- Promote i to size_t to deal with -Wsign-compare issues

Tested with: clang, gcc, gcc49

313233 04-Feb-2017 ngie

MFC r312110:

Fix -Wsign-compare warnings

The loop index (i) doesn't need to be size_t as its comparison is signed

313232 04-Feb-2017 ngie

MFC r312164:

Fix -Wformat issue

Use %zu for printing out results from nitems, as it's size_t based

313213 04-Feb-2017 ngie

MFC r312119,r312216,r312226:

r312119:

encode_long, encode_timeval: mechanically replace `exp` with `exponent`

This helps fix a -Wshadow issue with exp(3) with tests/sys/acct/acct_test,
which include math.h, which in turn defines exp(3)

Tested with: clang, gcc 4.2.1, gcc 4.9

r312216:

Revert r312119 and reword the intent to fix -Wshadow issues
between exp(3) and `exp` var.

The approach taken previously was not ideal for multiple
functional and stylistic reasons.

Add to existing sed call in Makefile to replace `exp` with
`exponent` instead.

Requested by: bde

r312226:

Fix typo in r312216

I meant to replace "exp" with "exponent", not "expected"

Pointyhat to: ngie

312829 26-Jan-2017 asomers

MFC r310786, r310803, r310985, r311894

r310786:
Reduce the runtime of the GELI tests

There is no reduction in test coverage. On my system runtime is reduced
from 38m32s to 6m24s.

tests/sys/geom/class/eli/conf.sh
tests/sys/geom/class/eli/init_a_test.sh
tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/integrity_copy_test.sh
tests/sys/geom/class/eli/integrity_data_test.sh
tests/sys/geom/class/eli/integrity_hmac_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
tests/sys/geom/class/eli/onetime_test.sh
Move the looping code into common functions in conf.sh, and remove
alias ciphers from the list.

tests/sys/geom/class/eli/init_a_test.sh
tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/integrity_copy_test.sh
tests/sys/geom/class/eli/integrity_data_test.sh
tests/sys/geom/class/eli/integrity_hmac_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
Move a few commands that don't need to be in the inner loop out.

tests/sys/geom/class/eli/init_test.sh
tests/sys/geom/class/eli/onetime_a_test.sh
Reduce the sector count

tests/sys/geom/class/eli/Makefile
tests/sys/geom/class/eli/init_alias_test.sh
Add a test for initializing a GELI device using one of the cipher
aliases, and check that the alias is correctly interpreted.

MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8814

r310803:
ATFify the gnop tests

Also, add test cases for the -p, -P, and -s options to gnop create

Reviewed by: ngie
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D8892

r310985:
Update ObsoleteFiles.inc for r310803

MFC after: 26 days
X-MFC-with: 310803

r311894:
Fix typo from change 310985 in ObsoleteFiles.inc

MFC after: 16 days
X-MFC-With: 310803
Sponsored by: Spectra Logic Corp

312322 17-Jan-2017 ngie

MFC r312111:

Remove unused vars to fix -Wunused issues

312321 17-Jan-2017 ngie

MFC r312118,r312121:

r312118:

Fix -Wformat issue with zero-length format string passed to err(3)

Tested with: clang, gcc 4.2.1, gcc 4.9

r312121:

Follow up to r312118

State that execve failed instead of just printing out the program name
and strerror(errno) via err(3).

312163 14-Jan-2017 ngie

MFC r309464:

Expect 01:main to fail

Changes were made to ZFS in the past year with respect to how ACLs
are handled, causing failures in this test. Mark it TODO so (hopefully)
someone more knowledgeable (like mav or trasz) will fix the code or the
test.

PR: 212323

312072 13-Jan-2017 kib

MFC r311522:
Use type-independent formats for printing nlink_t and ino_t.

311183 03-Jan-2017 bdrewery

MFC r305148:

DIRDEPS_BUILD: Add some missing dirctories to the build.

310601 26-Dec-2016 jilles

MFC r309957: Add tests for reaper receiving SIGCHLD (r309886).

PR: 213928

310231 18-Dec-2016 jilles

MFC r309836: Add some tests for reaper functionality (in procctl()).

309668 07-Dec-2016 ngie

MFC r306030,r306031,r306033,r306036,r306038,r307190,r307196,r307204,r307205,r307701,r307702:

r306030:

Port vnode_leak_test:main to FreeBSD

Use a simpler way of dumping kern.maxvnodes, i.e. `sysctl -n kern.maxvnodes`

The awk filtering method employed in NetBSD doesn't work on FreeBSD

r306031:

Port contrib/netbsd-tests/fs/h_funcs.subr to FreeBSD

Use kldstat -m to determine whether or not a filesystem is loaded. This works
well with tmpfs, ufs, and zfs

r306033:

Port sizes_test and statvfs_test to FreeBSD

Similar to r306030, use a simpler method for getting the value of
`hw.pagesize`, i.e. `sysctl -n hw.pagesize`. The awk filtering method doesn't
work on FreeBSD

r306036:

Port to mknod_test and readdir_test to FreeBSD

The `mknod <file> p` command doesn't exist on FreeBSD, like on NetBSD. Use
mkfifo instead to create named pipes (FIFOs).

r306038:

Port vnd_test to FreeBSD

Use mdmfs/mdconfig instead of vndconfig/newfs. vndconfig doesn't exist on FreeBSD.

TODO: need to parameterize out the md(4) device as it's currently hardcoded to "3"
(in both the FreeBSD and NetBSD cases).

r307190:

Skip :uchg on FreeBSD

Unfortunately removing files with uchg set always succeeds with root on
FreeBSD. Unfortunately running the test as an unprivileged user isn't doable
because mounting tmpfs requires root

PR: 212861

r307196:

Port contrib/netbsd-tests/fs/tmpfs/h_tools.c to FreeBSD

- Add inttypes.h #include for PRId64 macro
- Use FreeBSD's copy of getfh(2), which doesn't include a `fh_size` parameter.
Use sizeof(fhandle_t) instead as the size of fhp is always fixed as
fhandle_t, unlike NetBSD's copy of fhp, which is void*.

r307204:

Expect :large to fail on FreeBSD

FreeBSD doesn't appear to validate large -o size values like
NetBSD does

PR: 212862

r307205:

Change atf_skip call to atf_expect_fail to make it clear that a failure is
expected

PR: 212861
Suggested by: jmmv

r307701:

Expect tests/sys/fs/tmpfs/link_test:kqueue to fail

It fails with: "dir/b did not receive NOTE_LINK"

Also, add needed cleanup logic to cleanup the mountpoint after the fact

PR: 213662

r307702:

Integrate contrib/netbsd-tests/fs/tmpfs into the FreeBSD test suite
as tests/sys/fs

These testcases exercise tmpfs support

309661 07-Dec-2016 ngie

MFC r306962:
r306962 (by br):

Ensure data in pipe is available to read.
Useful for latest (5th, direct mode) test only.

309469 03-Dec-2016 ngie

MFC r304797,r305467,r305468,r305483:

r304797 (by jmmv):

Make use of Kyua's work directories.

Change the vnode tests to use the current directory when creating temporary
files, which we can assume is a volatile work directory, and then make the
kqueue_test.sh driver _not_ abandon the directory created by Kyua.

This makes the various kqueue tests independent of each other, and ensures
the temporary file is cleaned up on failure.

Problem spotted by asomers@ when reviewing D4254.

r305467:

Move tests/sys/kqueue/... to tests/sys/kqueue/libkqueue/...

This is being done to clearly distinguish the libkqueue tests
from the (soon to be imported) NetBSD tests.

r305468:

Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/...

proc2_test must be skipped because the invariant tested
(`ke.fflags & NOTE_TRACKERR`) doesn't pass.

r305483:

Fix tests/sys/kqueue NetBSD tests on 32-bit platforms by using proper
format specifier for pointers when printing them out with printf(3)

Pointyhat to: ngie

308701 15-Nov-2016 hiren

MFC r302474 (By gnn)

On FreeBSD there is a setsockopt option SO_USER_COOKIE which allows
setting a 32 bit value on each socket. This can be used by applications
and DTrace as a rendezvous point so that an applicaton's data can
more easily be captured at run time. Expose the user cookie via
DTrace by updating the translator in tcp.d and add a quick test
program, a TCP server, that sets the cookie on each connection
accepted.

Sponsored by: Limelight Networks

307723 21-Oct-2016 ngie

MFC r305963,r305970:

r305963:

Reindent TESTSDIR definition for consistency/readability

r305970:

Remove change accidentally committed via r305963 for upcoming tests/sys/fs/...
work

307715 21-Oct-2016 ngie

MFC r305916,r305918:

r305916:

Make sure $TMPDIR is created with 0755 permissions

This is required to ensure that the temporary script can be executed,
as the default mode is apparently too restrictive

r305918:

Only chmod $TMPDIR if it's not /tmp

This is a safety belt to ensure that the /tmp sticky bit stuff doesn't
get whacked by accident if someone runs the script outright

307004 10-Oct-2016 jilles

MFC r305676: wait: Do not copyout uninitialized status/rusage/wrusage.

If wait4() or wait6() return 0 because of WNOHANG, the status, rusage and
wrusage information should not be returned.

PR: 212048
Reported by: Casey Lucas

306905 09-Oct-2016 kib

MFC r306588:
Export the mq_getfd_np() and timer_oshandle_np() symbols from librt.so.

305914 18-Sep-2016 ngie

MFC r305357:

Skip testcases 9/10 if jail(8) isn't installed

These testcases require jail support

305912 18-Sep-2016 ngie

MFC r305356:

Add a missing "Bail out!" if zpool create fails

This will make the exit info more meaningful if/when zpool create fails,
and establishes parity with the other 2 zfs acl testcases (01, 03).

304947 28-Aug-2016 ngie

MFC r304238:

Only expect :encode_tv_random_million to fail on 64-bit platforms

It passes on i386

304946 28-Aug-2016 ngie

MFC r304040:

Redirect the output of the testcases to stderr instead of
redirecting it to /dev/null

This will aid in debugging failures

304499 19-Aug-2016 jhb

MFC 303001: Add PTRACE_VFORK to trace vfork events.

First, PL_FLAG_FORKED events now also set a PL_FLAG_VFORKED flag when
the new child was created via vfork() rather than fork(). Second, a
new PL_FLAG_VFORK_DONE event can now be enabled via the PTRACE_VFORK
event mask. This new stop is reported after the vfork parent resumes
due to the child calling exit or exec. Debuggers can use this stop to
reinsert breakpoints in the vfork parent process before it resumes.

304188 15-Aug-2016 jhb

MFC 302900,302902,302921,303461,304009:
Add a mask of optional ptrace() events.

302900:
Add a test for user signal delivery.

This test verifies we get the correct ptrace event details when a signal
is posted to a traced process from userland.

302902:
Add a mask of optional ptrace() events.

ptrace() now stores a mask of optional events in p_ptevents. Currently
this mask is a single integer, but it can be expanded into an array of
integers in the future.

Two new ptrace requests can be used to manipulate the event mask:
PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK
sets the current event mask.

The current set of events include:
- PTRACE_EXEC: trace calls to execve().
- PTRACE_SCE: trace system call entries.
- PTRACE_SCX: trace syscam call exits.
- PTRACE_FORK: trace forks and auto-attach to new child processes.
- PTRACE_LWP: trace LWP events.

The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have
been replaced by PTRACE_SCE and PTRACE_SCX. PTRACE_FORK replaces
P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.

The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for
compatibility but now simply toggle corresponding flags in the
event mask.

While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both
modify the event mask and continue the traced process.

302921:
Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.

303461:
Note that not all optional ptrace events use SIGTRAP.

New child processes attached due to PTRACE_FORK use SIGSTOP instead of
SIGTRAP. All other ptrace events use SIGTRAP.

304009:
Remove description of P_FOLLOWFORK as this flag was removed.

303787 05-Aug-2016 jhb

MFC 303406,303501: Fix panic when using aio_fsync().

303406:
Adjust tests in fsync job scheduling loop to reduce indentation.

303501:
Fix locking issues with aio_fsync().

- Use correct lock in aio_cancel_sync when dequeueing job.
- Add _locked variants of aio_set/clear_cancel_function and use those
to avoid lock recursion when adding and removing fsync jobs to the
per-process sync queue.
- While here, add a basic test for aio_fsync().

PR: 211390
Approved by: re (kib)

302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
302180 24-Jun-2016 asomers

Fix bitstring allocation on 32-bit platforms

sys/sys/bitstring.h
Fix a rounding calculation that could undersize a bitstring on
32-bit platforms.

tests/sys/sys/bitstring_test.h
Add a test for bitstr_size

PR: 210260
Reported by: Mark Millard
Reviewed by: gibbs
Approved by: re (marius)
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6848


302074 21-Jun-2016 jhb

Account for AIO socket operations in thread/process resource usage.

File and disk-backed I/O requests store counts of read/written disk
blocks in each AIO job so that they can be charged to the thread that
completes an AIO request via aio_return() or aio_waitcomplete(). This
change extends AIO jobs to store counts of received/sent messages and
updates socket backends to set these counts accordingly. Note that
the socket backends are careful to only charge a single messages for
each AIO request even though a single request on a blocking socket might
invoke sosend or soreceive multiple times. This is to mimic the
resource accounting of synchronous read/write.

Adjust the UNIX socketpair AIO test to verify that the message resource
usage counts update accordingly for aio_read and aio_write.

Approved by: re (hrs)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D6911


302036 20-Jun-2016 asomers

Skip sys/acl tests on systems lacking perl

tests/sys/acl/Makefile
add perl to the required_programs for all tests in this directory

Reviewed by: ngie
Approved by: re (gjb)
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6870


300882 27-May-2016 asomers

Always create loopback routes on every fib

Always create loopback routes on every fib, for both IPv4 and IPv6

etc/rc.d/routing
Create loopback IPv4 and IPv6 routes on every fib at boot. Revert
278302; now that all FIBs have IPv6 loopback routes, the
"route add -reject" commands won't fail.

tests/etc/rc.d/routing_test.sh
Greatly simplify static_ipv6_loopback_route_for_each_fib. It was
written under the assumption that loopback routes would be added to
a given fib by the kernel as soon as an interface is configured on
that fib. However, the logic can be much simpler now that we simply
add loopback routes to all fibs at boot. This also removes the need
to run the test as root, removes the restriction that
net.add_addr_allfibs=0, and removes the need to configure fibs in
kyua.conf.

Also, add a test case for IPv4 loopback routes

Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6582


300626 24-May-2016 jhb

Return the correct status when a partially completed request is cancelled.

After the previous changes to fix requests on blocking sockets to complete
across multiple operations, an edge case exists where a request can be
cancelled after it has partially completed. POSIX doesn't appear to
dictate exactly how to handle this case, but in general I feel that
aio_cancel() should arrange to cancel any request it can, but that any
partially completed requests should return a partial completion rather
than ECANCELED. To that end, fix the socket AIO cancellation routine to
return a short read/write if a partially completed request is cancelled
rather than ECANCELED.

Sponsored by: Chelsio Communications


300556 24-May-2016 jhb

Don't prematurely return short completions on blocking sockets.

Always requeue an AIO job at the head of the socket buffer's queue if
sosend() or soreceive() returns EWOULDBLOCK on a blocking socket.
Previously, requests were only requeued if they returned EWOULDBLOCK
and completed no data. Now after a partial completion on a blocking
socket the request is queued and the remaining request is retried when
the socket is ready. This allows writes larger than the currently
available space on a blocking socket to fully complete. Reads on a
blocking socket that satifsy the low watermark can still return a short
read (same as read()).

In order to track previously completed data, the internal 'status'
field of the AIO job is used to store the amount of previously
computed data.

Non-blocking sockets continue to return short completions for both
reads and writes.

Add a test for a "large" AIO write on a blocking socket that writes
twice the socket buffer size to a UNIX domain socket.

Sponsored by: Chelsio Communications


300539 23-May-2016 asomers

Add bit_count to the bitstring(3) api

Add a bit_count function, which efficiently counts the number of bits set in
a bitstring.

sys/sys/bitstring.h
tests/sys/sys/bitstring_test.c
share/man/man3/bitstring.3
Add bit_alloc

sys/kern/subr_unit.c
Use bit_count instead of a naive counting loop in check_unrhdr, used
when INVARIANTS are enabled. The userland test runs about 6x faster
in a generic build, or 8.5x faster when built for Nehalem, which has
the POPCNT instruction.

sys/sys/param.h
Bump __FreeBSD_version due to the addition of bit_alloc

UPDATING
Add a note about the ABI incompatibility of the bitstring(3)
changes, as suggested by lidl.

Suggested by: gibbs
Reviewed by: gibbs, ngie
MFC after: 9 days
X-MFC-With: 299090, 300538
Relnotes: yes
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6255


300538 23-May-2016 asomers

Commit a missing change from 299090

tests/sys/kern/Makefile
Reenable a disabled compiler warning, the need for which was
eliminated by r299090.

Reviewed by: ngie
MFC after: 4 weeks
X-MFC-With: 299090
Sponsored by: Spectra Logic Corp


299508 12-May-2016 cem

kern_descrip_test: Fix trivial buffer overrun with readlink(2)

Reported by: Coverity
CID: 1229965, 1229972
Sponsored by: EMC / Isilon Storage Division


299094 04-May-2016 ngie

Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
namespacing is kept with FILES appropriately, and that this shouldn't need
to be repeated if the namespace changes -- only the definition of PACKAGE
needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
`tests`. In the event we get to the point where things can be split up
enough in the base system, it would make more sense to group the tests
with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division


299090 04-May-2016 asomers

Improve performance and functionality of the bitstring(3) api

Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which allow
for efficient searching of set or cleared bits starting from any bit offset
within the bit string.

Performance is improved by operating on longs instead of bytes and using
ffsl() for searches within a long. ffsl() is a compiler builtin in both
clang and gcc for most architectures, converting what was a brute force
while loop search into a couple of instructions.

All of the bitstring(3) API continues to be contained in the header file.
Some of the functions are large enough that perhaps they should be uninlined
and moved to a library, but that is beyond the scope of this commit.

sys/sys/bitstring.h:
Convert the majority of the existing bit string implementation from
macros to inline functions.

Properly protect the implementation from inadvertant macro expansion
when included in a user's program by prefixing all private
macros/functions and local variables with '_'.

Add bit_ffs_at() and bit_ffc_at(). Implement bit_ffs() and
bit_ffc() in terms of their "at" counterparts.

Provide a kernel implementation of bit_alloc(), making the full API
usable in the kernel.

Improve code documenation.

share/man/man3/bitstring.3:
Add pre-exisiting API bit_ffc() to the synopsis.

Document new APIs.

Document the initialization state of the bit strings
allocated/declared by bit_alloc() and bit_decl().

Correct documentation for bitstr_size(). The original code comments
indicate the size is in bytes, not "elements of bitstr_t". The new
implementation follows this lead. Only hastd assumed "elements"
rather than bytes and it has been corrected.

etc/mtree/BSD.tests.dist:
tests/sys/Makefile:
tests/sys/sys/Makefile:
tests/sys/sys/bitstring.c:
Add tests for all existing and new functionality.

include/bitstring.h
Include all headers needed by sys/bitstring.h

lib/libbluetooth/bluetooth.h:
usr.sbin/bluetooth/hccontrol/le.c:
Include bitstring.h instead of sys/bitstring.h.

sbin/hastd/activemap.c:
Correct usage of bitstr_size().

sys/dev/xen/blkback/blkback.c
Use new bit_alloc.

sys/kern/subr_unit.c:
Remove hard-coded assumption that sizeof(bitstr_t) is 1. Get rid of
unrb.busy, which caches the number of bits set in unrb.map. When
INVARIANTS are disabled, nothing needs to know that information.
callapse_unr can be adapted to use bit_ffs and bit_ffc instead.
Eliminating unrb.busy saves memory, simplifies the code, and
provides a slight speedup when INVARIANTS are disabled.

sys/net/flowtable.c:
Use the new kernel implementation of bit-alloc, instead of hacking
the old libc-dependent macro.

sys/sys/param.h
Update __FreeBSD_version to indicate availability of new API

Submitted by: gibbs, asomers
Reviewed by: gibbs, ngie
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6004


298811 29-Apr-2016 asomers

Automate the subr_unit test.

Build and install the subr_unit test program originally written by phk, and
run it with the other ATF tests.

tests/sys/kern/Makefile
* Build and install the subr_unit test as a plain test

sys/kern/subr_unit.c
* Reduce the default number of repetitions from 100 to 1, and add a
command-line parser to override it.
* Don't be so noisy by default
* Fix an include problem for the test build

Reviewed by: ngie
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6038


298768 29-Apr-2016 gjb

Fix including Kyuafile in packaged base system.

Fix a related typo while here.

Note, this change results in the Kyuafile inclusion in the runtime
package, which needs to be fixed, however addresses the PR as far
as I can tell in my tests.

PR: 209114
Submitted by: ngie
Sponsored by: The FreeBSD Foundation


298304 19-Apr-2016 ngie

Fix issues identified by Coverity

- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
cached value instead of always calling getpagesize(3).
- Remove intermediate variable for assigning from $TMPDIR if set in the
environment to eliminate warnings about pointer conversions with "/tmp",
and to mute an invalid buffer overflow concern from Coverity
(snprintf and tacking on a NUL terminator was alleviating that concern
before).
- Remove useless self-test of psize before it's initialized.
- Check the return values of getrlimit/setrlimit.

Cosmetic changes:
- Replace a `(void*)0` with NULL.
- Do some minor whitespace clean up.
- Remove an unnecessary cast to mmap.
- Make all munmap calls use ATF_REQUIRE_MSG instead of using the:

> if (munmap(..) == -1)
> atf_tc_fail(..)

idiom. Employ the new idiom consistently when calling munmap.

CID: 1331351, 1331382-1331386, 1331513, 1331514, 1331565, 1331583, 1331694
Differential Revision: https://reviews.freebsd.org/D6012
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: markj
Sponsored by: EMC / Isilon Storage Division


298301 19-Apr-2016 ngie

Fix leaks and test for getpagesize() returning == -1

- close file descriptors after use.
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
cached value instead of always calling getpagesize(3).

CID: 1331374-1331377, 1331653-1331662
Differential Revision: https://reviews.freebsd.org/D6011
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division


298196 18-Apr-2016 ngie

Minor cosmetic cleanup

- Remove spurious trailing whitespace in licensing header
- Remove unnecessary semi-colon after comment [*]

MFC after: 3 days
Submitted by: pfg [*]
Sponsored by: EMC / Isilon Storage Division


298107 16-Apr-2016 gjb

Merge the projects/release-pkg branch to head.

This allows packaging the base system with pkg(8), including
but not limited to providing the ability to provide upstream
binary update possibilities for non-tier-1 architectures.

This merge is a requirement of the 11.0-RELEASE, and as such,
thank you to everyone that has tested the project branch.

Documentation in build(7) etc. is still somewhat sparse, but
updates to those parts will follow.

Sponsored by: The FreeBSD Foundation


298090 16-Apr-2016 jhb

Add a test for cancelling an active AIO request on a socket.

The older AIO code awakened all pending AIO requests on a socket
when any data arrived. This could result in AIO daemons blocking on
an empty socket buffer. These requests could not be cancelled
which led to a deadlock during process exit. This test reproduces
this case. The newer AIO code is able to cancel the pending AIO
request correctly.

Reviewed by: ngie (-ish)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D4363


298024 15-Apr-2016 ngie

Set test_argv to NULL, not 0, if not executing a specific test

MFC after: 1 week
Submitted by: pfg
Sponsored by: EMC / Isilon Storage Division


297474 31-Mar-2016 jhb

Correct error messages in recently added test.

The large read test uses an empty file created via mkstemp() rather than
/dev/null as character devices are subject to two different clamping
sysctls. However, I forgot to update some of the error messages after
changing to mkstemp() that were still referring to /dev/null.


297183 22-Mar-2016 ngie

Use a SKIP testplan instead of bailing out if/when the tester isn't
root, or the geom class can't be loaded cleanly [*]

This makes sure that scenarios that are easy to hit aren't counted
as false positives with kyua test

MFC after: 1 week
PR: 208101
Sponsored by: EMC / Isilon Storage Division


297167 21-Mar-2016 jhb

Fully handle size_t lengths in AIO requests.

First, update the return types of aio_return() and aio_waitcomplete() to
ssize_t.

POSIX requires aio_return() to return a ssize_t so that it can represent
all return values from read() and write(). aio_waitcomplete() should use
ssize_t for the same reason.

aio_return() has used ssize_t in <aio.h> since r31620 but the manpage and
system call entry were not updated. aio_waitcomplete() has always
returned int.

Note that this does not require new system call stubs as this is
effectively only an API change in how the compiler interprets the return
value.

Second, allow aio_nbytes values up to IOSIZE_MAX instead of just INT_MAX.

aio_read/write should now honor the same length limits as normal read/write.

Third, use longs instead of ints in the aio_return() and aio_waitcomplete()
system call functions so that the 64-bit size_t in the in-kernel aiocb
isn't truncated to 32-bits before being copied out to userland or
being returned.

Finally, a simple test has been added to verify the bounds checking on the
maximum read size from a file.


296587 09-Mar-2016 bdrewery

DIRDEPS_BUILD: Connect MK_TESTS.

Sponsored by: EMC / Isilon Storage Division


296277 01-Mar-2016 jhb

Refactor the AIO subsystem to permit file-type-specific handling and
improve cancellation robustness.

Introduce a new file operation, fo_aio_queue, which is responsible for
queueing and completing an asynchronous I/O request for a given file.
The AIO subystem now exports library of routines to manipulate AIO
requests as well as the ability to run a handler function in the
"default" pool of AIO daemons to service a request.

A default implementation for file types which do not include an
fo_aio_queue method queues requests to the "default" pool invoking the
fo_read or fo_write methods as before.

The AIO subsystem permits file types to install a private "cancel"
routine when a request is queued to permit safe dequeueing and cleanup
of cancelled requests.

Sockets now use their own pool of AIO daemons and service per-socket
requests in FIFO order. Socket requests will not block indefinitely
permitting timely cancellation of all requests.

Due to the now-tight coupling of the AIO subsystem with file types,
the AIO subsystem is now a standard part of all kernels. The VFS_AIO
kernel option and aio.ko module are gone.

Many file types may block indefinitely in their fo_read or fo_write
callbacks resulting in a hung AIO daemon. This can result in hung
user processes (when processes attempt to cancel all outstanding
requests during exit) or a hung system. To protect against this, AIO
requests are only permitted for known "safe" files by default. AIO
requests for all file types can be enabled by setting the new
vfs.aio.enable_usafe sysctl to a non-zero value. The AIO tests have
been updated to skip operations on unsafe file types if the sysctl is
zero.

Currently, AIO requests on sockets and raw disks are considered safe
and are enabled by default. aio_mlock() is also enabled by default.

Reviewed by: cem, jilles
Discussed with: kib (earlier version)
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D5289


295786 19-Feb-2016 markj

Ensure that we test the event condition when a disabled kevent is enabled.

r274560 modified kqueue_register() to only test the event condition if the
corresponding knote is not disabled. However, this check takes place before
the EV_ENABLE flag is used to clear the KN_DISABLED flag on the knote, so
enabling a previously-disabled kevent would not result in a notification for
a triggered event. This change fixes the problem by testing for EV_ENABLED
before possibly checking the event condition.

This change also updates a kqueue regression test to exercise this case.

PR: 206368
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5307


295643 16-Feb-2016 bdrewery

Test directories can build in parallel fine.

Sponsored by: EMC / Isilon Storage Division


295477 10-Feb-2016 ngie

Similar to r295116, add an additional 1 second sleep after calling ggatel
before calling dd to defeat a race when writing out to the geom_gate(4)
device

MFC after: 1 month
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division


295345 06-Feb-2016 ngie

Use basenames for getfacl, setfacl, and zpool to work around the
fact that Jenkins hardcodes image sizes to 2GB with the FreeBSD_HEAD
job

This is to stop the unnecessary failure emails because we've gone
over the 2GB limit

MFC after: 1 week
X-MFC with: r295341
Sponsored by: EMC / Isilon Storage Division


295341 05-Feb-2016 ngie

Require /bin/getfacl and /bin/setfacl when running the acl tests

For cases where these utilities aren't installed, the tests would fail today
in a non-intuitive manner on sub-testcase #3 in each of the test scripts

MFC after: 1 week
Reviewed by: markj
Sponsored by: EMC / Isilon Storage Division


295117 01-Feb-2016 ngie

Use the pidfile support added to ggated(8) in r294973 to ensure that the
ggated(8) daemon used by the tests is the instance specifically invoked by
the tests instead of one or more daemon instances running on the system

MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division


295116 01-Feb-2016 ngie

Add an additional 1 second sleep to after calling ggatec before calling
dd to defeat a race when writing out to the geom_gate(4) device

This will quell the Jenkins failure emails until I come up with a better
solution

MFC after: 1 month
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division


295012 28-Jan-2016 vangyzen

kqueue EVFILT_PROC: avoid collision between NOTE_CHILD and NOTE_EXIT

NOTE_CHILD and NOTE_EXIT return something in kevent.data: the parent
pid (ppid) for NOTE_CHILD and the exit status for NOTE_EXIT.
Do not let the two events be combined, since one would overwrite
the other's data.

PR: 180385
Submitted by: David A. Bright <david_a_bright@dell.com>
Reviewed by: jhb
MFC after: 1 month
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D4900


293880 14-Jan-2016 ngie

PID file support hasn't been committed for ggated(8) yet. Unbreak running
the testcase more than once by restoring the "killall ggated"

MFC after: 15 days
Sponsored by: EMC / Isilon Storage Division


293878 14-Jan-2016 ngie

Remove unnecessary kldload logic added to geom_subr.sh in r293028

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


293821 13-Jan-2016 ngie

Integrate
tools/regression/geom_{concat,eli,gate,mirror,nop,raid3,shsec,stripe,uzip}
in to the FreeBSD test suite as
tests/sys/geom/class/{concat,eli,gate,mirror,nop,raid3,shsec,stripe,uzip}

The tools/regression/geom and tools/regression/geom_part testcases are being
left alone because both test sets are both currently broken.

The majority of this work was done on ^/user/ngie/more-tests2 . The differences
are as follows:
- tests/sys/geom/class/Makefile.inc is not present; it was
inlined into the class's Makefiles for explicitness.
- The testcases officially require root via kyua
- The geom_gate(4) tests don't use the pidfile changes proposed in
https://reviews.freebsd.org/D4836 .

MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division


292957 30-Dec-2015 ngie

Rename `recvfd` and `sendfd` variables in recvfd/sendfd functions to avoid
-Wshadow issues with gcc

MFC after: 1 week
Reported by: bz, jenkins
Sponsored by: EMC / Isilon Storage Division


292914 30-Dec-2015 ngie

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


292894 29-Dec-2015 jhb

Add ptrace(2) reporting for LWP events.

Add two new LWPINFO flags: PL_FLAG_BORN and PL_FLAG_EXITED for reporting
thread creation and destruction. Newly created threads will stop to report
PL_FLAG_BORN before returning to userland and exiting threads will stop to
report PL_FLAG_EXIT before exiting completely. Both of these events are
only enabled and reported if PT_LWP_EVENTS is enabled on a process.


292822 28-Dec-2015 ngie

Remove retval to fix a -Wunused-but-set-variable warning from gcc 4.9

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


292821 28-Dec-2015 ngie

- Remove unused but set ssize in shutdown_send_sigpipe
- Add #ifdef TEST_SEQ_PACKET_SOURCE_ADDRESS` for untestable code
because FreeBSD doesn't have a means to map source addresses for
SEQ_PACKET AF_UNIX sockets (paraphrased). Put pathname variable
under the #ifdef to mute another unused but set variable warning

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


292820 28-Dec-2015 ngie

Clean trailing whitespace

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


292819 28-Dec-2015 ngie

- Fix an improperly sized buffer for `pathname` [1]
- Fix a -Wunused-but-set-variable warning [2]

MFC after: 1 week
Reported by: cppcheck [1], gcc 4.9 [2]
Sponsored by: EMC / Isilon Storage Division


292818 28-Dec-2015 ngie

Fix style(9) a bit and ensure that error from initializing kqueue(2) is
sane

- Push the kqueue(2) initialization down so the errno will correspond with
the failure instead of potentially being stomped on by functions called
by `PLAIN_REQUIRE_KERNEL_MODULE`
- Delete trailing whitespace
- Add spaces between braces for conditional and control blocks (for/if)
- Use err/errx instead of perror+printf+exit/printf+exit.
- Remove braces for single-line conditionals

Tested with and without -DDEBUG

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


292816 28-Dec-2015 ngie

Place cancel and error under #ifdef DEBUG to mute
-Wunused-but-set-variable warnings reported by gcc 4.9

Remove some trailing whitespace as well

Tested with and without -DDEBUG

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


292651 23-Dec-2015 ngie

Delete the comment about running `test_libugidfw_strings` before testing
`mac_is_present` so it doesn't accidentally confuse people

MFC after: 3 days
X-MFC with: r292650
Sponsored by: EMC / Isilon Storage Division


292650 23-Dec-2015 ngie

Move mac_bsdextended check up before running the test_libugidfw_strings testcases

I realize that these tests could be run before mac_bsdextended is loaded, but
it would overcomplicate things to special case handle the testcases before doing
the mac_bsdextended(4) feature check

The testcases will be split up so they can be run separately in the near future

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division


292582 22-Dec-2015 ngie

Dump out the output from flock_helper on failure so failures with the
test app can be debugged

MFC after: 1 week
Obtained from: Isilon OneFS (^/onefs/head@r511419)
Sponsored by: EMC / Isilon Storage Division


292570 21-Dec-2015 ngie

Integrate tools/regression/mac/mac_bsdextended and
tools/regression/mac/mac_portacl into the FreeBSD test suite as
tests/sys/mac/bsdextended and tests/sys/mac/portacl, respectively

MFC after: 1 month
Sponsored by: EMC / Isilon Storage Division


292319 16-Dec-2015 ngie

Add ATF_REQUIRE_FEATURE and PLAIN_REQUIRE_FEATURE macros for
testing for kernel features via the feature_present(3) libcall

The semantics are similar to the other macros in the header (skip
testcase with ATF macro; exit with appropriate exit code with the
PLAIN macro)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


291738 04-Dec-2015 bdrewery

Fix LDADD/DPADD that should be LIBADD.

Sponsored by: EMC / Isilon Storage Division


291575 01-Dec-2015 ngie

Disable mqueue test # 3 and # 4 until __mq_oshandle is properly publicized

This will unbreak the test script and make things green again after r291440

Sponsored by: EMC / Isilon Storage Division


291440 29-Nov-2015 deischen

Disable a couple of tests, perhaps temporarily, since they use private
symbols that are not exported from librt.


291331 25-Nov-2015 bdrewery

Avoid requiring 'make depend' here.

Really this should not be a DPSRCS. The acct_test.c should not #include
convert.c, but just link it in as a normal SRCS.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


291181 23-Nov-2015 ngie

Integrate contrib/netbsd-tests/kernel/t_mqueue into the FreeBSD test
suite as tests/sys/kern/mqueue_test

MFC after: 1 week


291180 23-Nov-2015 ngie

Fix up convert.c generation

- Use a temporary file for convert.c to reduce likelihood of an interrupted
build resulting in bad code being written to convert.c
- Truncate the file instead of appending to it to ensure that the file being
touched will not result in duplicate declarations/definitions from
kern_acct.c if/when kern_acct.c changes.

MFC after: 1 week


291089 20-Nov-2015 rodrigc

Copy README into /usr/tests

Add a few sentences describing how to run the tests.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D4224


290914 16-Nov-2015 ngie

Integrate tools/regression/pipe in to the FreeBSD test suite as
tests/sys/kern/pipe

- Fix style(9) bugs
- Fix compiler warnings
- Use `nitems(x)` instead of `sizeof(x) / sizeof(*x)` pattern

The testcases will be converted over to ATF eventually, but for now will be
integrated in as plain C tests

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


290912 16-Nov-2015 ngie

Integrate contrib/netbsd-tests/kernel/t_lockf.c into the FreeBSD test suite as
tests/sys/kern/lockf_test

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


290905 16-Nov-2015 ngie

Integrate acct(2) testcase in as tests/sys/kern/acct/acct_test

The :encode_tv_random_million testcase fails the epsilon tests a few thousand
times out of one million, so expect the testcase to fail

MFC after: 1 week
Submitted by: keramida
Sponsored by: EMC / Isilon Storage Division


289603 19-Oct-2015 kib

Add tests for the copyin(9) handling of illegal buffers.

Reviewed by: emaste, ngie
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D3925


289446 17-Oct-2015 ngie

Integrate tools/regression/acltools into the FreeBSD test suite as tests/sys/acl

- Make the requirements more complete for the testcases
- Detect prerequisites so the tests won't fail (zfs.ko is loaded, zpool(1)
is available, ACL support is enabled with UFS, etc).
- Work with temporary files/directories/mountpoints that work with atf/kyua
- Limit the testcases to work on temporary filesystems to reduce tainting the
test host

MFC after: 2 weeks
Reviewed by: trasz (earlier version)
Differential Revision: https://reviews.freebsd.org/D3810


289441 17-Oct-2015 ngie

Integrate tools/test/posixshm and tools/regression/posixshm into the FreeBSD
test suite as tests/sys/posixshm

Some other highlights:
- Convert the testcases over to ATF
- Don't use hardcoded paths to /tmp (which violate the ATF/kyua samdbox); use
mkstemp to generate temporary paths for non-SHM_ANON shm objects.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


289393 15-Oct-2015 bdrewery

Add more SUBDIR_PARALLEL.

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


289300 14-Oct-2015 ngie

Integrate tools/regression/vfs into the FreeBSD test suite as tests/sys/vfs

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


289172 12-Oct-2015 ngie

Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison


288962 06-Oct-2015 jhb

Tweak: use 'mainlwp' instead of 'mainpid' since this is a thread (LWP)
identifier, not a pid.


288961 06-Oct-2015 bdrewery

Fix build with older GCC which, doesn't like 'main' being a variable name.


288949 06-Oct-2015 jhb

Fix various edge cases related to system call tracing.
- Always set td_dbg_sc_* when P_TRACED is set on system call entry
even if the debugger is not tracing system call entries. This
ensures the fields are valid when reporting other stops that
occur at system call boundaries such as for PT_FOLLOW_FORKS or
when only tracing system call exits.
- Set TDB_SCX when reporting the stop for a new child process in
fork_return(). This causes the event to be reported as a system
call exit.
- Report a system call exit event in fork_return() for new threads in
a traced process.
- Copy td_dbg_sc_* to new threads instead of zeroing. This ensures
that td_dbg_sc_code in particular will report the system call that
created the new thread or process when it reports a system call
exit event in fork_return().
- Add new ptrace tests to verify that new child processes and threads
report system call exit events with a valid pl_syscall_code via
PT_LWPINFO.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D3822


288683 05-Oct-2015 ngie

Revert r288682

I meant to do this on ^/user/ngie/more-tests

Pointyhat to: ngie (use svn info next time...)


288682 05-Oct-2015 ngie

Remove some paths preparing for a re-copy from head


287602 09-Sep-2015 jhb

Use _exit() instead of exit() in child processes created during tests.

Suggested by: kib


287601 09-Sep-2015 jhb

Add a test to verify that a traced process sees its original parent via
getppid() after a debugger process that is not the parent has attached.

Reviewed by: kib (earlier version)
Differential Revision: https://reviews.freebsd.org/D3615


287600 09-Sep-2015 jhb

Properly size the children[] arrays in the follow fork tests.


287448 04-Sep-2015 jhb

Add more mmap tests related to character devices.
- Add cdev-related tests for bad args.
- Add two simple tests cases for mapping /dev/zero that test for
MAP_ANON-like behavior.

Reviewed by: alc, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D3323


286370 06-Aug-2015 jhb

Add various tests to ensure that invalid arguments passed to mmap()
trigger failures.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D3269


286369 06-Aug-2015 jhb

Convert the map_at_zero test case to ATF. In particular, this will
facilitate adding more mmap() tests.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3268


286158 01-Aug-2015 jhb

Clear P_TRACED before reparenting a detached process back to its
original parent. Otherwise the debugee will be set as an orphan of
the debugger.

Add tests for tracing forks via PT_FOLLOW_FORK.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D2809


286011 29-Jul-2015 pluknet

Fixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed).


285891 26-Jul-2015 rodrigc

Pass unsigned long argument to ioctl().

Eliminates "ioctl sign-extension" warnings.

PR: 200896


285184 05-Jul-2015 markj

The bug caught by flock's test 16 was fixed by r268384.

MFC after: 3 days


285117 04-Jul-2015 jmmv

Make cleanup routines idempotent

cleanup routines can be executed at any point during the execution of the
body, including even before the body has done any real work. In those
cases, cleanup routines should be careful to not raise spurious errors so
as to not "override" the actual result of the test case.

This is just general good coding style but is not a problem in practice
for these specific tests. (The way I discovered the issue, though, was
due to a regression I introduced in Kyua itself while refactoring some
internals.)

MFC after: 1 week


284289 11-Jun-2015 sjg

Misc fixes from projects/bmake

Differential Revision: D2748
Reviewed by: brooks imp


284000 04-Jun-2015 jhb

Add a CHILD_REQUIRE macro similar to ATF_REQUIRE for use in child processes
of the main test process.

Differential Revision: https://reviews.freebsd.org/D2664
Reviewed by: ngie (previous version)


283845 31-May-2015 ngie

Append to SUBDIR, not set it

Pointyhat to: ngie


283836 31-May-2015 jhb

Consistently only use one end of the pipe in the parent and debugger
processes and do not rely on EOF due to a close() in the debugger.

PR: 200489
Differential Revision: https://reviews.freebsd.org/D2674
Reviewed by: kib, ngie, rodrigc


283647 28-May-2015 jhb

Tweak the description of when waitpid() doesn't return any status for a
non-blocking wait to avoid the word "empty".

Requested by: ngie


283562 26-May-2015 jhb

Do not allow a process to reap an orphan (a child currently being
traced by another process such as a debugger). The parent process does
need to check for matching orphan pids to avoid returning ECHILD if an
orphan has exited, but it should not return the exited status for the
child until after the debugger has detached from the orphan process
either explicitly or implicitly via wait().

Add two tests for for this case: one where the debugger is the direct
child (thus the parent has a non-empty children list) and one where
the debugger is not a direct child (so the only "child" of the parent
is the orphan).

Differential Revision: https://reviews.freebsd.org/D2644
Reviewed by: kib
MFC after: 2 weeks


283282 22-May-2015 jhb

Only reparent a traced process to its old parent if the tracing process is
not the old parent. Otherwise, proc_reap() will leave the zombie in place
resulting in the process' status being returned twice to its parent.

Add test cases for PT_TRACE_ME and PT_ATTACH which are fixed by
this change.

Differential Revision: https://reviews.freebsd.org/D2594
Reviewed by: kib
MFC after: 2 weeks


283056 18-May-2015 ngie

Move all test integration pieces for etc/ from etc/ to tests/

This is being done to fix breakage with make distribution with read-only
source trees as make distribution doesn't use make obj like building
tests/ does in all cases

Reported by: Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
Suggested by: jhb
X-MFC with: r282059
MFC after: 1 week


282244 29-Apr-2015 ngie

Fix typo. It should have been atf_tc_skip, not atf_skip

Reported by: many, Jenkins
Pointyhat to: ngie
MFC after: 4 days


282211 29-Apr-2015 ngie

ATF_REQUIRE_KERNEL_MODULE: use atf_skip, not ATF_REQUIRE_MSG so the testcase
no longer bombs out
PLAIN_REQUIRE_KERNEL_MODULE: use printf + _exit, no err so the testcase no
longer bombs out if it prints to stderr

MFC after: 5 days


282138 28-Apr-2015 ngie

Adjust CFLAGS to find freebsd_test_suite/macros.h

MFC after: 6 days


282137 28-Apr-2015 ngie

Use PLAIN_REQUIRE_KERNEL_MODULE to require "mqueuefs"

MFC after: 6 days


282136 28-Apr-2015 ngie

- Use ATF_REQUIRE_KERNEL_MDOULE to require aio(4)
- Don't use /tmp as a basis for temporary files as it's outside of the ATF
sandbox
- Don't override MAX macro in sys/param.h

MFC after: 6 days


282135 28-Apr-2015 ngie

Use ATF_REQUIRE_KERNEL_MODULE instead of aio_available function

MFC after: 6 days


282134 28-Apr-2015 ngie

Add initial (unpolished) macros for interfacing with the FreeBSD test suite

This is very rough, but will be replaced/redesigned some time soon after I fix
the Jenkins breakage I introduced

MFC after: 6 days


282133 28-Apr-2015 ngie

Fill in the copyright boilerplate for the test program

MFC after: 6 days


282104 27-Apr-2015 ngie

Move tests/sys/kern/mmap_test to tests/sys/vm/mmap_test

As jhb noted, the actual mmap(2) implementation is under sys/vm, not
sys/kern/, so the correct logical place is tests/sys/vm/, not
tests/sys/kern/

X-MFC with: r282076
MFC after: 6 days


282076 27-Apr-2015 ngie

Integrate tools/regression/mmap into the FreeBSD test suite as
tests/sys/kern/mmap_test

MFC after: 1 week


282074 27-Apr-2015 ngie

Integrate tools/regression/aio/aiotest and tools/regression/aio/kqueue into the
FreeBSD test suite as tests/sys/aio

MFC after: 1 week


282071 27-Apr-2015 ngie

Integrate tools/regression/mqueue into the FreeBSD test suite as
tests/sys/mqueue

MFC after: 1 week


282067 27-Apr-2015 ngie

Integrate tools/regression/fifo into the FreeBSD test suite as tests/sys/fifo
and tools/regression/file into the FreeBSD test suite as tests/sys/file

MFC after: 1 week


282063 27-Apr-2015 ngie

Integrate tools/regression/kqueue into the FreeBSD test suite as
tests/sys/kqueue

MFC after: 1 week


282061 27-Apr-2015 ngie

Integrate tools/regression/execve into the FreeBSD test suite as
tests/sys/kern/execve

MFC after: 1 week


275732 12-Dec-2014 jmg

Add some new modes to OpenCrypto. These modes are AES-ICM (can be used
for counter mode), and AES-GCM. Both of these modes have been added to
the aesni module.

Included is a set of tests to validate that the software and aesni
module calculate the correct values. These use the NIST KAT test
vectors. To run the test, you will need to install a soon to be
committed port, nist-kat that will install the vectors. Using a port
is necessary as the test vectors are around 25MB.

All the man pages were updated. I have added a new man page, crypto.7,
which includes a description of how to use each mode. All the new modes
and some other AES modes are present. It would be good for someone
else to go through and document the other modes.

A new ioctl was added to support AEAD modes which AES-GCM is one of them.
Without this ioctl, it is not possible to test AEAD modes from userland.

Add a timing safe bcmp for use to compare MACs. Previously we were using
bcmp which could leak timing info and result in the ability to forge
messages.

Add a minor optimization to the aesni module so that single segment
mbufs don't get copied and instead are updated in place. The aesni
module needs to be updated to support blocked IO so segmented mbufs
don't have to be copied.

We require that the IV be specified for all calls for both GCM and ICM.
This is to ensure proper use of these functions.

Obtained from: p4: //depot/projects/opencrypto
Relnotes: yes
Sponsored by: FreeBSD Foundation
Sponsored by: NetGate


274267 08-Nov-2014 ngie

Use PROGS instead of PROG and remove unnecessary SRCS?= assignment

Using PROG instead of PROGS will in cases of high -j with -DNO_ROOT cause
the PROG to show up more than once as it's handling the SCRIPTS install case
in a recursive manner, separate from the non-recursive case

After the recent batch of commits to bsd.progs.mk to fix behavior with how
variables are defaulted to, explicitly setting SRCS for a PROG is no longer
required

MFC after: 1 week
Reviewed by: asomers
Phabric: D1130
Sponsored by: EMC / Isilon Storage Division


274052 03-Nov-2014 ngie

Remove unused tests/lib directory

MFC after: 1 week


274021 03-Nov-2014 ngie

Remove explicit KYUAFILE=yes from tests/sys/Makefile

This causes the directory traversing Kyuafile to be installed, which in turn
causes tests/sys/pjdfstest to always be run from /usr/tests/sys

Let KYUAFILE default to auto, so the file generated by suite.test.mk gets
installed instead

MFC after: 1 week


274016 03-Nov-2014 ngie

Integrate pjdfstest test suite execution into kyua

pjdfstest execution is opt-in and must be done as root due to some of the
assumptions made by the test suite and lack of error checking in the non-root
case

A description of how to execute pjdfstest with kyua is provided in
share/pjdfstest/README

Phabric: D824 (an earlier prototype patch)
MFC after: 1 month
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division


271675 16-Sep-2014 asomers

Fix source address selection on unbound sockets in the presence of multiple
fibs. Use the mbuf's or the socket's fib instead of RT_ALL_FIBS. Fixes PR
187553. Also fixes netperf's UDP_STREAM test on a nondefault fib.

sys/netinet/ip_output.c
In ip_output, lookup the source address using the mbuf's fib instead
of RT_ALL_FIBS.

sys/netinet/in_pcb.c
in in_pcbladdr, lookup the source address using the socket's fib,
because we don't seem to have the mbuf fib. They should be the same,
though.

tests/sys/net/fibs_test.sh
Clear the expected failure on udp_dontroute.

PR: 187553
CR: https://reviews.freebsd.org/D772
MFC after: 3 weeks
Sponsored by: Spectra Logic


271397 10-Sep-2014 asomers

Abort the create_socket test if socket creation fails.

MFC after: 1 week
Reported by: Coverity
CID: 1232756


270228 20-Aug-2014 asomers

Numerous small fixes, mostly suggested by Coverity.

tests/sys/kern/unix_seqpacket_test.c
* Remove a duplicate error check in mk_pair_of_sockets
* Always close sockets in the success path of ATF test cases. Don't
bother with the error paths, because those are mostly assertions
anyway. Most of these socket leaks were reported by Coverity.
All of them are harmless, because each ATF test case runs in its
own process.
* Fix the len argument to send in shutdown_send and
shutdown_send_sigpipe. The old version was using sizeof a pointer
instead of sizeof the char array. Reported by Coverity.
* Change a few ATF_CHECK to ATF_REQUIRE if the test can't reasonably
continue past a failure.

Reported by: Coverity Scan
CID: 1229995, 1229991, 1229988, 1229994, 1229989, 1229992
CID: 1229993, 1229990, 1229984, 1229967, 1230005, 1229977
CID: 1229966, 1230004, 1229976
MFC after: 1 week
Sponsored by: Spectra Logic


266860 29-May-2014 asomers

Fix unintended KBI change from r264905. Add _fib versions of
ifa_ifwithnet() and ifa_ifwithdstaddr() The legacy functions will call the
_fib() versions with RT_ALL_FIBS, preserving legacy behavior.

sys/net/if_var.h
sys/net/if.c
Add legacy-compatible functions as described above. Ensure legacy
behavior when RT_ALL_FIBS is passed as fibnum.

sys/netinet/in_pcb.c
sys/netinet/ip_output.c
sys/netinet/ip_options.c
sys/net/route.c
sys/net/rtsock.c
sys/netinet6/nd6.c
Call with _fib() functions if we must use a specific fib, or the
legacy functions otherwise.

tests/sys/netinet/fibs_test.sh
tests/sys/netinet/udp_dontroute.c
Improve the udp_dontroute test. The bug that this test exercises is
that ifa_ifwithnet() will return the wrong address, if multiple
interfaces have addresses on the same subnet but with different
fibs. The previous version of the test only considered one possible
failure mode: that ifa_ifwithnet_fib() might fail to find any
suitable address at all. The new version also checks whether
ifa_ifwithnet_fib() finds the correct address by checking where the
ARP request goes.

Reported by: bz, hrs
Reviewed by: hrs
MFC after: 1 week
X-MFC-with: 264905
Sponsored by: Spectra Logic


265836 10-May-2014 imp

Remove last two NO_MAN= in the tree. In both of these cases, MAN= is
what is needed.


265094 29-Apr-2014 asomers

Add regression test for PR kern/189088.

PR: kern/189088
MFC after: 3 weeks
Sponsored by: Spectra Logic


265092 29-Apr-2014 asomers

Fix a panic when removing an IP address from an interface, if the same address
exists on another interface. The panic was introduced by change 264887, which
changed the fibnum parameter in the call to rtalloc1_fib() in
ifa_switch_loopback_route() from RT_DEFAULT_FIB to RT_ALL_FIBS. The solution
is to use the interface fib in that call. For the majority of users, that will
be equivalent to the legacy behavior.

PR: kern/189089
Reported by: neel
Reviewed by: neel
MFC after: 3 weeks
X-MFC with: 264887
Sponsored by: Spectra Logic


264917 25-Apr-2014 asomers

Style fixes, mostly trailing whitespace elimination. No functional change.

Reported by: pho
MFC after: 3 weeks


264905 25-Apr-2014 asomers

Fix subnet and default routes on different FIBs on the same subnet.

These two bugs are closely related. The root cause is that ifa_ifwithnet
does not consider FIBs when searching for an interface address.

sys/net/if_var.h
sys/net/if.c
Add a fib argument to ifa_ifwithnet and ifa_ifwithdstadddr. Those
functions will only return an address whose interface fib equals the
argument.

sys/net/route.c
Update calls to ifa_ifwithnet and ifa_ifwithdstaddr with fib
arguments.

sys/netinet/in.c
Update in_addprefix to consider the interface fib when adding
prefixes. This will prevent it from not adding a subnet route when
one already exists on a different fib.

sys/net/rtsock.c
sys/netinet/in_pcb.c
sys/netinet/ip_output.c
sys/netinet/ip_options.c
sys/netinet6/nd6.c
Add RT_DEFAULT_FIB arguments to ifa_ifwithdstaddr and ifa_ifwithnet.
In some cases it there wasn't a clear specific fib number to use.
In others, I was unable to test those functions so I chose
RT_DEFAULT_FIB to minimize divergence from current behavior. I will
fix some of the latter changes along with PR kern/187553.

tests/sys/netinet/fibs_test.sh
tests/sys/netinet/udp_dontroute.c
tests/sys/netinet/Makefile
Revert r263738. The udp_dontroute test was right all along.
However, bugs kern/187550 and kern/187553 cancelled each other out
when it came to this test. Because of kern/187553, ifa_ifwithnet
searched the default fib instead of the requested one, but because
of kern/187550, there was an applicable subnet route on the default
fib. The new test added in r263738 doesn't work right, however. I
can verify with dtrace that ifa_ifwithnet returned the wrong address
before I applied this commit, but route(8) miraculously found the
correct interface to use anyway. I don't know how.

Clear expected failure messages for kern/187550 and kern/187552.

PR: kern/187550
PR: kern/187552
Reviewed by: melifaro
MFC after: 3 weeks
Sponsored by: Spectra Logic


264887 24-Apr-2014 asomers

Fix host and network routes for new interfaces when net.add_addr_allfibs=0

sys/net/route.c
In rtinit1, use the interface fib instead of the process fib. The
latter wasn't very useful because ifconfig(8) is usually invoked
with the default process fib. Changing ifconfig(8) to use setfib(2)
would be redundant, because it already sets the interface fib.

tests/sys/netinet/fibs_test.sh
Clear the expected ATF failure

sys/net/if.c
Pass the interface fib in calls to rtrequest1_fib and rtalloc1_fib

sys/netinet/in.c
sys/net/if_var.h
Add a fibnum argument to ifa_switch_loopback_route, a subroutine of
in_scrubprefix. Pass it the interface fib.

PR: kern/187549
Reviewed by: melifaro
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


264133 04-Apr-2014 jmmv

Fix variable type to avoid printf formatter warning.

This fixes the build under powerpc64 where gcc complains about a mismatch
between a %zd printf formatter and an int variable passed to it.


263779 26-Mar-2014 asomers

Correct ARP update handling when the routes for network interfaces are
restricted to a single FIB in a multifib system.

Restricting an interface's routes to the FIB to which it is assigned (by
setting net.add_addr_allfibs=0) causes ARP updates to fail with "arpresolve:
can't allocate llinfo for x.x.x.x". This is due to the ARP update code hard
coding it's lookup for existing routing entries to FIB 0.

sys/netinet/in.c:
When dealing with RTM_ADD (add route) requests for an interface, use
the interface's assigned FIB instead of the default (FIB 0).

sys/netinet/if_ether.c:
In arpresolve(), enhance error message generated when an
lla_lookup() fails so that the interface causing the error is
visible in logs.

tests/sys/netinet/fibs_test.sh
Clear ATF expected error.

PR: kern/167947
Submitted by: Nikolay Denev <ndenev@gmail.com> (previous version)
Reviewed by: melifaro
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


263738 25-Mar-2014 asomers

tests/sys/netinet/Makefile
tests/sys/netinet/fibs.sh
Replace fibs:udp_dontroute with fibs:src_addr_selection_by_subnet.
The original test was poorly written; it was actually testing
kern/167947 instead of the desired kern/187553. The root cause of the
bug is that ifa_ifwithnet did not have a fib argument. The new test
more directly targets that behavior.

tests/sys/netinet/udp_dontroute.c
Delete the auxilliary binary used by the old test

PR: kern/187553
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


263445 20-Mar-2014 asomers

Add several ATF tests that deal with multiple fibs. They're described in
several different PRs, but the tests share some common code, so I'm
committing them together.

sbin/ifconfig/tests
sbin/ifconfig/tests/fibs_test.sh
sbin/ifconfig/tests/Makefile
sbin/ifconfig/Makefile
Add fibs_test.sh, which regresses bin/187551

tests/sys/netinet
tests/sys/netinet/fibs_test.sh
tests/sys/netinet/udp_dontroute.c
tests/sys/netinet/Makefile
tests/sys/Makefile
Add fibs_test.sh, which regresses kern/167947, kern/187552
kern/187549, kern/187550, and kern/187553

etc/mtree/BSD.tests.dist
Add newly created directories

PR: bin/187551
PR: kern/167947
PR: kern/187552
PR: kern/187549
PR: kern/187550
PR: kern/187553
Discussed with: melifaro
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


263336 19-Mar-2014 pho

Added sysctl kern.maxfiles increase test, do not use /etc/passwd for tests
and use volatile sig_atomic_t for signal handler variable.

Reviewed by: asomers (previous version)
Sponsored by: EMC / Isilon storage division


263161 14-Mar-2014 jmmv

Make bsd.test.mk the only public mk fragment for the building of tests.

Change {atf,plain,tap}.test.mk to be internal implementation details of
bsd.test.mk. Makefiles that build tests should now only include bsd.test.mk
and declaratively specify what they want to build, without worrying about
the internal implementation of the mk files.

The reason for this change is to permit building test programs of different
interfaces from a single directory, which is something I had a need for
while porting tests over from src/tools/regression/.

Additionally, this change makes it possible to perform some other requested
changes to bsd.test.mk in an easier manner. Coming soon.


263116 13-Mar-2014 asomers

Replace 4.4BSD Lite's unix domain socket backpressure hack with a cleaner
mechanism, based on the new SB_STOP sockbuf flag. The old hack dynamically
changed the sending sockbuf's high water mark whenever adding or removing
data from the receiving sockbuf. It worked for stream sockets, but it never
worked for SOCK_SEQPACKET sockets because of their atomic nature. If the
sockbuf was partially full, it might return EMSGSIZE instead of blocking.

The new solution is based on DragonFlyBSD's fix from commit
3a6117bbe0ed6a87605c1e43e12a1438d8844380 on 2008-05-27. It adds an SB_STOP
flag to sockbufs. Whenever uipc_send surpasses the socket's size limit, it
sets SB_STOP on the sending sockbuf. sbspace() will then return 0 for that
sockbuf, causing sosend_generic and friends to block. uipc_rcvd will
likewise clear SB_STOP. There are two fringe benefits: uipc_{send,rcvd} no
longer need to call chgsbsize() on every send and receive because they don't
change the sockbuf's high water mark. Also, uipc_sense no longer needs to
acquire the UIPC linkage lock, because it's simpler to compute the
st_blksizes.

There is one drawback: since sbspace() will only ever return 0 or the
maximum, sosend_generic will allow the sockbuf to exceed its nominal maximum
size by at most one packet of size less than the max. I don't think that's
a serious problem. In fact, I'm not even positive that FreeBSD guarantees a
socket will always stay within its nominal size limit.

sys/sys/sockbuf.h
Add the SB_STOP flag and adjust sbspace()

sys/sys/unpcb.h
Delete the obsolete unp_cc and unp_mbcnt fields from struct unpcb.

sys/kern/uipc_usrreq.c
Adjust uipc_rcvd, uipc_send, and uipc_sense to use the SB_STOP
backpressure mechanism. Removing obsolete unpcb fields from
db_show_unpcb.

tests/sys/kern/unix_seqpacket_test.c
Clear expected failures from ATF.

Obtained from: DragonFly BSD
PR: kern/185812
Reviewed by: silence from freebsd-net@ and rwatson@
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


262894 07-Mar-2014 asomers

kern/Makefile
Set WARNS=5 for all files in this directory

kern/unix_seqpacket_test.c
Fix compiler warnings. Most were benign, but rcvbuf_oversized
wasn't working as intended because I forgot to set the buffer sizes.

MFC after: 2 weeks
Reported by: pho
Sponsored by: Spectra Logic Corporation


262868 06-Mar-2014 asomers

Only use -lpthread for unix_seqpacket_test, not for all test programs.

Reported by: Garrett Cooper
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


262867 06-Mar-2014 asomers

Fix PR kern/185813 "SOCK_SEQPACKET AF_UNIX sockets with asymmetrical
buffers drop packets". It was caused by a check for the space available
in a sockbuf, but it was checking the wrong sockbuf.

sys/sys/sockbuf.h
sys/kern/uipc_sockbuf.c
Add sbappendaddr_nospacecheck_locked(), which is just like
sbappendaddr_locked but doesn't validate the receiving socket's
space. Factor out common code into sbappendaddr_locked_internal().
We shouldn't simply make sbappendaddr_locked check the space and
then call sbappendaddr_nospacecheck_locked, because that would cause
the O(n) function m_length to be called twice.

sys/kern/uipc_usrreq.c
Use sbappendaddr_nospacecheck_locked for SOCK_SEQPACKET sockets,
because the receiving sockbuf's size limit is irrelevant.

tests/sys/kern/unix_seqpacket_test.c
Now that 185813 is fixed, pipe_128k_8k fails intermittently due to
185812. Make it fail every time by adding a usleep after starting
the writer thread and before starting the reader thread in
test_pipe. That gives the writer time to fill up its send buffer.
Also, clear the expected failure message due to 185813. It actually
said "185812", but that was a typo.

PR: kern/185813
Reviewed by: silence from freebsd-net@ and rwatson@
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation


262781 05-Mar-2014 pho

Preserve naming consistency for test cases.

Pointed out by: jmmv
Sponsored by: EMC / Isilon storage division


262730 04-Mar-2014 pho

Changed name of test case to a more descriptive one and moved
comment to the "descr" property.

Suggested by: jmmv
Sponsored by: EMC / Isilon storage division


262526 26-Feb-2014 pho

Added a regression test for r234131.

Discussed with: asomers
Sponsored by: EMC / Isilon storage division


262133 17-Feb-2014 asomers

test_eagain_*_* should've been using nonblocking sockets instead of
blocking sockets. The error was not exposed as long as the kernel
suffered from PR kern/185812. Now corrected, these tests pass on
DragonFlyBSD 3.6.0.

PR: kern/185812
Sponsored by: Spectra Logic Corporation
MFC after: 2 weeks


261978 16-Feb-2014 jmmv

Use DESTDIR for the installation of the /usr/tests/local symlink.

MFC after: 5 days


261959 16-Feb-2014 jmmv

Install a symlink from /usr/tests/local to /usr/local/tests.

This is to let Kyua descend into any tests that may have been installed by
ports under /usr/local/tests when running the test suite from /usr/tests.

Some ports (namely those that build Kyua) already install test programs
into /usr/local/tests. Just make sure to select the TEST option while
building them.

MFC after: 3 days


261615 08-Feb-2014 asomers

tests/sys/Makefile
use TESTS_SUBDIRS for kern instead of SUBDIRS. I don't think it
makes a difference in this case, but TESTS_SUBDIRS is generally
correct for subdirectories that contain tests.

Sponsored by: Spectra Logic
MFC after: 5 days
X-MFC-With: r261133


261133 24-Jan-2014 asomers

Fix the Makefiles so that the tests I submitted in r261081 will actually
get built.

Sponsored by: Spectra Logic
MFC after: 13 days
X-MFC-With: r261081


261081 23-Jan-2014 asomers

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


257852 08-Nov-2013 jmmv

Install category Kyuafiles from their category directories.

Move the installation of /usr/tests/lib/Kyuafile from src/tests/lib/
to src/lib/. This is to keep the src/tests/ hierarchy unaware of the
rest of the tree, which makes things clearer in general. In particular:

1) Everything related to the construction of /usr/tests/lib/ is kept
in src/lib/. There is no need to think about different directories
and how they relate to each other. (The same applies for libexec,
usr.bin, etc. but these are not yet handled.)

2) src/tests becomes the place to keep cross-functional test programs
and nothing else, which also helps in simplifying things.

Reviewed by: freebsd-testing
Approved by: rpaulo (mentor)


257097 25-Oct-2013 rpaulo

Set up the /usr/tests hierarchy.

Populate /usr/tests with the only test programs that currently live
in the tree (those in lib/libcrypt/tests/) and add all the build
machinery to accompany this change.

In particular:

- Add a WITHOUT_TESTS variable that users can define to request that
no tests be put in /usr/tests.
- Add a top-level Kyuafile for /usr/tests and a way to create similar
Kyuafiles in top-level subdirectories.
- Add a BSD.tests.dist file to define the directory layout of
/usr/tests.

Submitted by: Julio Merino jmmv google.com
Reviewed by: sjg
MFC after: 2 weeks