Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
20f96ce5
Commit
20f96ce5
authored
Apr 24, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cython-test: new SR to test our developments on Cython
parent
9b472b64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
215 additions
and
0 deletions
+215
-0
software/cython-test/runTestSuite.in
software/cython-test/runTestSuite.in
+133
-0
software/cython-test/software.cfg
software/cython-test/software.cfg
+82
-0
No files found.
software/cython-test/runTestSuite.in
0 → 100644
View file @
20f96ce5
#!{{ runTestSuite_py }}
"""
Script to run the Cython test suite using Nexedi's test node framework.
"""
import argparse, json, os, subprocess, sys, traceback
from time import gmtime, strftime, time
from unittest import TextTestResult
from erp5.util import taskdistribution, testsuite
{%- if prepend_path is defined %}
PATH = os.environ['PATH']
os.environ['PATH'] = {{ repr(prepend_path) }} + (PATH and os.pathsep + PATH)
{%- endif %}
os.environ['TEMP'] = {{ repr(tmpdir) }}
os.environ['PYTHON'] = sys.executable
os.environ['PYTHONPATH'] = os.pathsep.join(
sys.path[:-int(subprocess.check_output((
sys.executable, '-c', 'import sys;print(len(sys.path))')))])
command = """set -e {{ gettext_location }}/lib
make
LD_RUN_PATH=$1 LIBRARY_PATH=$1 make test
"""
def parseTestStdOut(data):
"""
Parse output of Cython testrunner script.
"""
data = data.rsplit(b'\n' + TextTestResult.separator2.encode() + b'\n', 1)[1]
status_dict = {}
search = testsuite.TestSuite.RUN_RE.search(data)
if search:
groupdict = search.groupdict()
status_dict.update(duration=float(groupdict['seconds']),
test_count=int(groupdict['all_tests']))
search = testsuite.TestSuite.STATUS_RE.search(data)
if search:
groupdict = search.groupdict()
status_dict.update(
error_count=int(groupdict['errors'] or 0),
failure_count=int(groupdict['failures'] or 0)
+int(groupdict['unexpected_successes'] or 0),
skip_count=int(groupdict['skips'] or 0)
+int(groupdict['expected_failures'] or 0))
return status_dict
class DummyTestResult:
class DummyTestResultLine:
def stop(self, **kw):
with open(self.name + '.json', 'w') as f:
json.dump(kw, f)
done = 0
def __init__(self, test_name_list):
self.test_name_list = test_name_list
def start(self):
test_result_line = self.DummyTestResultLine()
try:
test_result_line.name = self.test_name_list[self.done]
except IndexError:
return
self.done += 1
return test_result_line
def main():
parser = argparse.ArgumentParser(description='Run a test suite.')
parser.add_argument('--test_suite', help='The test suite name')
parser.add_argument('--test_suite_title', help='The test suite title')
parser.add_argument('--test_node_title', help='The test node title')
parser.add_argument('--project_title', help='The project title')
parser.add_argument('--revision', help='The revision to test',
default='dummy_revision')
parser.add_argument('--node_quantity', help='ignored', type=int)
parser.add_argument('--master_url',
help='The Url of Master controling many suites')
args = parser.parse_args()
test_suite_title = args.test_suite_title or args.test_suite
test_name_list = 'cython',
if args.master_url:
tool = taskdistribution.TaskDistributor(portal_url = args.master_url)
test_result = tool.createTestResult(args.revision,
test_name_list,
args.test_node_title,
test_title=test_suite_title,
project_title=args.project_title)
if test_result is None:
return
else:
test_result = DummyTestResult(test_name_list)
# run NEO tests
while 1:
test_result_line = test_result.start()
if not test_result_line:
break
try:
with open(os.devnull) as stdin:
p = subprocess.Popen(command, shell=True, stdin=stdin,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
cwd={{repr(cython_repository)}})
except Exception:
end = time()
stderr = traceback.format_exc()
status_dict = {}
sys.stderr.write(stderr)
else:
stdout, stderr = p.communicate()
end = time()
os.write(1, stdout)
os.write(2, stderr)
status_dict = parseTestStdOut(stderr)
if str is not bytes:
stdout = stdout.decode('utf-8')
stderr = stderr.decode('utf-8')
status_dict['stdout'] = stdout
# report status back to Nexedi ERP5
test_result_line.stop(
command=command,
date=strftime("%Y/%m/%d %H:%M:%S", gmtime(end)),
stderr=stderr,
**status_dict)
if __name__ == "__main__":
main()
software/cython-test/software.cfg
0 → 100644
View file @
20f96ce5
[buildout]
extends =
../../stack/slapos.cfg
../../component/numpy/buildout.cfg
parts =
slapos-cookbook
template
[python]
part = python3
[template]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/template.cfg
template =
inline:[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = runTestSuite
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
[directory]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
[runTestSuite]
recipe = slapos.recipe.template:jinja2
rendered = $${directory:bin}/$${:_buildout_section_name_}
template = ${runTestSuite.in:target}
mode = 0755
context =
key tmpdir directory:tmp
key slapparameter_dict slap-configuration:configuration
key cython_repository cython-repository:location
raw runTestSuite_py ${buildout:bin-directory}/${runTestSuite_py:interpreter}
raw gettext_location ${gettext:location}
{%- if 'part' in gcc %}
raw prepend_path {{ gcc.prefix }}/bin
{%- endif %}
[cython-repository]
recipe = slapos.recipe.build:gitclone
repository = ${cython-repository:location}
git-executable = ${git:location}/bin/git
shared = true
context =
section gcc gcc
[cython-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/nexedi/cython.git
git-executable = ${git:location}/bin/git
sparse-checkout = /.gitignore
[runTestSuite.in]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_buildout_section_name_}
md5sum = aea029e484875a1e6e69f9e2e1d9efdd
[runTestSuite_py]
recipe = zc.recipe.egg
eggs =
erp5.util
${numpy:egg}
coverage
pycodestyle
interpreter = ${:_buildout_section_name_}
[versions]
slapos.recipe.template = 4.4
coverage = 4.5.1
numpy = 1.16.4
pycodestyle = 2.5.0
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