testcfg.py 1.88 KB
Newer Older
1 2 3 4 5 6 7 8
# 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.local import utils
9
from testrunner.objects import testcase
10
from testrunner.outproc import base as outproc
11 12

PROTOCOL_TEST_JS = "protocol-test.js"
13
WASM_INSPECTOR_JS = "wasm-inspector-test.js"
14
EXPECTED_SUFFIX = "-expected.txt"
15
RESOURCES_FOLDER = "resources"
16

17 18 19
class TestLoader(testsuite.JSTestLoader):
  @property
  def excluded_files(self):
20
    return {PROTOCOL_TEST_JS, WASM_INSPECTOR_JS}
21 22 23 24 25 26

  @property
  def excluded_dirs(self):
    return {RESOURCES_FOLDER}


27
class TestSuite(testsuite.TestSuite):
28 29
  def _test_loader_class(self):
    return TestLoader
30

31
  def _test_class(self):
32
    return TestCase
33

34

35
class TestCase(testcase.TestCase):
36
  def __init__(self, *args, **kwargs):
37
    super(TestCase, self).__init__(*args, **kwargs)
38 39 40

    self._source_flags = self._parse_source_flags()

41
  def _get_files_params(self):
42 43 44 45 46 47 48 49 50 51 52
    return [
      os.path.join(self.suite.root, PROTOCOL_TEST_JS),
      os.path.join(self.suite.root, self.path + self._get_suffix()),
    ]

  def _get_source_flags(self):
    return self._source_flags

  def _get_source_path(self):
    return os.path.join(self.suite.root, self.path + self._get_suffix())

53
  def get_shell(self):
54 55
    return 'inspector-test'

56 57 58 59
  def _get_resources(self):
    return [
      os.path.join(
        'test', 'inspector', 'debugger', 'resources', 'break-locations.js'),
60 61
      os.path.join(
        'test', 'inspector', 'wasm-inspector-test.js'),
62 63
    ]

64 65
  @property
  def output_proc(self):
66 67
    return outproc.ExpectedOutProc(
        self.expected_outcomes,
68 69
        os.path.join(self.suite.root, self.path) + EXPECTED_SUFFIX,
        self.suite.test_config.regenerate_expected_files)
70

71

72 73
def GetSuite(*args, **kwargs):
  return TestSuite(*args, **kwargs)