summaryrefslogtreecommitdiff
path: root/deps/v8/test/fuzzer/testcfg.py
blob: 0e07fb574e2876985770376e10462f94532056b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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


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]


class FuzzerTestSuite(testsuite.TestSuite):
  SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', 'wasm_call',
          'wasm_code', 'wasm_compile', 'wasm_data_section',
          'wasm_function_sigs_section', 'wasm_globals_section',
          'wasm_imports_section', 'wasm_memory_section', 'wasm_names_section',
          'wasm_types_section' )

  def __init__(self, name, root):
    super(FuzzerTestSuite, self).__init__(name, root)

  def ListTests(self, context):
    tests = []
    for subtest in FuzzerTestSuite.SUB_TESTS:
      shell = 'v8_simple_%s_fuzzer' % subtest
      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)]

  def _VariantGeneratorFactory(self):
    return FuzzerVariantGenerator


def GetSuite(name, root):
  return FuzzerTestSuite(name, root)