Page MenuHomeFreeBSD

Fix two failing tests after ATF update
ClosedPublic

Authored by arichardson on Feb 15 2021, 10:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 11:25 PM
Unknown Object (File)
Sun, Mar 31, 6:15 PM
Unknown Object (File)
Mar 12 2024, 11:51 PM
Unknown Object (File)
Mar 12 2024, 11:51 PM
Unknown Object (File)
Mar 12 2024, 11:42 PM
Unknown Object (File)
Jan 15 2024, 10:42 AM
Unknown Object (File)
Dec 29 2023, 12:29 AM
Unknown Object (File)
Dec 23 2023, 1:13 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
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 37014
Build 33903: arc lint + arc unit

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.