Commit 9fbb56f5 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[foozzie] Mock out WebAssembly when comparing with jitless

No-Try: true
Bug: chromium:1048620
Change-Id: I399144a9d8075efe40125dfcbe1dbbd0aabe0fe9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2036080Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66112}
parent 8fbcaf11
......@@ -13,6 +13,7 @@ if (v8_correctness_fuzzer) {
"v8_fuzz_config.py",
"v8_mock.js",
"v8_mock_archs.js",
"v8_mock_webassembly.js",
"v8_sanity_checks.js",
"v8_suppressions.js",
"v8_suppressions.py",
......
......@@ -33,18 +33,22 @@ DEFAULT_FILES = [
os.path.join(BASE_PATH, 'v8_suppressions.js'),
]
# Architecture-specific mock file
# Config-specific mock files.
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 architecture-specific mock file."""
"""Default files and optional config-specific mock files."""
files = DEFAULT_FILES[:]
if options.first.arch != options.second.arch:
files.append(ARCH_MOCKS)
# Mock out WebAssembly when comparing with jitless mode.
if '--jitless' in options.first.flags + options.second.flags:
files.append(WEBASSEMBLY_MOCKS)
return files
......
......@@ -156,14 +156,17 @@ def cut_verbose_output(stdout):
return '\n'.join(stdout.split('\n')[4:])
def run_foozzie(second_d8_dir, *extra_flags):
def run_foozzie(second_d8_dir, *extra_flags, **kwargs):
second_config = 'ignition_turbo'
if 'second_config' in kwargs:
second_config = 'jitless'
return subprocess.check_output([
sys.executable, FOOZZIE,
'--random-seed', '12345',
'--first-d8', os.path.join(TEST_DATA, 'baseline', 'd8.py'),
'--second-d8', os.path.join(TEST_DATA, second_d8_dir, 'd8.py'),
'--first-config', 'ignition',
'--second-config', 'ignition_turbo',
'--second-config', second_config,
os.path.join(TEST_DATA, 'fuzz-123.js'),
] + list(extra_flags))
......@@ -183,6 +186,9 @@ class SystemTest(unittest.TestCase):
def testSyntaxErrorDiffPass(self):
stdout = run_foozzie('build1', '--skip-sanity-checks')
self.assertEquals('# V8 correctness - pass\n', cut_verbose_output(stdout))
# Default comparison doesn't include any specific mock files.
self.assertNotIn('v8_mock_archs.js', stdout)
self.assertNotIn('v8_mock_webassembly.js', stdout)
def testDifferentOutputFail(self):
with open(os.path.join(TEST_DATA, 'failure_output.txt')) as f:
......@@ -217,6 +223,16 @@ class SystemTest(unittest.TestCase):
self.assertIn('v8_mock_archs.js', lines[1])
self.assertIn('v8_mock_archs.js', lines[3])
def testJitless(self):
"""Test that webassembly is mocked out when comparing with jitless."""
stdout = run_foozzie(
'build1', '--skip-sanity-checks', second_config='jitless')
lines = stdout.split('\n')
# TODO(machenbach): Don't depend on the command-lines being printed in
# particular lines.
self.assertIn('v8_mock_webassembly.js', lines[1])
self.assertIn('v8_mock_webassembly.js', lines[3])
if __name__ == '__main__':
unittest.main()
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This mocks out the WebAssembly object with a permissive dummy.
(function () {
const handler = {
get: function(x, prop) {
if (prop == Symbol.toPrimitive) {
return function() { return undefined; };
}
return dummy;
},
};
const dummy = new Proxy(function () { return dummy; }, handler);
WebAssembly = dummy;
})();
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