Repository navigation
🧪 test: count descriptors behind an incomplete /dev/fd - #877
Merged
gaborbernat merged 2 commits intoOct 28, 2026
Merged
Conversation
The helper re-probed /dev/fd on every call and needed a test module that patched Path.iterdir to reach its fallback. A capability probe, complete-fd-directory, answers once whether the descriptor directory lists a descriptor the suite just opened, the way the suite gates every other runtime difference, and one shared descriptors_on replaces the three counting loops in conftest, test_read_write_fork and test_strict_soft_failures. One test drives the SC_OPEN_MAX scan with real duplicated descriptors behind an empty listing. The fragment goes: test infrastructure is not a library change, so the pull request takes the skip news label instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On FreeBSD without
fdescfsmounted,/dev/fdlists only the standard streams, so the suite's descriptor counts and its inode-reuse stand-in read a live descriptor as closed. Three of the failures in #864 (test_read_write_lock_keeps_its_probe_descriptor_while_held,test_read_write_locks_held_together_each_keep_their_own_probeandtest_failed_acquire_spares_a_successor_on_the_freed_inode_number) come from that test-side assumption, not from the library. After this change the port's test run sees the live descriptors there.A new runtime capability,
complete-fd-directory, probes once at start-up whether the descriptor directory shows a descriptor the suite just opened, through the same mechanism that already drives the skip gates and the coverage pragmas. 🔍 One shared counter reads the directory where it is complete and otherwise probes every number up toSC_OPEN_MAX, which also retires the NetBSD-only scan from #859. The three descriptor loops that had grown apart across the fixtures now share that counter.The library itself does not change. The scan path runs on every platform behind a hidden listing; a native FreeBSD run is still open.