Page MenuHomeFreeBSD

Fix two failing tests after ATF update
ClosedPublic

Authored by arichardson on Feb 15 2021, 10:36 AM.
Tags
None
Referenced Files
F106128676: D28683.id83978.diff
Wed, Dec 25, 9:14 PM
F106099509: D28683.diff
Wed, Dec 25, 9:40 AM
Unknown Object (File)
Tue, Dec 17, 2:02 AM
Unknown Object (File)
Thu, Nov 28, 12:10 PM
Unknown Object (File)
Wed, Nov 27, 8:36 PM
Unknown Object (File)
Nov 12 2024, 5:39 AM
Unknown Object (File)
Oct 6 2024, 1:44 PM
Unknown Object (File)
Oct 3 2024, 1:50 AM
Subscribers

Details

Summary

Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da
ATF opens the results file on startup. This fixes problems like
capsicumized tests not being able to open the file on exit.

However, this test closes all file descriptors just to check that
socketpair returns fd 3+4 and thereby also closes the ATF results file.
This then results in an EBADF when writing the result so the test is
reported as broken.

While system calls that create new file descriptors (must?) use the lowest
available file descriptor number, it does not seem useful to test this
property here. Drop the check for FD==3/4 to unbreak the testsuite.

We could also try to re-open the results file in ATF if we get a EBADF
error, but that will fail when running under Capsicum.

Test Plan

tests pass now.

Diff Detail

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

Event Timeline

Note: this also affects contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c:t_spawn_fileactions, but I haven't tried fixing that one yet.

The analysis makes sense and the fix looks fine to me. You could allocate two fds and check socketpair against both (instead of just low) in the final test, but I don't think there's much marginal value in that. (Frankly, I'm not a fan of unix' must-assign-lowest-fd behavior in general, but we have to abide by it.)

This revision is now accepted and ready to land.Feb 15 2021, 6:54 PM
This revision was automatically updated to reflect the committed changes.