OLD | NEW |
1 # Copyright 2016 the V8 project authors. All rights reserved. | 1 # Copyright 2016 the V8 project authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 |
7 from testrunner.local import testsuite | 7 from testrunner.local import testsuite |
8 from testrunner.objects import testcase | 8 from testrunner.objects import testcase |
9 | 9 |
10 | 10 |
11 class FuzzerVariantGenerator(testsuite.VariantGenerator): | 11 class FuzzerVariantGenerator(testsuite.VariantGenerator): |
12 # Only run the fuzzer with standard variant. | 12 # Only run the fuzzer with standard variant. |
13 def FilterVariantsByTest(self, testcase): | 13 def FilterVariantsByTest(self, testcase): |
14 return self.standard_variant | 14 return self.standard_variant |
15 | 15 |
16 def GetFlagSets(self, testcase, variant): | 16 def GetFlagSets(self, testcase, variant): |
17 return testsuite.FAST_VARIANT_FLAGS[variant] | 17 return testsuite.FAST_VARIANT_FLAGS[variant] |
18 | 18 |
19 | 19 |
20 class FuzzerTestSuite(testsuite.TestSuite): | 20 class FuzzerTestSuite(testsuite.TestSuite): |
21 SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', 'wasm_code', | 21 SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', 'wasm_call', |
22 'wasm_data_section', 'wasm_function_sigs_section', | 22 'wasm_code', 'wasm_data_section', 'wasm_function_sigs_section', |
23 'wasm_globals_section', 'wasm_imports_section', 'wasm_memory_section', | 23 'wasm_globals_section', 'wasm_imports_section', 'wasm_memory_section', |
24 'wasm_names_section', 'wasm_types_section' ) | 24 'wasm_names_section', 'wasm_types_section' ) |
25 | 25 |
26 def __init__(self, name, root): | 26 def __init__(self, name, root): |
27 super(FuzzerTestSuite, self).__init__(name, root) | 27 super(FuzzerTestSuite, self).__init__(name, root) |
28 | 28 |
29 def ListTests(self, context): | 29 def ListTests(self, context): |
30 tests = [] | 30 tests = [] |
31 for subtest in FuzzerTestSuite.SUB_TESTS: | 31 for subtest in FuzzerTestSuite.SUB_TESTS: |
32 shell = 'v8_simple_%s_fuzzer' % subtest | 32 shell = 'v8_simple_%s_fuzzer' % subtest |
33 for fname in os.listdir(os.path.join(self.root, subtest)): | 33 for fname in os.listdir(os.path.join(self.root, subtest)): |
34 if not os.path.isfile(os.path.join(self.root, subtest, fname)): | 34 if not os.path.isfile(os.path.join(self.root, subtest, fname)): |
35 continue | 35 continue |
36 test = testcase.TestCase(self, '%s/%s' % (subtest, fname), | 36 test = testcase.TestCase(self, '%s/%s' % (subtest, fname), |
37 override_shell=shell) | 37 override_shell=shell) |
38 tests.append(test) | 38 tests.append(test) |
39 tests.sort() | 39 tests.sort() |
40 return tests | 40 return tests |
41 | 41 |
42 def GetFlagsForTestCase(self, testcase, context): | 42 def GetFlagsForTestCase(self, testcase, context): |
43 suite, name = testcase.path.split('/') | 43 suite, name = testcase.path.split('/') |
44 return [os.path.join(self.root, suite, name)] | 44 return [os.path.join(self.root, suite, name)] |
45 | 45 |
46 def _VariantGeneratorFactory(self): | 46 def _VariantGeneratorFactory(self): |
47 return FuzzerVariantGenerator | 47 return FuzzerVariantGenerator |
48 | 48 |
49 | 49 |
50 def GetSuite(name, root): | 50 def GetSuite(name, root): |
51 return FuzzerTestSuite(name, root) | 51 return FuzzerTestSuite(name, root) |
OLD | NEW |