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
Romain Courteaud
slapos
Commits
861f1136
Commit
861f1136
authored
Mar 18, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
bf01075e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
61 deletions
+35
-61
software/neoppod/runTestSuite.in
software/neoppod/runTestSuite.in
+35
-61
No files found.
software/neoppod/runTestSuite.in
View file @
861f1136
...
...
@@ -2,10 +2,8 @@
"""
Script to run NEO test suite using Nexedi's test node framework.
"""
import argparse, sys, subprocess, os, glob
import traceback
import argparse, os, re, shutil, subprocess, sys, traceback
from erp5.util import taskdistribution
import re
from time import gmtime, strftime
# pattern to get test counts from stdout
...
...
@@ -14,26 +12,12 @@ SUMMARY_RE = re.compile( \
re.MULTILINE)
# NEO specific environment
TEMP_DIRECTORY = '{{neo_temp_directory}}/neotest_tmp'
MYSQL_UNIX_PORT = '{{my_cnf_parameters.socket}}'
NEO_TESTS_ADAPTER = 'SQLite'
TEMP_DIRECTORY = '{{neo_temp_directory}}'
NEO_DB_SOCKET = '{{my_cnf_parameters.socket}}'
RUN_NEO_TESTS_COMMAND = '{{ neotestrunner }}'
def cleanup():
"""
Clean up from previous runs.
"""
for root, dirs, files in os.walk(TEMP_DIRECTORY, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
if NEO_TESTS_ADAPTER == 'MySQL':
# XXX: remove MySQL
pass
def parseTestStdOut(data):
"""
"""
Parse output of NEO testrunner script.
"""
test_count = 0
...
...
@@ -80,28 +64,13 @@ def main():
parser.add_argument('--master_url',
help='The Url of Master controling many suites',
default=None)
parser.add_argument('--db_list', help='A list of sql connection strings')
# parameters that needs to be passed to runUnitTest
parser.add_argument('--conversion_server_hostname', default=None)
parser.add_argument('--conversion_server_port', default=None)
parser.add_argument('--volatile_memcached_server_hostname', default=None)
parser.add_argument('--volatile_memcached_server_port', default=None)
parser.add_argument('--persistent_memcached_server_hostname', default=None)
parser.add_argument('--persistent_memcached_server_port', default=None)
parser.add_argument('--bt5_path', default=None)
parser.add_argument("--xvfb_bin", default=None)
parser.add_argument("--firefox_bin", default=None)
args = parser.parse_args()
test_suite_title = args.test_suite_title or args.test_suite
revision = args.revision
# XXX: think of good name as it represents al tests inside NEO
# one way is to examing all test files avaliable and register them
# but then when parsing we must report each test as a test line - i.e.
# we execute test one by one, collect output and parse and report to Nexedi ERP5.
test_name_list = ['testNEO']
test_name_list = 'SQLite', 'MySQL'
tool = taskdistribution.TaskDistributionTool(portal_url = args.master_url)
test_result = tool.createTestResult(revision = revision,
...
...
@@ -109,26 +78,30 @@ def main():
node_title = args.test_node_title,
test_title = test_suite_title,
project_title = args.project_title)
if test_result is not None:
# clean up previous runs
cleanup()
# run NEO tests
if test_result is None:
return
# clean up previous runs
for x in os.listdir(TEMP_DIRECTORY):
shutil.rmtree(os.path.join(TEMP_DIRECTORY, x))
# run NEO tests
while 1:
test_result_line = test_result.start()
if not test_result_line:
break
# XXX: add '-z' - i.e. ZODB tests when find out why it stalled execution.
args = [RUN_NEO_TESTS_COMMAND, '-uf
v
']
args = [RUN_NEO_TESTS_COMMAND, '-uf']
command = ' '.join(args)
stdin = file(os.devnull)
env = {'TEMP': TEMP_DIRECTORY,
'NEO_TESTS_ADAPTER': NEO_TESTS_ADAPTER}
if NEO_TESTS_ADAPTER == 'MySQL':
env['MYSQL_UNIX_PORT'] = MYSQL_UNIX_PORT
env = {'TEMP': TEMP_DIRECTORY,
'NEO_TESTS_ADAPTER': test_result_line.name,
'NEO_TEST_ZODB_FUNCTIONAL': '1',
'NEO_DB_SOCKET': NEO_DB_SOCKET}
try:
p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
with open(os.devnull) as stdin:
p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
except Exception:
# Catch any exception here, to warn user instead of be
e
ing silent,
# Catch any exception here, to warn user instead of being silent,
# by generating fake error result
result = dict(status_code=-1,
command=command,
...
...
@@ -138,25 +111,26 @@ def main():
raise EnvironmentError(result)
# parse test stdout / stderr, hint to speed up use files first!
stdout
= p.stdout.read
()
stdout
, stderr = p.communicate
()
date = strftime("%Y/%m/%d %H:%M:%S", gmtime())
test_count, error_count, expected_count, skip_count, duration = parseTestStdOut(stdout)
test_count, error_count, expected_count, skip_count, duration = \
parseTestStdOut(stdout)
# print to stdout so we can see in testnode logs
print test_result_line
print stdout
sys.stdout.write(stdout)
sys.stderr.write(stderr)
# report status back to Nexedi ERP5
test_result_line.stop(
test_count = test_count,
error_count = error_count,
test_count = test_count,
error_count = error_count,
failure_count = expected_count,
skip_count = skip_count,
duration = duration,
date = date,
skip_count = skip_count,
duration = duration,
date = date,
command = command,
stdout= stdout,
stderr=
None
,
stdout= stdout,
stderr=
stderr
,
html_test_result='')
if __name__ == "__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