blob: 85a38eda087bbf8e9c5db824084a7a7a67b62868 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001# 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
3# found in the LICENSE file.
4
5import os
6
7from testrunner.local import testsuite
8from testrunner.objects import testcase
9
10
11class FuzzerVariantGenerator(testsuite.VariantGenerator):
12 # Only run the fuzzer with standard variant.
13 def FilterVariantsByTest(self, testcase):
14 return self.standard_variant
15
16 def GetFlagSets(self, testcase, variant):
17 return testsuite.FAST_VARIANT_FLAGS[variant]
18
19
20class FuzzerTestSuite(testsuite.TestSuite):
Ben Murdochda12d292016-06-02 14:46:10 +010021 SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', )
Ben Murdoch097c5b22016-05-18 11:27:45 +010022
23 def __init__(self, name, root):
24 super(FuzzerTestSuite, self).__init__(name, root)
25
26 def ListTests(self, context):
27 tests = []
28 for subtest in FuzzerTestSuite.SUB_TESTS:
Ben Murdoch61f157c2016-09-16 13:49:30 +010029 shell = 'v8_simple_%s_fuzzer' % subtest
Ben Murdoch097c5b22016-05-18 11:27:45 +010030 for fname in os.listdir(os.path.join(self.root, subtest)):
31 if not os.path.isfile(os.path.join(self.root, subtest, fname)):
32 continue
33 test = testcase.TestCase(self, '%s/%s' % (subtest, fname),
34 override_shell=shell)
35 tests.append(test)
36 tests.sort()
37 return tests
38
39 def GetFlagsForTestCase(self, testcase, context):
40 suite, name = testcase.path.split('/')
41 return [os.path.join(self.root, suite, name)]
42
43 def _VariantGeneratorFactory(self):
44 return FuzzerVariantGenerator
45
46
47def GetSuite(name, root):
48 return FuzzerTestSuite(name, root)