Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
slapos
Commits
5c4a41f8
Commit
5c4a41f8
authored
May 16, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run the cython test suite
parent
440fbb07
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
89 deletions
+33
-89
software/cython_test/buildout.hash.cfg
software/cython_test/buildout.hash.cfg
+2
-2
software/cython_test/instance.cfg.in
software/cython_test/instance.cfg.in
+7
-0
software/cython_test/runTestSuite.in
software/cython_test/runTestSuite.in
+24
-87
No files found.
software/cython_test/buildout.hash.cfg
View file @
5c4a41f8
...
...
@@ -15,8 +15,8 @@
[instance]
filename = instance.cfg.in
md5sum =
21e0f69f6d89f60d5a00acf8e059dffa
md5sum =
a061d2e923270afe0f12e3d07d72f8d3
[template-runTestSuite]
filename = runTestSuite.in
md5sum =
ce3f257965a8e52b585eca5bb974064b
md5sum =
2be3f178f167b41f919d87db48535d2d
software/cython_test/instance.cfg.in
View file @
5c4a41f8
[buildout]
parts =
runTestSuite-instance
launchTestSuite-instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = false
...
...
@@ -18,3 +19,9 @@ url = ${template-runTestSuite:output}
output = $${directory:bin}/runTestSuite
buildout-directory = $${buildout:directory}
mode = 0700
[launchTestSuite-instance]
recipe = plone.recipe.command
stop-on-error = true
update-command = true
command = (${cython_nogil:python3-binary} $${directory:bin}/runTestSuite)
software/cython_test/runTestSuite.in
View file @
5c4a41f8
...
...
@@ -4,109 +4,46 @@
"""
Script to run Cython test suite using Nexedi's test node framework.
"""
import argparse, os, re, shutil, subprocess, sys, traceback
from erp5.util import taskdistribution
import os, subprocess, sys, traceback
from time import gmtime, strftime
from subprocess import check_output
import importlib
import datetime
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')
parser.add_argument('--frontend_url',
help='The url of frontend of the test suite')
args = parser.parse_args()
is_browser_running = False
try:
test_suite_title = args.test_suite_title or args.test_suite
test_suite = args.test_suite
revision = args.revision
test_line_dict = {}
try:
date = strftime("%Y/%m/%d %H:%M:%S", gmtime())
###########################
# Run Cython's test suite #
###########################
##########################
# Run all tests
##########################
# We need to screw up the working directory because Cython's runtests script relies on it
os.chdir("${cython_nogil:location}")
path_var = os.pathsep.join([os.environ.get('PATH', os.defpath), '${python3.5:location}/bin/python3/bin/'])
env = dict(os.environ, PATH=path_var)
test_list = ['basic_test', 'lwan_coro_test']
failed = 0
result_string = None
duration = 0
test_line_dict = {}
for test_name in test_list:
failed = 0
result_string = None
duration = 0
try:
sys.path.append('${cython_nogil:location}/nogil_test/')
test_module = importlib.import_module(test_name)
except ImportError as e:
failed = 1
stdout = str(e)
else:
start_time = datetime.datetime.now()
result_string = test_module.run(env, '${python3.5:location}/bin/python3')
end_time = datetime.datetime.now()
duration = (end_time - start_time).total_seconds()
failed = result_string['failed']
stdout = result_string['stdout']
test_line_dict['%s: %s' % ('Cython test', test_name)] = {
'test_count': 1,
'error_count': 0,
'failure_count': failed,
'skip_count': 0,
'duration': duration,
'command': '',
'stdout': stdout,
'stderr': '',
'html_test_result': '',
}
# Send results
tool = taskdistribution.TaskDistributor(portal_url=args.master_url)
test_result = tool.createTestResult(revision = revision,
test_name_list = test_line_dict.keys(),
node_title = args.test_node_title,
test_title = test_suite_title,
project_title = args.project_title)
if test_result is None or not hasattr(args, 'master_url'):
return
# report test results
while 1:
test_result_line = test_result.start()
if not test_result_line:
print 'No test result anymore.'
break
print 'Submitting: "%s"' % test_result_line.name
print test_line_dict
# report status back to Nexedi ERP5
test_result_line.stop(**test_line_dict[test_result_line.name])
python_path = '${python3.5:location}/bin/python3'
print("Setup is:")
print("python_path=", python_path)
print("test location: ${cython_nogil:location}/runtests.py")
start_time = datetime.datetime.now()
print("Starting at", start_time)
result = subprocess.run([python_path + " runtests.py"],
env=env,
shell=True,
)
end_time = datetime.datetime.now()
duration = (end_time - start_time).total_seconds()
print("Ending at", end_time, " (duration: %s seconds)" % duration)
return result.returncode
except:
# Catch any exception here, to warn user instead of being silent,
# by generating fake error result
print
traceback.format_exc(
)
print
(traceback.format_exc()
)
result = dict(status_code=-1,
command='python3 -c "import test"', # url
stderr=traceback.format_exc(),
...
...
@@ -115,4 +52,4 @@ def main():
raise EnvironmentError(result)
if __name__ == "__main__":
main()
\ No newline at end of file
main()
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