Skip to content
forked from v8/v8

Commit

Permalink
[foozzie] Bail out on timeouts during validity checks
Browse files Browse the repository at this point in the history
If we pass flags that make runs very slow, also the validity checks
might time out. Previously this wasn't checked and output was just
cut off.

This also tightens the timeout on validity checks as they are
expected to run very fast.

No-Try: true
Bug: chromium:1098646
Change-Id: Iea9a932be86e84040b72a2311aaa1d44100b3378
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2262915
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68510}
  • Loading branch information
mi-ac authored and Commit Bot committed Jun 24, 2020
1 parent 6015e3a commit dd58472
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
7 changes: 2 additions & 5 deletions tools/clusterfuzz/v8_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
ARCH_MOCKS = os.path.join(BASE_PATH, 'v8_mock_archs.js')
WEBASSEMBLY_MOCKS = os.path.join(BASE_PATH, 'v8_mock_webassembly.js')

# Timeout in seconds for one d8 run.
TIMEOUT = 3


def _startup_files(options):
"""Default files and optional config-specific mock files."""
Expand Down Expand Up @@ -70,7 +67,7 @@ def __init__(self, options, label, executable, config_flags):

self.files = _startup_files(options)

def run(self, testcase, verbose=False):
def run(self, testcase, timeout, verbose=False):
"""Run the executable with a specific testcase."""
args = [self.executable] + self.flags + self.files + [testcase]
if verbose:
Expand All @@ -82,7 +79,7 @@ def run(self, testcase, verbose=False):
return Execute(
args,
cwd=os.path.dirname(os.path.abspath(testcase)),
timeout=TIMEOUT,
timeout=timeout,
)

@property
Expand Down
26 changes: 22 additions & 4 deletions tools/clusterfuzz/v8_foozzie.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
SANITY_CHECKS = os.path.join(BASE_PATH, 'v8_sanity_checks.js')

# Timeout for one d8 run.
SANITY_CHECK_TIMEOUT_SEC = 1
TEST_TIMEOUT_SEC = 3

SUPPORTED_ARCHS = ['ia32', 'x64', 'arm', 'arm64']

# Output for suppressed failure case.
Expand Down Expand Up @@ -387,8 +391,20 @@ def main():
# Sanity checks. Run both configurations with the sanity-checks file only and
# bail out early if different.
if not options.skip_sanity_checks:
first_config_output = first_cmd.run(SANITY_CHECKS)
second_config_output = second_cmd.run(SANITY_CHECKS)
first_config_output = first_cmd.run(
SANITY_CHECKS, timeout=SANITY_CHECK_TIMEOUT_SEC)

# Early bailout if first run was a timeout.
if timeout_bailout(first_config_output, 1):
return RETURN_PASS

second_config_output = second_cmd.run(
SANITY_CHECKS, timeout=SANITY_CHECK_TIMEOUT_SEC)

# Bailout if second run was a timeout.
if timeout_bailout(second_config_output, 2):
return RETURN_PASS

difference, _ = suppress.diff(first_config_output, second_config_output)
if difference:
# Special source key for sanity checks so that clusterfuzz dedupes all
Expand All @@ -399,13 +415,15 @@ def main():
first_config_output, second_config_output, difference)
return RETURN_FAIL

first_config_output = first_cmd.run(options.testcase, verbose=True)
first_config_output = first_cmd.run(
options.testcase, timeout=TEST_TIMEOUT_SEC, verbose=True)

# Early bailout if first run was a timeout.
if timeout_bailout(first_config_output, 1):
return RETURN_PASS

second_config_output = second_cmd.run(options.testcase, verbose=True)
second_config_output = second_cmd.run(
options.testcase, timeout=TEST_TIMEOUT_SEC, verbose=True)

# Bailout if second run was a timeout.
if timeout_bailout(second_config_output, 2):
Expand Down

0 comments on commit dd58472

Please sign in to comment.