Commit 47c56e99 authored by Julien Muchembled's avatar Julien Muchembled

NEO: allow runTestSuite to be standalone

Shamefully copied from neoppod/stress-testing SR.
parent c870cea9
...@@ -46,4 +46,4 @@ md5sum = 5afd326de385563b5aeac81039f23341 ...@@ -46,4 +46,4 @@ md5sum = 5afd326de385563b5aeac81039f23341
[runTestSuite.in] [runTestSuite.in]
_update_hash_filename_ = runTestSuite.in _update_hash_filename_ = runTestSuite.in
md5sum = b656e805c5dbc7f9c73716398b3e032e md5sum = 6f60a4804dc3749d0fd2997ca4a33cc9
...@@ -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, os, re, shutil, subprocess, sys, traceback import argparse, json, os, re, shutil, subprocess, sys, traceback
from erp5.util import taskdistribution from erp5.util import taskdistribution
from time import gmtime, sleep, strftime, time from time import gmtime, sleep, strftime, time
...@@ -52,6 +52,28 @@ def parseTestStdOut(data): ...@@ -52,6 +52,28 @@ def parseTestStdOut(data):
return test_count, unexpected_count, expected_count, skip_count, duration return test_count, unexpected_count, expected_count, skip_count, duration
class DummyTestResult:
class DummyTestResultLine:
def stop(self, **kw):
with open(self.name + '.json', 'w') as f:
json.dump(kw, f)
done = 0
def __init__(self, test_name_list):
self.test_name_list = test_name_list
def start(self):
test_result_line = self.DummyTestResultLine()
try:
test_result_line.name = self.test_name_list[self.done]
except IndexError:
return
self.done += 1
return test_result_line
def main(): def main():
parser = argparse.ArgumentParser(description='Run a test suite.') parser = argparse.ArgumentParser(description='Run a test suite.')
parser.add_argument('--test_suite', help='The test suite name') parser.add_argument('--test_suite', help='The test suite name')
...@@ -67,18 +89,20 @@ def main(): ...@@ -67,18 +89,20 @@ def main():
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
test_name_list = 'SQLite', 'MySQL' test_name_list = 'SQLite', 'MySQL'
tool = taskdistribution.TaskDistributor(portal_url = args.master_url) if args.master_url:
test_result = tool.createTestResult(revision = revision, tool = taskdistribution.TaskDistributor(portal_url = args.master_url)
test_name_list = test_name_list, test_result = tool.createTestResult(args.revision,
node_title = args.test_node_title, test_name_list,
test_title = test_suite_title, args.test_node_title,
project_title = args.project_title) test_title=test_suite_title,
if test_result is None: project_title=args.project_title)
return if test_result is None:
return
else:
test_result = DummyTestResult(test_name_list)
# run NEO tests # run NEO tests
while 1: while 1:
test_result_line = test_result.start() test_result_line = test_result.start()
......
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