Commit 5a30939e by Boxiang Sun Committed by gsamain

Adjust the cython_test sr for multicore testing

parent 010e1080
......@@ -19,4 +19,4 @@ md5sum = 21e0f69f6d89f60d5a00acf8e059dffa
[template-runTestSuite]
filename = runTestSuite.in
md5sum = 7d93038e1c7ed3944acc016530a1b738
md5sum = ce3f257965a8e52b585eca5bb974064b
......@@ -8,6 +8,8 @@ import argparse, os, re, shutil, subprocess, sys, traceback
from erp5.util import taskdistribution
from time import gmtime, strftime
from subprocess import check_output
import importlib
import datetime
def main():
parser = argparse.ArgumentParser(description='Run a test suite.')
......@@ -39,29 +41,46 @@ def main():
##########################
# 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 = 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 '2.732' in result_string else 1
# for result in result_dict['tests']:
test_line_dict['%s: %s' % ('Cython test', 'nogil extension initialization')] = {
'test_count': 1,
'error_count': 0,
'failure_count': result_failed,
'skip_count': 0,
'duration': 0,
'command': '',
'stdout': '',
'stderr': '',
'html_test_result': ''
}
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)
......@@ -80,8 +99,7 @@ def main():
break
print 'Submitting: "%s"' % test_result_line.name
print test_line_dict['Cython test: nogil extension initialization']
print result_string
print test_line_dict
# report status back to Nexedi ERP5
test_result_line.stop(**test_line_dict[test_result_line.name])
......
......@@ -3,6 +3,7 @@ extends =
../../stack/slapos.cfg
../../component/git/buildout.cfg
../../component/cython_nogil/buildout.cfg
../../component/cython_lwan_coro/buildout.cfg
./buildout.hash.cfg
......@@ -11,6 +12,7 @@ parts =
git
instance
cython_nogil
cython_lwan_coro
template-runTestSuite
[eggs]
......
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 sign in to comment