Commit a0aa60de authored by Ivan Tyagov's avatar Ivan Tyagov

Use by default SQLite.

Do not yet run ZODB tests.
Clean up previous runs.
parent fb66da0b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
""" """
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 import argparse, sys, subprocess, os, glob
import traceback import traceback
from erp5.util import taskdistribution from erp5.util import taskdistribution
import re import re
...@@ -15,9 +15,22 @@ SUMMARY_RE = re.compile( \ ...@@ -15,9 +15,22 @@ SUMMARY_RE = re.compile( \
# NEO specific environment # NEO specific environment
TEMP_DIRECTORY = '{{neo_temp_directory}}/neotest_tmp' TEMP_DIRECTORY = '{{neo_temp_directory}}/neotest_tmp'
MYSQL_UNIX_PORT = '{{my_cnf_parameters.socket}}' MYSQL_UNIX_PORT = '{{my_cnf_parameters.socket}}'
NEO_TESTS_ADAPTER = 'MySQL' # XXX: we can have SQLite as well! 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.
...@@ -82,14 +95,19 @@ def main(): ...@@ -82,14 +95,19 @@ def main():
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 not None:
# clean up previous runs
cleanup()
# run NEO tests # run NEO tests
test_result_line = test_result.start() test_result_line = test_result.start()
command = "%s -ufz" %RUN_NEO_TESTS_COMMAND # XXX: add '-z' - i.e. ZODB tests when find out why it stalled execution.
args = [RUN_NEO_TESTS_COMMAND, '-ufz'] args = [RUN_NEO_TESTS_COMMAND, '-ufv']
command = ' '.join(args)
stdin = file(os.devnull) stdin = file(os.devnull)
env = {'TEMP': TEMP_DIRECTORY, env = {'TEMP': TEMP_DIRECTORY,
'MYSQL_UNIX_PORT': MYSQL_UNIX_PORT,
'NEO_TESTS_ADAPTER': NEO_TESTS_ADAPTER} 'NEO_TESTS_ADAPTER': NEO_TESTS_ADAPTER}
if NEO_TESTS_ADAPTER == 'MySQL':
env['MYSQL_UNIX_PORT'] = MYSQL_UNIX_PORT
try: try:
p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=env) stderr=subprocess.PIPE, env=env)
...@@ -103,9 +121,10 @@ def main(): ...@@ -103,9 +121,10 @@ 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!
data = p.stdout.read() stdout = p.stdout.read()
test_count, error_count, expected_count, skip_count, duration = parseTestStdOut(data) test_count, error_count, expected_count, skip_count, duration = parseTestStdOut(stdout)
print test_result_line print test_result_line
print stdout
# report status back to Nexedi ERP5 # report status back to Nexedi ERP5
test_result_line.stop( test_result_line.stop(
...@@ -116,7 +135,7 @@ def main(): ...@@ -116,7 +135,7 @@ def main():
duration = duration, duration = duration,
date = None, # XXX: date when test run or when finished ? date = None, # XXX: date when test run or when finished ?
command = command, command = command,
stdout= data, stdout= stdout,
stderr='stderr', # XXX:catch it stderr='stderr', # XXX:catch it
html_test_result='') html_test_result='')
......
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