Repository navigation
test: keepAboveStdio EMFILE and descriptor-count coverage - #80
Merged
Merged
Conversation
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.
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.
test: share the open-descriptor count
The lock tests count
/proc/self/fdwith 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.keepAboveStdioreturnserror.Unexpectedwhen duplication failswith
EMFILE, and the original descriptor stays open. A child lowersRLIMIT_NOFILE, fills the table, and restores the limit.test: count descriptors around the keepAboveStdio paths in proc
The test counts
/proc/self/fdbefore and after eachprocpath thatcalls
sys.keepAboveStdio. The later count matches the earlier one.