Skip to content

test: keepAboveStdio EMFILE and descriptor-count coverage - #80

Merged
HaoZeke merged 5 commits into
developfrom
test/keep-above-stdio-emfile-fdcount
Nov 24, 2026
Merged

HaoZeke merged 5 commits into
developfrom
test/keep-above-stdio-emfile-fdcount

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

test: share the open-descriptor count

The lock tests count /proc/self/fd with a helper in the test file.
That helper now lives in one shared test file, and a failed read of
the directory returns an error.

test: share the forked-child wait

The proc tests had their own helper that forks a child and retries an
interrupted wait4. That wait now lives in the shared test helper,
and the proc tests call it there.

test: report keepAboveStdio failure when no free descriptor remains

sys.keepAboveStdio returns error.Unexpected when duplication fails
with EMFILE, and the original descriptor stays open. A child lowers
RLIMIT_NOFILE, fills the table, and restores the limit.

test: count descriptors around the keepAboveStdio paths in proc

The test counts /proc/self/fd before and after each proc path that
calls sys.keepAboveStdio. The later count matches the earlier one.

The lock tests count `/proc/self/fd` with a helper in the test file.
That helper now lives in one shared test file, and a failed read of
the directory returns an error.
The proc tests had their own helper that forks a child and retries an
interrupted `wait4`. That wait now lives in the shared test helper,
and the proc tests call it there.
`sys.keepAboveStdio` returns `error.Unexpected` when duplication fails
with `EMFILE`, and the original descriptor stays open. A child lowers
`RLIMIT_NOFILE`, fills the table, and restores the limit.
The test counts `/proc/self/fd` before and after each `proc` path that
calls `sys.keepAboveStdio`. The later count matches the earlier one.
@HaoZeke
HaoZeke changed the base branch from main to develop November 21, 2026 05:32
@HaoZeke
HaoZeke merged commit 4276d17 into develop Nov 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant