Commit 01c670e4 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[message] Have message testcfg extend ExpectedOutProc

This will make --regenerate_expected_files flag work for message tests.

Bug: v8:10773
Change-Id: Ica87bd69bd0a41e2a3c168d2200d0cd0c7f094da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2842387
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74127}
parent 9fb6983e
......@@ -49,6 +49,8 @@ class TestCase(testcase.D8TestCase):
def __init__(self, *args, **kwargs):
super(TestCase, self).__init__(*args, **kwargs)
# get_source() relies on this being set.
self._base_path = os.path.join(self.suite.root, self.path)
source = self.get_source()
self._source_files = self._parse_source_files(source)
self._source_flags = self._parse_source_flags(source)
......@@ -78,13 +80,12 @@ class TestCase(testcase.D8TestCase):
return self._source_flags
def _get_source_path(self):
base_path = os.path.join(self.suite.root, self.path)
# Try .js first, and fall back to .mjs.
# TODO(v8:9406): clean this up by never separating the path from
# the extension in the first place.
if os.path.exists(base_path + self._get_suffix()):
return base_path + self._get_suffix()
return base_path + '.mjs'
if os.path.exists(self._base_path + self._get_suffix()):
return self._base_path + self._get_suffix()
return self._base_path + '.mjs'
def skip_predictable(self):
# Message tests expected to fail don't print allocation output for
......@@ -94,8 +95,10 @@ class TestCase(testcase.D8TestCase):
@property
def output_proc(self):
return message.OutProc(self.expected_outcomes,
os.path.join(self.suite.root, self.path),
self._expected_fail())
self._base_path,
self._expected_fail(),
self._base_path + '.out',
self.suite.test_config.regenerate_expected_files)
def GetSuite(*args, **kwargs):
......
......@@ -9,9 +9,11 @@ import re
from . import base
class OutProc(base.OutProc):
def __init__(self, expected_outcomes, basepath, expected_fail):
super(OutProc, self).__init__(expected_outcomes)
class OutProc(base.ExpectedOutProc):
def __init__(self, expected_outcomes, basepath, expected_fail,
expected_filename, regenerate_expected_files):
super(OutProc, self).__init__(expected_outcomes, expected_filename,
regenerate_expected_files)
self._basepath = basepath
self._expected_fail = expected_fail
......
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