Commit ea808106 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8bf4418c
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2018 Nexedi SA and Contributors. # Copyright (C) 2018-2020 Nexedi SA and Contributors.
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your # it under the terms of the GNU General Public License version 3, or (at your
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
# #
# See COPYING file for full licensing terms. # See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options. # See https://www.nexedi.com/licensing for rationale and options.
"""runTestSuite - run neotest under Nexedi testing infrastructure. """nxdtest - test a project under Nexedi testing infrastructure.
neotest must be on $PATH. XXX more docs
""" """
# XXX split -> nxdtest + NXDTestfile (name=?) # XXX split -> nxdtest + NXDTestfile (name=?)
...@@ -82,6 +82,15 @@ def main(): ...@@ -82,6 +82,15 @@ def main():
argv = ['neotest', testname] argv = ['neotest', testname]
tstart = time() tstart = time()
# default status dict
status = {
'test_count': 1,
'error_count': 0,
'failure_count': 0,
'skip_count': 0,
#html_test_result
}
try: try:
# NOTE runs with unchanged cwd. Instance wrapper cares to set cwd before running us. # NOTE runs with unchanged cwd. Instance wrapper cares to set cwd before running us.
# bufsize=1 means 'line buffered' # bufsize=1 means 'line buffered'
...@@ -89,7 +98,7 @@ def main(): ...@@ -89,7 +98,7 @@ def main():
except: except:
stdout, stderr = '', traceback.format_exc() stdout, stderr = '', traceback.format_exc()
sys.stderr.write(stderr) sys.stderr.write(stderr)
ok = False status['error_count'] += 1
else: else:
# tee >stdout,stderr so we can also see in testnode logs # tee >stdout,stderr so we can also see in testnode logs
# (explicit teeing instead of p.communicate() to be able to see incremental progress) # (explicit teeing instead of p.communicate() to be able to see incremental progress)
...@@ -103,16 +112,9 @@ def main(): ...@@ -103,16 +112,9 @@ def main():
tout.join(); stdout = ''.join(buf_out) tout.join(); stdout = ''.join(buf_out)
terr.join(); stderr = ''.join(buf_err) terr.join(); stderr = ''.join(buf_err)
p.wait() p.wait()
ok = (p.returncode == 0)
# default status dict just by exit code if p.returncode != 0:
status = { status['error_count'] += 1
'test_count': 1,
'error_count': (0 if ok else 1),
'failure_count': 0,
'skip_count': 0,
#html_test_result
}
# postprocess output, if we can # postprocess output, if we can
summaryf = globals().get(testname.replace('-', '_') + '_summary') summaryf = globals().get(testname.replace('-', '_') + '_summary')
...@@ -140,7 +142,7 @@ def main(): ...@@ -140,7 +142,7 @@ def main():
stdout = stdout, stdout = stdout,
stderr = stderr, stderr = stderr,
**status **status # FIXME popen fail -> status is unbound
) )
# tee, similar to tee(1) utility, copies data from fin to fout appending them to buf. # tee, similar to tee(1) utility, copies data from fin to fout appending them to buf.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment