Commit Graph

186 Commits

Author SHA1 Message Date
Enji Cooper
410757a4f4 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
2016-04-19 22:25:14 +00:00
Enji Cooper
9c7defc3bf 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
2016-04-18 07:48:27 +00:00
Glen Barber
0edd2576c0 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-16 02:32:12 +00:00
John Baldwin
d1ad1a7394 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
2016-04-16 00:01:16 +00:00
Enji Cooper
abea2d5a7e 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
2016-04-15 02:53:52 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
John Baldwin
c03094a4b6 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.
2016-03-31 21:25:40 +00:00
Enji Cooper
da611c05f0 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
2016-03-22 08:12:45 +00:00
John Baldwin
bb430bc740 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.
2016-03-21 21:37:33 +00:00
Glen Barber
7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery
15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
John Baldwin
f3215338ef 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
2016-03-01 18:12:14 +00:00
Glen Barber
317cec3c43 MFH
Sponsored by:	The FreeBSD Foundation
2016-02-22 12:28:23 +00:00
Mark Johnston
88c2beac9c 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
2016-02-19 01:49:33 +00:00
Glen Barber
72c3aa02dc MFH
Sponsored by:	The FreeBSD Foundation
2016-02-18 00:37:58 +00:00
Bryan Drewery
d3157f0915 Test directories can build in parallel fine.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:13:59 +00:00
Glen Barber
0fe0fe112f MFH
Sponsored by:	The FreeBSD Foundation
2016-02-15 21:58:52 +00:00
Enji Cooper
8e89d3a42a 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
2016-02-10 17:57:24 +00:00
Glen Barber
bbb51924bb MFH
Sponsored by:	The FreeBSD Foundation
2016-02-08 12:16:01 +00:00
Enji Cooper
be484a1255 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
2016-02-06 04:13:20 +00:00
Enji Cooper
f3975b867e 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
2016-02-05 23:50:15 +00:00
Glen Barber
81d2622e52 Final pass through to fix 'tests' packaging.
Sponsored by:	The FreeBSD Foundation
2016-02-03 20:55:08 +00:00
Glen Barber
1f4bcc459a More 'tests' packaging fixes.
Sponsored by:	The FreeBSD Foundation
2016-02-03 19:08:45 +00:00
Glen Barber
2aa00a6001 More 'tests' package fixes.
Sponsored by:	The FreeBSD Foundation
2016-02-03 00:34:23 +00:00
Glen Barber
221b349912 MFH
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:27:48 +00:00
Glen Barber
43faedc133 First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
Enji Cooper
5a69be6768 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
2016-02-01 06:27:59 +00:00
Enji Cooper
4f70692277 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
2016-02-01 06:25:16 +00:00
Eric van Gyzen
0e3d6ed44e 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
2016-01-28 20:24:15 +00:00
Enji Cooper
0713024269 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
2016-01-14 07:39:05 +00:00
Enji Cooper
4c29cf96d4 Remove unnecessary kldload logic added to geom_subr.sh in r293028
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2016-01-14 07:27:14 +00:00
Enji Cooper
09d986419d 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
2016-01-13 09:14:27 +00:00
Enji Cooper
67fe84f163 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
2015-12-30 18:13:43 +00:00
Enji Cooper
b9083c2190 Integrate tools/regression/sockets/unix_passfd into the FreeBSD test
suite as tests/sys/kern/unix_passfd_test

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

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

MFC after: 1 week
Submitted by: markj
Sponsored by: EMC / Isilon Storage Division
2015-12-30 11:15:07 +00:00
John Baldwin
5fcfab6e32 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.
2015-12-29 23:25:26 +00:00
Enji Cooper
4fdd48909c Remove retval to fix a -Wunused-but-set-variable warning from gcc 4.9
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-12-28 02:36:57 +00:00
Enji Cooper
983a2d9138 - 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
2015-12-28 02:34:59 +00:00
Enji Cooper
d88dc75224 Clean trailing whitespace
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-12-28 02:28:12 +00:00
Enji Cooper
0b0ac0beb2 - 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
2015-12-28 02:21:36 +00:00
Enji Cooper
fc8e5f5fd4 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
2015-12-28 02:18:22 +00:00
Enji Cooper
e26e73f37f 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
2015-12-28 02:01:41 +00:00
Enji Cooper
013829494e 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
2015-12-23 10:02:51 +00:00
Enji Cooper
ad25988f4c 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
2015-12-23 09:59:31 +00:00
Enji Cooper
8b302ecdb9 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
2015-12-22 02:10:31 +00:00
Enji Cooper
870c2f7af9 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
2015-12-21 21:24:03 +00:00
Enji Cooper
11b249f99e 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
2015-12-16 05:44:53 +00:00
Bryan Drewery
eacae6dc66 Fix LDADD/DPADD that should be LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:47 +00:00
Enji Cooper
985f39c0bb 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
2015-12-01 07:52:41 +00:00
Daniel Eischen
77a498d991 Disable a couple of tests, perhaps temporarily, since they use private
symbols that are not exported from librt.
2015-11-29 06:16:25 +00:00
Bryan Drewery
95351216e3 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
2015-11-25 20:38:20 +00:00
Enji Cooper
0981c67bd8 Integrate contrib/netbsd-tests/kernel/t_mqueue into the FreeBSD test
suite as tests/sys/kern/mqueue_test

MFC after: 1 week
2015-11-23 09:17:25 +00:00
Enji Cooper
467afe7b9a 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
2015-11-23 09:15:20 +00:00
Craig Rodrigues
d58d03e575 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
2015-11-20 03:24:04 +00:00
Enji Cooper
e30a620063 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
2015-11-16 05:38:40 +00:00
Enji Cooper
a0c963e116 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
2015-11-16 04:56:14 +00:00
Enji Cooper
3e9b602907 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
2015-11-16 03:32:12 +00:00
Konstantin Belousov
3b624bd6f8 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
2015-10-19 20:22:17 +00:00
Enji Cooper
b3af24b4ff 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
2015-10-17 08:39:37 +00:00
Enji Cooper
4fdc3d75b9 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
2015-10-17 04:32:21 +00:00
Bryan Drewery
aa92269e46 Add more SUBDIR_PARALLEL.
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-15 22:55:08 +00:00
Enji Cooper
b2e7f20496 Integrate tools/regression/vfs into the FreeBSD test suite as tests/sys/vfs
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-10-14 08:16:15 +00:00
Enji Cooper
b2d48be1bc 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
2015-10-12 08:16:03 +00:00
John Baldwin
e72879e554 Tweak: use 'mainlwp' instead of 'mainpid' since this is a thread (LWP)
identifier, not a pid.
2015-10-06 22:59:00 +00:00
Bryan Drewery
0151b36f26 Fix build with older GCC which, doesn't like 'main' being a variable name. 2015-10-06 22:54:04 +00:00
John Baldwin
189ac973de 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
2015-10-06 19:29:05 +00:00
John Baldwin
b98cb919de Use _exit() instead of exit() in child processes created during tests.
Suggested by:	kib
2015-09-09 22:54:07 +00:00
John Baldwin
368b2b1c76 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
2015-09-09 22:42:26 +00:00
John Baldwin
479b610db5 Properly size the children[] arrays in the follow fork tests. 2015-09-09 21:18:10 +00:00
John Baldwin
9695459d02 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
2015-09-04 01:02:21 +00:00
John Baldwin
7f43ee0fb7 Add various tests to ensure that invalid arguments passed to mmap()
trigger failures.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D3269
2015-08-06 16:14:29 +00:00
John Baldwin
95eee0d40b 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
2015-08-06 16:12:12 +00:00
John Baldwin
98685dc8af 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
2015-08-01 16:27:52 +00:00
Sergey Kandaurov
4446a47a6f Fixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed). 2015-07-29 13:49:34 +00:00
Craig Rodrigues
dfded4478d Pass unsigned long argument to ioctl().
Eliminates "ioctl sign-extension" warnings.

PR:		200896
2015-07-26 14:46:42 +00:00
Mark Johnston
31d81a4316 The bug caught by flock's test 16 was fixed by r268384.
MFC after:	3 days
2015-07-05 22:49:26 +00:00
Julio Merino
8e79f15196 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
2015-07-04 02:22:26 +00:00
Simon J. Gerraty
bd831db65c Misc fixes from projects/bmake
Differential Revision:       D2748
Reviewed by: brooks imp
2015-06-11 21:13:05 +00:00
John Baldwin
dfa8ba12e1 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)
2015-06-04 21:07:27 +00:00
Enji Cooper
2cfac4737a Append to SUBDIR, not set it
Pointyhat to: ngie
2015-05-31 22:24:29 +00:00
John Baldwin
eddb85c663 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
2015-05-31 19:43:35 +00:00
John Baldwin
2f0219986c Tweak the description of when waitpid() doesn't return any status for a
non-blocking wait to avoid the word "empty".

Requested by:	ngie
2015-05-28 13:56:19 +00:00
John Baldwin
57c74f5b64 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
2015-05-26 10:29:37 +00:00
John Baldwin
c209e3e2e6 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
2015-05-22 11:04:54 +00:00
Enji Cooper
7afb8adff3 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
2015-05-18 11:02:43 +00:00
Enji Cooper
7ad92e6ab7 Fix typo. It should have been atf_tc_skip, not atf_skip
Reported by: many, Jenkins
Pointyhat to: ngie
MFC after: 4 days
2015-04-29 19:08:11 +00:00
Enji Cooper
c82b9f9234 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
2015-04-29 08:56:56 +00:00
Enji Cooper
941c3b8bd5 Adjust CFLAGS to find freebsd_test_suite/macros.h
MFC after: 6 days
2015-04-28 10:59:06 +00:00
Enji Cooper
e8395c4843 Use PLAIN_REQUIRE_KERNEL_MODULE to require "mqueuefs"
MFC after: 6 days
2015-04-28 10:56:59 +00:00
Enji Cooper
4e5f38d634 - 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
2015-04-28 10:53:06 +00:00
Enji Cooper
c5dfa43a6c Use ATF_REQUIRE_KERNEL_MODULE instead of aio_available function
MFC after: 6 days
2015-04-28 10:51:12 +00:00
Enji Cooper
b740c88bfb 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
2015-04-28 10:50:31 +00:00
Enji Cooper
0d405bba35 Fill in the copyright boilerplate for the test program
MFC after: 6 days
2015-04-28 10:29:42 +00:00
Enji Cooper
42484f6f69 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
2015-04-27 17:53:09 +00:00
Enji Cooper
65221ed42e Integrate tools/regression/mmap into the FreeBSD test suite as
tests/sys/kern/mmap_test

MFC after: 1 week
2015-04-27 09:06:27 +00:00
Enji Cooper
f44eb01339 Integrate tools/regression/aio/aiotest and tools/regression/aio/kqueue into the
FreeBSD test suite as tests/sys/aio

MFC after: 1 week
2015-04-27 08:51:40 +00:00
Enji Cooper
e100f6a2fc Integrate tools/regression/mqueue into the FreeBSD test suite as
tests/sys/mqueue

MFC after: 1 week
2015-04-27 08:31:43 +00:00
Enji Cooper
3cedbec3ee 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
2015-04-27 08:15:17 +00:00
Enji Cooper
70598e5094 Integrate tools/regression/kqueue into the FreeBSD test suite as
tests/sys/kqueue

MFC after: 1 week
2015-04-27 07:37:48 +00:00
Enji Cooper
bbf12e6f7f Integrate tools/regression/execve into the FreeBSD test suite as
tests/sys/kern/execve

MFC after: 1 week
2015-04-27 07:22:18 +00:00