Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
f1840722
Commit
f1840722
authored
Sep 25, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ea808106
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
13 deletions
+57
-13
go/neo/t/nxd/nxdtest
go/neo/t/nxd/nxdtest
+57
-13
No files found.
go/neo/t/nxd/nxdtest
View file @
f1840722
...
...
@@ -22,6 +22,8 @@
XXX more docs
"""
from
__future__
import
print_function
,
absolute_import
# XXX split -> nxdtest + NXDTestfile (name=?)
from
erp5.util.taskdistribution
import
TaskDistributor
...
...
@@ -51,11 +53,16 @@ def main():
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
'%(asctime)s - %(levelname)s - %(message)s'
)
logger
=
logging
.
getLogger
()
# list of tests to run
testv
=
[
'test-go'
,
'test-py'
,
'bench-local'
]
# XXX -> .nxdtest
# master_url provided -> run tests under master control
if
args
.
master_url
is
not
None
:
# connect to master and create 'test result' object with list of tests to run
tool
=
TaskDistributor
(
portal_url
=
args
.
master_url
,
logger
=
logger
)
test_result
=
tool
.
createTestResult
(
revision
=
args
.
revision
,
test_name_list
=
[
'test-go'
,
'test-py'
,
'bench-local'
]
,
test_name_list
=
testv
,
node_title
=
args
.
test_node_title
,
test_title
=
args
.
test_suite_title
or
args
.
test_suite
,
project_title
=
args
.
project_title
)
...
...
@@ -64,6 +71,10 @@ def main():
# a test run for given name and revision has already been completed
return
# master_url not provided -> run tests locally
else
:
test_result
=
LocalTestResult
(
testv
)
# make sure we get output from subprocesses without delay.
# go does not buffer stdout/stderr by default, but python does for stdout.
# tell python not to buffer anything.
...
...
@@ -142,7 +153,7 @@ def main():
stdout
=
stdout
,
stderr
=
stderr
,
**
status
# FIXME popen fail -> status is unbound
**
status
)
# tee, similar to tee(1) utility, copies data from fin to fout appending them to buf.
...
...
@@ -164,6 +175,39 @@ def tee(fin, fout, buf):
buf
.
append
(
data
)
# LocalTestResult* handle tests runs, when master_url was not provided and tests are run locally.
class
LocalTestResult
:
def
__init__
(
self
,
test_name_list
):
self
.
testv
=
test_name_list
self
.
next
=
0
# testv[next] is next test to execute
def
start
(
self
):
# -> test_result_line
if
self
.
next
>
len
(
self
.
testv
):
return
None
# all tests are done
test_result_line
=
LocalTestResultLine
()
test_result_line
.
name
=
self
.
testv
[
self
.
next
]
self
.
next
+=
1
return
test_result_line
class
LocalTestResultLine
:
def
stop
(
self
,
**
kw
):
def
v
(
name
):
kw
.
get
(
'name'
,
'?'
)
_
=
v
(
'error_count'
)
if
_
==
'?'
:
st
=
'?'
elif
_
==
0
:
st
=
'ok'
else
:
st
=
'fail'
print
(
'%s
\
t
%s
\
t
i%.3fs
\
t
# %sT %sE %sF %sS'
%
(
st
,
self
.
name
,
v
(
'test_count'
),
v
(
'error_count'
),
v
(
'failure_count'
),
v
(
'skip_count'
)))
# xint converts number from neo/py test output to integer
def
xint
(
s
):
s
=
s
.
strip
()
...
...
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