test(log): exercise foreign fd-capture sentinel in reader path - #141
Open
cursor[bot] wants to merge 1 commit into
Open
test(log): exercise foreign fd-capture sentinel in reader path#141cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Child stop() is a no-op off the owner pid, so the existing fork test never wrote a PID-tagged sentinel. Inject one after waitpid so _reader_loop's foreign-sentinel drop path is covered. Co-authored-by: Andrew Aikawa <asai@berkeley.edu>
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.
Follow-up to #140 (merged before the CodeRabbit inline comment could land on the head branch).
test_child_stop_leaks_no_control_bytesonly exercised the child no-opstop()path. Childstop()never writes a sentinel off the owner pid, so_reader_loop’s foreign PID-tagged sentinel handling was untested. Afterwaitpid(), write_stop_sentinel(pid)to fd 2 and keep the existing assertions that the marker is not logged/teed and later output still captures.Addresses: #140 (comment)
Tested (run the relevant ones):
poetry run pytest tests/test_fd_capture.py::TestForkedChildCannotDisableParentCapture -rs— 3 passedbash format.shNote
Low Risk
Test-only change; no production fd-capture behavior is modified.
Overview
Extends
test_child_stop_leaks_no_control_bytesso it actually covers_reader_loophandling of a foreign PID-tagged stop sentinel, not only the child’s no-opstop()(which never writes a sentinel off the owner pid).After
waitpid, the parent writesfc._stop_sentinel(pid)to fd 2; existing checks still require later output to be captured, with nofdcap:flushor null bytes in logged lines.Reviewed by Cursor Bugbot for commit bce6a84. Configure here.