[test] Share output procs in mozilla and test262

Bug: v8:6917
Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I8783192268cc0860b553af418d56f1117817d747
Reviewed-on: https://chromium-review.googlesource.com/836609
Commit-Queue: Michał Majewski <majeski@google.com>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50241}
This commit is contained in:
Michal Majewski 2017-12-20 16:54:43 +01:00 committed by Commit Bot
parent 26e21fa67a
commit b43550b7ee
2 changed files with 32 additions and 12 deletions

View File

@ -106,13 +106,15 @@ class TestCase(testcase.TestCase):
def _get_source_path(self):
return os.path.join(self.suite.testroot, self.path + self._get_suffix())
def _output_proc_class(self):
return OutProc
def get_output_proc(self):
if self.path.endswith('-n'):
return OutProc.NEGATIVE
return OutProc.DEFAULT
class OutProc(outproc.OutProc):
def __init__(self, test):
self._negative = test.path.endswith('-n')
def __init__(self):
pass
def _is_failure_output(self, output):
return (
@ -120,8 +122,19 @@ class OutProc(outproc.OutProc):
'FAILED!' in output.stdout
)
class DefaultOutProc(OutProc):
def _is_negative(self):
return self._negative
return False
class NegativeOutProc(OutProc):
def _is_negative(self):
return True
OutProc.DEFAULT = DefaultOutProc()
OutProc.NEGATIVE = NegativeOutProc()
def GetSuite(name, root):

View File

@ -238,16 +238,20 @@ class TestCase(testcase.TestCase):
return path
return os.path.join(self.suite.testroot, filename)
def _output_proc_class(self):
return OutProc
def get_output_proc(self):
expected_exception = (
self.test_record
.get('negative', {})
.get('type', None)
)
if expected_exception is None:
return OutProc.NO_EXCEPTION
return OutProc(expected_exception)
class OutProc(outproc.OutProc):
def __init__(self, test):
self._expected_exception = (
test.test_record
.get('negative', {})
.get('type', None))
def __init__(self, expected_exception=None):
self._expected_exception = expected_exception
def _is_failure_output(self, output):
if output.exit_code != 0:
@ -271,5 +275,8 @@ class OutProc(outproc.OutProc):
return False
OutProc.NO_EXCEPTION = OutProc()
def GetSuite(name, root):
return TestSuite(name, root)