Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
606c3f54
Commit
606c3f54
authored
May 09, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12041: Make test_wait3 more robust.
parent
5aa878c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
Lib/test/fork_wait.py
Lib/test/fork_wait.py
+6
-4
Lib/test/test_wait3.py
Lib/test/test_wait3.py
+5
-2
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/fork_wait.py
View file @
606c3f54
...
...
@@ -43,6 +43,7 @@ class ForkWait(unittest.TestCase):
self
.
assertEqual
(
spid
,
cpid
)
self
.
assertEqual
(
status
,
0
,
"cause = %d, exit = %d"
%
(
status
&
0xff
,
status
>>
8
))
@
support
.
reap_threads
def
test_wait
(
self
):
for
i
in
range
(
NUM_THREADS
):
_thread
.
start_new
(
self
.
f
,
(
i
,))
...
...
@@ -69,7 +70,8 @@ class ForkWait(unittest.TestCase):
os
.
_exit
(
n
)
else
:
# Parent
self
.
wait_impl
(
cpid
)
# Tell threads to die
self
.
stop
=
1
time
.
sleep
(
2
*
SHORTSLEEP
)
# Wait for threads to die
try
:
self
.
wait_impl
(
cpid
)
finally
:
# Tell threads to die
self
.
stop
=
1
Lib/test/test_wait3.py
View file @
606c3f54
...
...
@@ -19,13 +19,16 @@ except AttributeError:
class
Wait3Test
(
ForkWait
):
def
wait_impl
(
self
,
cpid
):
for
i
in
range
(
10
):
# This many iterations can be required, since some previously run
# tests (e.g. test_ctypes) could have spawned a lot of children
# very quickly.
for
i
in
range
(
30
):
# wait3() shouldn't hang, but some of the buildbots seem to hang
# in the forking tests. This is an attempt to fix the problem.
spid
,
status
,
rusage
=
os
.
wait3
(
os
.
WNOHANG
)
if
spid
==
cpid
:
break
time
.
sleep
(
1.0
)
time
.
sleep
(
0.1
)
self
.
assertEqual
(
spid
,
cpid
)
self
.
assertEqual
(
status
,
0
,
"cause = %d, exit = %d"
%
(
status
&
0xff
,
status
>>
8
))
...
...
Misc/NEWS
View file @
606c3f54
...
...
@@ -619,6 +619,8 @@ Extension Modules
Tests
-----
- Issue #12041: Make test_wait3 more robust.
- Issue #11873: Change regex in test_compileall to fix occasional failures when
when the randomly generated temporary path happened to match the regex.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment