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
45b8bba6
Commit
45b8bba6
authored
Jul 04, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use erp5.tool.taskdistribution in runTestSuite.
parent
4e2fdaea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
67 deletions
+18
-67
product/ERP5Type/tests/runTestSuite.py
product/ERP5Type/tests/runTestSuite.py
+18
-67
No files found.
product/ERP5Type/tests/runTestSuite.py
View file @
45b8bba6
#!/usr/bin/env python2.6
import
argparse
,
pprint
,
socket
,
sys
,
time
,
xmlrpclib
from
DummyTaskDistributionTool
import
DummyTaskDistributionTool
from
ERP5TypeTestSuite
import
ERP5TypeTestSuite
import
argparse
,
sys
from
erp5.util
import
taskdistribution
# XXX: below section is shared with erp5/util/testnode/testnode.py .
# They are supposed to be merged into a common library/tool someday, until
# then please keep them synchronised.
# Depending on used xmlrpc backend, different exceptions can be thrown.
SAFE_RPC_EXCEPTION_LIST
=
[
socket
.
error
,
xmlrpclib
.
ProtocolError
,
xmlrpclib
.
Fault
]
parser
,
_
=
xmlrpclib
.
getparser
()
if
xmlrpclib
.
ExpatParser
and
isinstance
(
parser
,
xmlrpclib
.
ExpatParser
):
SAFE_RPC_EXCEPTION_LIST
.
append
(
xmlrpclib
.
expat
.
ExpatError
)
else
:
print
>>
sys
.
stderr
,
'Warning: unhandled xmlrpclib parser %r, some '
\
'exceptions might get through safeRpcCall'
%
(
parser
,
)
SAFE_RPC_EXCEPTION_LIST
=
tuple
(
SAFE_RPC_EXCEPTION_LIST
)
parser_klass
=
parser
.
__class__
__original_feed
=
parser_klass
.
feed
def
verbose_feed
(
self
,
data
):
try
:
return
__original_feed
(
self
,
data
)
except
Exception
:
print
>>
sys
.
stderr
,
'Error parsing data:'
,
repr
(
data
)
raise
try
:
parser_klass
.
feed
=
verbose_feed
except
TypeError
:
print
>>
sys
.
stderr
,
'Warning: could not monkey-patch %r.feed to output '
\
'parsed data on error, debugging in case of error will be more '
\
'difficult'
%
(
parser_klass
,
)
del
parser
,
verbose_feed
,
parser_klass
,
_
# XXX: This import is required, just to populate sys.modules['test_suite'].
# Even if it's not used in this file. Yuck.
import
ERP5TypeTestSuite
def
_parsingErrorHandler
(
data
,
_
):
print
>>
sys
.
stderr
,
'Error parsing data:'
,
repr
(
data
)
taskdistribution
.
patchRPCParser
(
_parsingErrorHandler
)
def
makeSuite
(
node_quantity
=
None
,
test_suite
=
None
,
revision
=
None
,
db_list
=
None
,
**
kwargs
):
...
...
@@ -56,23 +35,6 @@ def makeSuite(node_quantity=None, test_suite=None, revision=None,
**
kwargs
)
return
suite
def
safeRpcCall
(
function
,
*
args
):
retry
=
64
xmlrpc_arg_list
=
[]
for
argument
in
args
:
if
isinstance
(
argument
,
dict
):
argument
=
dict
([(
x
,
isinstance
(
y
,
str
)
and
xmlrpclib
.
Binary
(
y
)
or
y
)
\
for
(
x
,
y
)
in
argument
.
iteritems
()])
xmlrpc_arg_list
.
append
(
argument
)
while
True
:
try
:
return
function
(
*
xmlrpc_arg_list
)
except
SAFE_RPC_EXCEPTION_LIST
,
e
:
print
>>
sys
.
stderr
,
e
pprint
.
pprint
(
args
,
file
(
function
.
_Method__name
,
'w'
))
time
.
sleep
(
retry
)
retry
+=
retry
>>
1
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Run a test suite.'
)
parser
.
add_argument
(
'--test_suite'
,
help
=
'The test suite name'
)
...
...
@@ -102,16 +64,7 @@ def main():
args
=
parser
.
parse_args
()
if
args
.
bt5_path
is
not
None
:
sys
.
path
[
0
:
0
]
=
args
.
bt5_path
.
split
(
","
)
if
args
.
master_url
is
not
None
:
master_url
=
args
.
master_url
if
master_url
[
-
1
]
!=
'/'
:
master_url
+=
'/'
master
=
xmlrpclib
.
ServerProxy
(
"%s%s"
%
(
master_url
,
'portal_task_distribution'
),
allow_none
=
1
)
assert
master
.
getProtocolRevision
()
==
1
else
:
master
=
DummyTaskDistributionTool
()
master
=
taskdistribution
.
TaskDistributionTool
(
args
.
master_url
)
test_suite_title
=
args
.
test_suite_title
or
args
.
test_suite
revision
=
args
.
revision
suite
=
makeSuite
(
test_suite
=
args
.
test_suite
,
...
...
@@ -119,17 +72,15 @@ def main():
revision
=
revision
,
db_list
=
args
.
db_list
,
bt5_path
=
args
.
bt5_path
)
test_result
=
safeRpcCall
(
master
.
createTestResult
,
args
.
test_suite
,
revision
,
suite
.
getTestList
(),
suite
.
allow_restart
,
test_suite_title
,
args
.
test_node_title
,
test_result
=
master
.
createTestResult
(
revision
,
suite
.
getTestList
(),
args
.
test_node_title
,
suite
.
allow_restart
,
test_suite_title
,
args
.
project_title
)
if
test_result
:
test_result_path
,
test_revision
=
test_result
if
test_result
is
not
None
:
assert
revision
==
test_result
.
revision
,
(
revision
,
test_result
.
revision
)
while
suite
.
acquire
():
test
=
safeRpcCall
(
master
.
startUnitTest
,
test_result_path
,
suite
.
running
.
keys
())
if
test
:
suite
.
start
(
test
[
1
],
lambda
status_dict
,
__test_path
=
test
[
0
]:
safeRpcCall
(
master
.
stopUnitTest
,
__test_path
,
status_dict
))
test
=
test_result
.
start
(
suite
.
running
.
keys
())
if
test
is
not
None
:
suite
.
start
(
test
.
name
,
lambda
status_dict
,
__test
=
test
:
test
.
stop
(
**
status_dict
))
elif
not
suite
.
running
:
break
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