Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
66b1c52d
Commit
66b1c52d
authored
Apr 11, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testunner.py: kill the whole process group
parent
dc10d52e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
15 deletions
+35
-15
greentest/testrunner.py
greentest/testrunner.py
+35
-15
No files found.
greentest/testrunner.py
View file @
66b1c52d
...
...
@@ -49,6 +49,11 @@ import traceback
from
unittest
import
_TextTestResult
,
defaultTestLoader
,
TextTestRunner
import
platform
try
:
killpg
=
os
.
killpg
except
AttributeError
:
killpg
=
None
try
:
import
sqlite3
except
ImportError
:
...
...
@@ -266,31 +271,41 @@ def run_subprocess(args, options):
retcode
=
[]
def
kill
():
if
popen
.
poll
()
is
None
:
try
:
popen
.
kill
()
except
Exception
,
ex
:
log
(
'%s: %s'
,
popen
.
pid
,
ex
)
if
killpg
:
try
:
killpg
(
popen
.
pid
,
9
)
except
OSError
,
ex
:
if
ex
.
errno
!=
3
:
raise
def
killer
():
retcode
.
append
(
'TIMEOUT'
)
sys
.
stderr
.
write
(
'Killing %s (%s) because of timeout
\
n
'
%
(
popen
.
pid
,
args
))
popen
.
kill
()
kill
()
timeout
=
Timer
(
options
.
timeout
,
killer
)
timeout
.
start
()
output
=
''
output_printed
=
False
try
:
try
:
if
options
.
capture
:
while
True
:
data
=
popen
.
stdout
.
read
(
1
)
if
not
data
:
break
output
+=
data
if
options
.
verbosity
>=
2
:
sys
.
stdout
.
write
(
data
)
output_printed
=
True
retcode
.
append
(
popen
.
wait
())
except
Exception
:
popen
.
kill
()
raise
if
options
.
capture
:
while
True
:
data
=
popen
.
stdout
.
read
(
1
)
if
not
data
:
break
output
+=
data
if
options
.
verbosity
>=
2
:
sys
.
stdout
.
write
(
data
)
output_printed
=
True
retcode
.
append
(
popen
.
wait
())
finally
:
kill
()
timeout
.
cancel
()
# QQQ compensating for run_tests' screw up
module_name
=
args
[
0
]
...
...
@@ -587,6 +602,11 @@ def main():
options
.
runid
=
str
(
random
.
random
())[
2
:]
log
(
'Generated runid: %s'
,
options
.
runid
)
if
options
.
record
:
if
killpg
:
try
:
os
.
setpgrp
()
except
AttributeError
:
pass
run_tests
(
options
,
args
)
else
:
spawn_subprocesses
(
options
,
args
)
...
...
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