Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
9da63815
Commit
9da63815
authored
Nov 28, 2012
by
Pere Cortes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Security Thread added to kill blocked process
parent
6acf7f5f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
69 deletions
+156
-69
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+135
-67
erp5/util/testnode/ProcessManager.py
erp5/util/testnode/ProcessManager.py
+20
-1
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+1
-1
No files found.
erp5/tests/testERP5TestNode.py
View file @
9da63815
This diff is collapsed.
Click to expand it.
erp5/util/testnode/ProcessManager.py
View file @
9da63815
...
...
@@ -30,6 +30,9 @@ import subprocess
import
threading
import
signal
import
sys
import
time
MAX_TIMEOUT
=
5
class
SubprocessError
(
EnvironmentError
):
def
__init__
(
self
,
status_dict
):
...
...
@@ -39,6 +42,12 @@ class SubprocessError(EnvironmentError):
def
__str__
(
self
):
return
'Error %i'
%
self
.
status_code
class
TimeoutError
(
EnvironmentError
):
def
__init__
(
self
):
pass
def
__str__
(
self
):
return
'Timeout expired. Process killed'
class
CancellationError
(
EnvironmentError
):
pass
...
...
@@ -98,8 +107,16 @@ class ProcessManager(object):
self
.
process_pid_set
=
set
()
signal
.
signal
(
signal
.
SIGTERM
,
self
.
sigterm_handler
)
self
.
under_cancellation
=
False
self
.
p
=
None
self
.
result
=
None
def
spawn
(
self
,
*
args
,
**
kw
):
def
timeoutExpired
(
p
):
time
.
sleep
(
MAX_TIMEOUT
)
if
p
.
poll
()
is
None
:
p
.
terminate
()
raise
TimeoutError
if
self
.
under_cancellation
:
raise
CancellationError
(
"Test Result was cancelled"
)
get_output
=
kw
.
pop
(
'get_output'
,
True
)
...
...
@@ -120,6 +137,8 @@ class ProcessManager(object):
p
=
subprocess
.
Popen
(
args
,
stdin
=
self
.
stdin
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
env
,
**
subprocess_kw
)
self
.
process_pid_set
.
add
(
p
.
pid
)
thread
=
threading
.
Thread
(
target
=
timeoutExpired
,
args
=
(
p
,))
thread
.
start
()
stdout
,
stderr
=
subprocess_capture
(
p
,
self
.
log
,
log_prefix
,
get_output
=
get_output
)
result
=
dict
(
status_code
=
p
.
returncode
,
command
=
command
,
...
...
@@ -127,7 +146,7 @@ class ProcessManager(object):
self
.
process_pid_set
.
discard
(
p
.
pid
)
if
self
.
under_cancellation
:
raise
CancellationError
(
"Test Result was cancelled"
)
if
raise_error_if_fail
and
p
.
returncode
:
if
raise_error_if_fail
and
p
.
returncode
!=
-
15
and
p
.
returncode
:
raise
SubprocessError
(
result
)
return
result
...
...
erp5/util/testnode/testnode.py
View file @
9da63815
...
...
@@ -257,7 +257,7 @@ branch = %(branch)s
We will build slapos software needed by the testnode itself,
like the building of selenium-runner by default
"""
self
.
_prepareSlapOS
(
self
.
config
[
'slapos_directory'
],
return
self
.
_prepareSlapOS
(
self
.
config
[
'slapos_directory'
],
test_node_slapos
,
create_partition
=
0
,
software_path_list
=
self
.
config
.
get
(
"software_list"
))
...
...
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