Page MenuHomeFreeBSD

tests: Avoid sleep when causing a write error
ClosedPublic

Authored by jilles on May 23 2026, 7:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 17, 2:22 AM
Unknown Object (File)
Wed, Jun 17, 12:47 AM
Unknown Object (File)
Sun, Jun 14, 12:23 AM
Unknown Object (File)
Fri, Jun 12, 10:19 AM
Unknown Object (File)
Fri, Jun 12, 10:19 AM
Unknown Object (File)
Thu, Jun 4, 2:20 PM
Unknown Object (File)
Thu, Jun 4, 2:19 PM
Unknown Object (File)
Mon, Jun 1, 8:02 PM
Subscribers

Details

Summary

Cause a write error using a fifo and wait, rather than needing a sleep
to wait for something to terminate. This is faster and avoids a
potential test failure on a heavily loaded system.

Using /dev/full would be simpler, but it is not portable enough (it
tends not to be available in jails, even). Starting programs with stdout
not open or only open for read/execute/search may have unexpected side
effects.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

What implements /dev/full these days?

$ uname -a
FreeBSD universe16a.freebsd.org 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n285776-10e342c1ec78: Sat May  9 09:21:00 UTC 2026     root@build-16.freebsd.org:/usr/obj/usr/src/sys/CLUSTER16 amd64
$ ls /dev/full
ls: /dev/full: No such file or directory
% uname -a
FreeBSD gilot.local 14.4-RELEASE-p3 FreeBSD 14.4-RELEASE-p3 GENERIC amd64
% ls -l /dev/full
crw-rw-rw-  1 root wheel 0x13 May 21 11:19 /dev/full

require.files needs to be used to make sure /dev/full exists before use -- otherwise all of these tests will fail.

des requested changes to this revision.Thu, May 28, 9:40 PM

Please don't, I need these tests to remain portable.

This revision now requires changes to proceed.Thu, May 28, 9:40 PM
In D57213#1313293, @des wrote:

Please don't, I need these tests to remain portable.

OK, then I can build something using fifos that is portable and still does not have a sleep. The complexity will be similar to the existing code.

jilles retitled this revision from tests: Cause a write error using /dev/full instead of broken pipe to tests: Avoid sleep when causing a write error.Wed, Jun 3, 7:46 PM
jilles edited the summary of this revision. (Show Details)

Use fifo and wait instead of /dev/full.

This revision is now accepted and ready to land.Wed, Jun 3, 7:56 PM

LGTM -- the only thing I might consider is some commentary linking the patterns together or adding the pattern to a common script.

LGTM -- the only thing I might consider is some commentary linking the patterns together

I think the existing descriptions like "Error writing to stdout" should be clear enough.

or adding the pattern to a common script.

Such a common script would make it harder to copy test cases around to other systems, and due to the limitations of the shell language the whole thing would become more complicated (ideally I would like to return an open file from a function, but shell doesn't support that).

This revision was automatically updated to reflect the committed changes.