summaryrefslogtreecommitdiff
path: root/test/crossrunner
diff options
context:
space:
mode:
authorNobuaki Sukegawa <nsuke@apache.org>2016-01-19 11:10:07 +0900
committerNobuaki Sukegawa <nsuke@apache.org>2016-01-24 00:13:44 +0900
commitbd165305fa398afb47ac46b924414f6c9afb9b1f (patch)
tree09d127469c7d86f4b63f0066603c1f694922418a /test/crossrunner
parent3d600bfec3938bcee0008592e25cb1489bc782fa (diff)
downloadthrift-bd165305fa398afb47ac46b924414f6c9afb9b1f.tar.gz
THRIFT-3571 Make feature test result browsable
Client: Test Patch: Nobuaki Sukegawa This closes #809
Diffstat (limited to 'test/crossrunner')
-rw-r--r--test/crossrunner/report.py23
-rw-r--r--test/crossrunner/run.py6
2 files changed, 17 insertions, 12 deletions
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index ad989691b..a84e89121 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -33,7 +33,7 @@ from .compat import logfile_open, path_join, str_join
from .test import TestEntry
LOG_DIR = 'log'
-RESULT_HTML = 'result.html'
+RESULT_HTML = 'index.html'
RESULT_JSON = 'results.json'
FAIL_JSON = 'known_failures_%s.json'
@@ -209,11 +209,12 @@ class ExecReporter(TestReporter):
class SummaryReporter(TestReporter):
- def __init__(self, testdir, concurrent=True):
+ def __init__(self, basedir, testdir_relative, concurrent=True):
super(SummaryReporter, self).__init__()
- self.testdir = testdir
- self.logdir = path_join(testdir, LOG_DIR)
- self.out_path = path_join(testdir, RESULT_JSON)
+ self._basedir = basedir
+ self._testdir_rel = testdir_relative
+ self.logdir = path_join(self.testdir, LOG_DIR)
+ self.out_path = path_join(self.testdir, RESULT_JSON)
self.concurrent = concurrent
self.out = sys.stdout
self._platform = platform.system()
@@ -221,12 +222,16 @@ class SummaryReporter(TestReporter):
self._tests = []
if not os.path.exists(self.logdir):
os.mkdir(self.logdir)
- self._known_failures = load_known_failures(testdir)
+ self._known_failures = load_known_failures(self.testdir)
self._unexpected_success = []
self._unexpected_failure = []
self._expected_failure = []
self._print_header()
+ @property
+ def testdir(self):
+ return path_join(self._basedir, self._testdir_rel)
+
def _get_revision(self):
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
cwd=self.testdir, stdout=subprocess.PIPE)
@@ -296,11 +301,11 @@ class SummaryReporter(TestReporter):
self._assemble_log('known failures', self._expected_failure)
self.out.writelines([
'You can browse results at:\n',
- '\tfile://%s/%s\n' % (self.testdir, RESULT_HTML),
+ '\tfile://%s/%s\n' % (self._basedir, RESULT_HTML),
'# If you use Chrome, run:\n',
- '# \tcd %s\n#\t%s\n' % (self.testdir, self._http_server_command(8001)),
+ '# \tcd %s\n#\t%s\n' % (self._basedir, self._http_server_command(8001)),
'# then browse:\n',
- '# \thttp://localhost:%d/test/%s\n' % (8001, RESULT_HTML),
+ '# \thttp://localhost:%d/%s/\n' % (8001, self._testdir_rel),
'Full log for each test is here:\n',
'\ttest/log/client_server_protocol_transport_client.log\n',
'\ttest/log/client_server_protocol_transport_server.log\n',
diff --git a/test/crossrunner/run.py b/test/crossrunner/run.py
index 32d166ebd..0d617c0e3 100644
--- a/test/crossrunner/run.py
+++ b/test/crossrunner/run.py
@@ -269,10 +269,11 @@ class NonAsyncResult(object):
class TestDispatcher(object):
- def __init__(self, testdir, logdir, concurrency):
+ def __init__(self, testdir, basedir, logdir_rel, concurrency):
self._log = multiprocessing.get_logger()
self.testdir = testdir
- self.logdir = logdir
+ self._report = SummaryReporter(basedir, logdir_rel, concurrency > 1)
+ self.logdir = self._report.testdir
# seems needed for python 2.x to handle keyboard interrupt
self._stop = multiprocessing.Event()
self._async = concurrency > 1
@@ -287,7 +288,6 @@ class TestDispatcher(object):
self._m.register('ports', PortAllocator)
self._m.start()
self._pool = multiprocessing.Pool(concurrency, self._pool_init, (self._m.address,))
- self._report = SummaryReporter(logdir, concurrency > 1)
self._log.debug(
'TestDispatcher started with %d concurrent jobs' % concurrency)