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 @@
...
@@ -2,10 +2,8 @@
"""
"""
Script to run NEO test suite using Nexedi's test node framework.
Script to run NEO test suite using Nexedi's test node framework.
"""
"""
import argparse, sys, subprocess, os, glob
import argparse, os, re, shutil, subprocess, sys, traceback
import traceback
from erp5.util import taskdistribution
from erp5.util import taskdistribution
import re
from time import gmtime, strftime
from time import gmtime, strftime
# pattern to get test counts from stdout
# pattern to get test counts from stdout
...
@@ -14,26 +12,12 @@ SUMMARY_RE = re.compile( \
...
@@ -14,26 +12,12 @@ SUMMARY_RE = re.compile( \
re.MULTILINE)
re.MULTILINE)
# NEO specific environment
# NEO specific environment
TEMP_DIRECTORY = '{{neo_temp_directory}}/neotest_tmp'
TEMP_DIRECTORY = '{{neo_temp_directory}}'
MYSQL_UNIX_PORT = '{{my_cnf_parameters.socket}}'
NEO_DB_SOCKET = '{{my_cnf_parameters.socket}}'
NEO_TESTS_ADAPTER = 'SQLite'
RUN_NEO_TESTS_COMMAND = '{{ neotestrunner }}'
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):
def parseTestStdOut(data):
"""
"""
Parse output of NEO testrunner script.
Parse output of NEO testrunner script.
"""
"""
test_count = 0
test_count = 0
...
@@ -80,28 +64,13 @@ def main():
...
@@ -80,28 +64,13 @@ def main():
parser.add_argument('--master_url',
parser.add_argument('--master_url',
help='The Url of Master controling many suites',
help='The Url of Master controling many suites',
default=None)
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()
args = parser.parse_args()
test_suite_title = args.test_suite_title or args.test_suite
test_suite_title = args.test_suite_title or args.test_suite
revision = args.revision
revision = args.revision
# XXX: think of good name as it represents al tests inside NEO
test_name_list = 'SQLite', 'MySQL'
# 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']
tool = taskdistribution.TaskDistributionTool(portal_url = args.master_url)
tool = taskdistribution.TaskDistributionTool(portal_url = args.master_url)
test_result = tool.createTestResult(revision = revision,
test_result = tool.createTestResult(revision = revision,
...
@@ -109,26 +78,30 @@ def main():
...
@@ -109,26 +78,30 @@ def main():
node_title = args.test_node_title,
node_title = args.test_node_title,
test_title = test_suite_title,
test_title = test_suite_title,
project_title = args.project_title)
project_title = args.project_title)
if test_result is not None:
if test_result is None:
# clean up previous runs
return
cleanup()
# clean up previous runs
for x in os.listdir(TEMP_DIRECTORY):
# run NEO tests
shutil.rmtree(os.path.join(TEMP_DIRECTORY, x))
# run NEO tests
while 1:
test_result_line = test_result.start()
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.
# 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)
command = ' '.join(args)
stdin = file(os.devnull)
env = {'TEMP': TEMP_DIRECTORY,
env = {'TEMP': TEMP_DIRECTORY,
'NEO_TESTS_ADAPTER': test_result_line.name,
'NEO_TESTS_ADAPTER': NEO_TESTS_ADAPTER}
'NEO_TEST_ZODB_FUNCTIONAL': '1',
if NEO_TESTS_ADAPTER == 'MySQL':
'NEO_DB_SOCKET': NEO_DB_SOCKET}
env['MYSQL_UNIX_PORT'] = MYSQL_UNIX_PORT
try:
try:
p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE,
with open(os.devnull) as stdin:
stderr=subprocess.PIPE, env=env)
p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env)
except Exception:
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
# by generating fake error result
result = dict(status_code=-1,
result = dict(status_code=-1,
command=command,
command=command,
...
@@ -138,25 +111,26 @@ def main():
...
@@ -138,25 +111,26 @@ def main():
raise EnvironmentError(result)
raise EnvironmentError(result)
# parse test stdout / stderr, hint to speed up use files first!
# 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())
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 to stdout so we can see in testnode logs
print test_result_line
sys.stdout.write(stdout)
print stdout
sys.stderr.write(stderr)
# report status back to Nexedi ERP5
# report status back to Nexedi ERP5
test_result_line.stop(
test_result_line.stop(
test_count = test_count,
test_count = test_count,
error_count = error_count,
error_count = error_count,
failure_count = expected_count,
failure_count = expected_count,
skip_count = skip_count,
skip_count = skip_count,
duration = duration,
duration = duration,
date = date,
date = date,
command = command,
command = command,
stdout= stdout,
stdout= stdout,
stderr=
None
,
stderr=
stderr
,
html_test_result='')
html_test_result='')
if __name__ == "__main__":
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