2016-01-26 10:38:37 +00:00
|
|
|
# Copyright 2016 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.
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
from testrunner.local import testsuite
|
|
|
|
from testrunner.objects import testcase
|
|
|
|
|
|
|
|
|
2016-02-02 09:21:15 +00:00
|
|
|
class FuzzerVariantGenerator(testsuite.VariantGenerator):
|
|
|
|
# Only run the fuzzer with standard variant.
|
|
|
|
def FilterVariantsByTest(self, testcase):
|
|
|
|
return self.standard_variant
|
|
|
|
|
|
|
|
def GetFlagSets(self, testcase, variant):
|
|
|
|
return testsuite.FAST_VARIANT_FLAGS[variant]
|
|
|
|
|
|
|
|
|
2016-01-26 10:38:37 +00:00
|
|
|
class FuzzerTestSuite(testsuite.TestSuite):
|
2016-10-24 11:14:35 +00:00
|
|
|
SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', 'wasm_call',
|
|
|
|
'wasm_code', 'wasm_data_section', 'wasm_function_sigs_section',
|
[wasm] Write fuzzers for single wasm sections.
This CL adds fuzzers for the wasm module sections 'types', 'names',
'globals', 'imports', 'function signatures', 'memory', and 'data', one
fuzzer per section. No fuzzers are added for the other sections because
either there already exists a fuzzer (e.g. wasm-code), or there exist
inter-section dependencies.
To avoid introducing a bunch executables which would make compilation
with make slow, I introduce a single executable
'v8_simple_wasm_section_fuzzer' which calls the fuzzers mentioned above.
This executable is run by the trybots and ensures that the fuzzers
actually compile. For debugging I introduce commandline parameters which
allow to execute the specific fuzzers from 'v8_simple_wasm_section_fuzzer'.
R=titzer@chromium.org, jochen@chromium.org, mstarzinger@chromium.org
Review-Url: https://codereview.chromium.org/2336603002
Cr-Commit-Position: refs/heads/master@{#39413}
2016-09-14 11:17:11 +00:00
|
|
|
'wasm_globals_section', 'wasm_imports_section', 'wasm_memory_section',
|
|
|
|
'wasm_names_section', 'wasm_types_section' )
|
2016-01-26 10:38:37 +00:00
|
|
|
|
|
|
|
def __init__(self, name, root):
|
|
|
|
super(FuzzerTestSuite, self).__init__(name, root)
|
|
|
|
|
|
|
|
def ListTests(self, context):
|
|
|
|
tests = []
|
|
|
|
for subtest in FuzzerTestSuite.SUB_TESTS:
|
2016-06-03 13:09:52 +00:00
|
|
|
shell = 'v8_simple_%s_fuzzer' % subtest
|
2016-01-26 10:38:37 +00:00
|
|
|
for fname in os.listdir(os.path.join(self.root, subtest)):
|
|
|
|
if not os.path.isfile(os.path.join(self.root, subtest, fname)):
|
|
|
|
continue
|
|
|
|
test = testcase.TestCase(self, '%s/%s' % (subtest, fname),
|
|
|
|
override_shell=shell)
|
|
|
|
tests.append(test)
|
|
|
|
tests.sort()
|
|
|
|
return tests
|
|
|
|
|
|
|
|
def GetFlagsForTestCase(self, testcase, context):
|
|
|
|
suite, name = testcase.path.split('/')
|
|
|
|
return [os.path.join(self.root, suite, name)]
|
|
|
|
|
2016-02-02 09:21:15 +00:00
|
|
|
def _VariantGeneratorFactory(self):
|
|
|
|
return FuzzerVariantGenerator
|
|
|
|
|
2016-01-26 10:38:37 +00:00
|
|
|
|
|
|
|
def GetSuite(name, root):
|
|
|
|
return FuzzerTestSuite(name, root)
|