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
1d706b24
Commit
1d706b24
authored
Sep 25, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0831ee2b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
10 deletions
+40
-10
go/neo/t/nxd/.nxdtest
go/neo/t/nxd/.nxdtest
+5
-0
go/neo/t/nxd/nxdtest
go/neo/t/nxd/nxdtest
+35
-10
No files found.
go/neo/t/nxd/.nxdtest
0 → 100644
View file @
1d706b24
# setup for continous integration via nxdtes
TestCase('test-go', ['neotest', 'test-go'])
TestCase('test-py', ['neotest', 'test-py'])
TestCase('bench-local', ['neotest', 'bench-local'])
go/neo/t/nxd/nxdtest
View file @
1d706b24
...
...
@@ -31,6 +31,32 @@ from subprocess import Popen, PIPE
from
time
import
time
,
strftime
,
gmtime
import
os
,
sys
,
threading
,
argparse
,
logging
,
traceback
,
re
# loadNXDTestFile loads .nxdtest file located @path.
def
loadNXDTestFile
(
path
):
# -> TestEnv
t
=
TestEnv
()
g
=
{
'TestCase'
:
t
.
TestCase
}
# TODO + all other public TestEnv methods
six
.
exec_
(
code
,
g
)
return
t
# TestCase defines one test case to run.
class
TestCase
:
def
__init__
(
self
,
name
,
argv
,
**
kw
):
self
.
name
=
name
self
.
argv
=
argv
self
.
kw
=
kw
# TestEnv represents a testing environment with set of TestCases to run.
class
TestEnv
:
def
__init__
(
self
):
self
.
byname
=
{}
# of TestCase
self
.
testv
=
[]
# of TestCase
# TestCase adds new test case to the environment.
def
TestCase
(
self
,
name
,
argv
,
**
kw
):
assert
name
not
in
self
.
byname
t
=
TestCase
(
name
,
argv
,
**
kw
)
self
.
testv
.
append
(
t
)
self
.
byname
[
name
]
=
t
def
main
():
# testnode executes us giving URL to master results collecting instance and other details
...
...
@@ -53,8 +79,8 @@ def main():
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
'%(asctime)s - %(levelname)s - %(message)s'
)
logger
=
logging
.
getLogger
()
# list of tests to run
te
stv
=
[
'test-go'
,
'test-py'
,
'bench-local'
]
# XXX -> .nxdtest
# l
oad l
ist of tests to run
te
nv
=
loadNXDTestFile
(
'.nxdtest'
)
# master_url provided -> run tests under master control
if
args
.
master_url
is
not
None
:
...
...
@@ -62,7 +88,7 @@ def main():
tool
=
TaskDistributor
(
portal_url
=
args
.
master_url
,
logger
=
logger
)
test_result
=
tool
.
createTestResult
(
revision
=
args
.
revision
,
test_name_list
=
testv
,
test_name_list
=
te
nv
.
te
stv
,
node_title
=
args
.
test_node_title
,
test_title
=
args
.
test_suite_title
or
args
.
test_suite
,
project_title
=
args
.
project_title
)
...
...
@@ -73,7 +99,7 @@ def main():
# master_url not provided -> run tests locally
else
:
test_result
=
LocalTestResult
(
testv
)
test_result
=
LocalTestResult
(
te
nv
.
te
stv
)
# make sure we get output from subprocesses without delay.
# go does not buffer stdout/stderr by default, but python does for stdout.
...
...
@@ -88,9 +114,8 @@ def main():
if
test_result_line
is
None
:
break
# run `neotest <test-name>`
testname
=
test_result_line
.
name
argv
=
[
'neotest'
,
testname
]
# run tenv[name]
t
=
tenv
.
byname
[
test_result_line
.
name
]
tstart
=
time
()
# default status dict
...
...
@@ -105,10 +130,10 @@ def main():
try
:
# NOTE runs with unchanged cwd. Instance wrapper cares to set cwd before running us.
# bufsize=1 means 'line buffered'
p
=
Popen
(
argv
,
stdin
=
devnull
,
stdout
=
PIPE
,
stderr
=
PIPE
,
bufsize
=
1
)
p
=
Popen
(
t
.
argv
,
stdin
=
devnull
,
stdout
=
PIPE
,
stderr
=
PIPE
,
bufsize
=
1
)
except
:
stdout
=
''
stderr
=
'run %r
\
n
%s'
%
(
argv
,
traceback
.
format_exc
())
stderr
=
'run %r
\
n
%s'
%
(
t
.
argv
,
traceback
.
format_exc
())
sys
.
stderr
.
write
(
stderr
)
status
[
'error_count'
]
+=
1
else
:
...
...
@@ -129,7 +154,7 @@ def main():
status
[
'error_count'
]
+=
1
# postprocess output, if we can
summaryf
=
globals
().
get
(
t
est
name
.
replace
(
'-'
,
'_'
)
+
'_summary'
)
summaryf
=
globals
().
get
(
t
.
name
.
replace
(
'-'
,
'_'
)
+
'_summary'
)
if
summaryf
is
not
None
:
try
:
summary
=
summaryf
(
stdout
)
...
...
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