Integrate usr.sbin/nmtree/tests from NetBSD into atf/kyua

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division
Set the autoindent to 4 spaces with vim in BSD.tests.dist

This will prevent vim users from accidentally checking in buggy mtree files
(mixed tabs/spaces).

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Integrate usr.sbin/basename/tests from NetBSD into atf/kyua

In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division
Integrate usr.bin/cmp/tests from NetBSD into atf/kyua

In collaboration with: sjg
Sponsored by: EMC / Isilon Storage Division
Integrate usr.bin/dirname/tests from NetBSD into atf/kyua

In collaboration with: pho, sjg
Sponsored by: EMC / Isilon Storage Division
Integrate bin/sleep/tests from NetBSD into atf/kyua

Sponsored by: EMC / Isilon Storage Division
Integrate usr.bin/cut/tests from NetBSD into atf/kyua

Sponsored by: EMC / Isilon Storage Division
Integrate usr.bin/grep/tests from NetBSD into atf/kyua

Sponsored by: EMC / Isilon Storage Division
Properly NUL-terminate the on-stack buffer for reading /boot.config
or /boot/config. In qemu, on a warm boot, the stack is not all zeroes
and we parse beyond the file's contents.

Obtained from:	Juniper Networks, Inc.
Apply r269126 to tty_timedwait():
Don't return ERESTART when the device is gone.
Integrate usr.bin/diff/tests from NetBSD into atf/kyua at gnu/usr.bin/diff/tests

Sponsored by: EMC / Isilon Storage Division
Integrate usr.bin/gzip/tests from NetBSD into atf/kyua

Sponsored by: EMC / Isilon Storage Division
Fix draining in ttydev_leave():
1.  ERESTART is not only returned when the revoke count changed. It
    is also returned when a signal is received. While a change in
    the revoke count should be ignored, a signal should not.
2.  Waiting until the output queue is entirely drained can cause a
    hang when the underlying device is stuck or broken.

Have tty_drain() take care of this by telling it when we're leaving.
When leaving, tty_drain() will use a timed wait to address point 2
above and it will check the revoke count to handle point 1 above.
The timeout is set to 1 second, which is arbitrary and long enough
to expect a change in the output queue.

Discussed with: jilles@
Reported by: Yamagi Burmeister <lists@yamagi.org>
Merge remote-tracking branch 'freebsd/master' into hardened/current/master
Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/segvguard