Skip to content

[3.6] bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) - #3070

Merged
vstinner merged 1 commit into
python:3.6from
vstinner:subprocess_stopped36
Aug 11, 2017
Merged

[3.6] bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055)#3070
vstinner merged 1 commit into
python:3.6from
vstinner:subprocess_stopped36

Conversation

@vstinner

@vstinner vstinner commented Aug 11, 2017

Copy link
Copy Markdown
Member

The current test_child_terminated_in_stopped_state() function test
creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and
then crash (SIGSEGV). The problem is that calling os.waitpid() in the
parent process is not enough to close the process: the child process
remains alive and so the unit test leaks a child process in a
strange state. Closing the child process requires non-trivial code,
maybe platform specific.

Remove the functional test and replaces it with an unit test which
mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to
test the WIFSTOPPED() path.
(cherry picked from commit 7b7c6dc)

https://bugs.python.org/issue31173

The current test_child_terminated_in_stopped_state() function test
creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and
then crash (SIGSEGV). The problem is that calling os.waitpid() in the
parent process is not enough to close the process: the child process
remains alive and so the unit test leaks a child process in a
strange state. Closing the child process requires non-trivial code,
maybe platform specific.

Remove the functional test and replaces it with an unit test which
mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to
test the WIFSTOPPED() path.
(cherry picked from commit 7b7c6dc)
@vstinner
vstinner merged commit bc69d00 into python:3.6 Aug 11, 2017
@vstinner
vstinner deleted the subprocess_stopped36 branch August 11, 2017 00:36
@vstinner

Copy link
Copy Markdown
Member Author

@gpshead: Thanks for you review ;-)

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.

3 participants