Commit fb69d855 authored by Boxiang Sun's avatar Boxiang Sun Committed by gsamain

Amend for the test

parent 5a51cd75
[buildout]
extends =
../python3/buildout.cfg
../gcc/buildout.cfg
[buildout]
parts = cython_nogil
parts =
cython_nogil
[cython_nogil]
recipe = plone.recipe.command
......
......@@ -15,8 +15,8 @@
[instance]
filename = instance.cfg.in
md5sum = 24a14564067e18f110ea0f630b3e2d0b
md5sum = a040b6e2323571de98606f5724246831
[template-runTestSuite]
filename = runTestSuite.in
md5sum = 99c9688ea0c3ab4594807be80279747f
md5sum = dd91f4f08a08f7d3e42857e4a85841f6
[buildout]
parts =
runTestSuite-instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = false
#################################
# Test runner
......@@ -8,6 +12,6 @@ parts =
[runTestSuite-instance]
recipe = slapos.recipe.template
url = ${template-runTestSuite:output}
output = $${directory:bin}/runTestSuite
buildout-directory = $${buildout:directory}
output = ${buildout:directory}/bin/runTestSuite
# buildout-directory = $${buildout:directory}
mode = 0700
#!${buildout:directory}/bin/${eggs:interpreter}
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
"""
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
from time import gmtime, strftime
from subprocess import check_output
def main():
raise ValueError("Running Cython nogil Test")
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 = {}
date = strftime("%Y/%m/%d %H:%M:%S", gmtime())
##########################
# Run all tests
##########################
# run 'python3 test.py build_ext --inplace'
# run 'python3 -c 'import test''
# passed if we get 'done'
# ${python3.5:location}/bin/python3
result_string = subprocess.check_output(['${python3.5:location}/bin/python3', 'test.py', 'build_ext', '--inplace'],
cwd='${cython_nogil:location}',
env={'CI': 'true'})
result_string = check_output(['${python3.5:location}/bin/python3 -c "import test"'],
shell=True,
cwd='${cython_nogil:location}',
env={'CI': 'true'})
result_dict = json.loads(result_string)
result_failed = 0 if 'done' in result_string else 1
# for result in result_dict['tests']:
test_line_dict['%s: %s' % ('Cython test', 'basic test')] = {
'test_count': 1,
'error_count': 0,
'failure_count': result_failed,
'skip_count': 0,
'duration': '',
'command': '',
'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
# report status back to Nexedi ERP5
test_result_line.stop(**test_line_dict[test_result_line.name])
except:
# Catch any exception here, to warn user instead of being silent,
# by generating fake error result
print traceback.format_exc()
result = dict(status_code=-1,
command='python3 -c "import test"', # url
stderr=traceback.format_exc(),
stdout='')
# XXX: inform test node master of error
raise EnvironmentError(result)
if __name__ == "__main__":
main()
\ No newline at end of file
......@@ -10,6 +10,14 @@ parts =
slapos-cookbook
git
instance
cython_nogil
template-runTestSuite
[eggs]
recipe = zc.recipe.egg
eggs =
erp5.util
interpreter = pythonwitheggs
[macro-template]
recipe = slapos.recipe.template
......
......@@ -197,7 +197,7 @@ def main():
# by generating fake error result
print traceback.format_exc()
result = dict(status_code=-1,
command=url,
command='python3 -c "import test"', # url
stderr=traceback.format_exc(),
stdout='')
# XXX: inform test node master of error
......
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