Skip to content

🧪 test: count descriptors behind an incomplete /dev/fd - #877

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
00200200:codex/filelock-partial-fd-view
Oct 28, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
00200200:codex/filelock-partial-fd-view

Conversation

@00200200

@00200200 00200200 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

On FreeBSD without fdescfs mounted, /dev/fd lists 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_probe and test_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 to SC_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.

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.
@gaborbernat gaborbernat added the skip news Internal change; exempt from the news fragment check label Oct 28, 2026
@gaborbernat gaborbernat changed the title test: handle incomplete descriptor directory views 🧪 test: count descriptors behind an incomplete /dev/fd Oct 28, 2026
@gaborbernat gaborbernat reopened this Oct 28, 2026
@gaborbernat gaborbernat reopened this Oct 28, 2026
@gaborbernat gaborbernat reopened this Oct 28, 2026
@gaborbernat
gaborbernat merged commit a2e26ac into tox-dev:main Oct 28, 2026
112 of 198 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news Internal change; exempt from the news fragment check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants