testcfg.py 1.61 KB
Newer Older
1 2 3 4 5 6 7
# Copyright 2017 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
8
from testrunner.objects import testcase
9

10
proposal_flags = [{
11 12
                    'name': 'js-types',
                    'flags': ['--experimental-wasm-type-reflection',
13 14 15 16 17 18
                              '--wasm-staging']
                  },
                  {
                    'name': 'tail-call',
                    'flags': ['--experimental-wasm-return-call',
                              '--wasm-staging']
19
                  },
20
                  {
21 22 23 24
                    'name': 'memory64',
                    'flags': ['--experimental-wasm-memory64',
                              '--wasm-staging']
                  },
25
                  ]
26 27 28 29

class TestLoader(testsuite.JSTestLoader):
  pass

30
class TestSuite(testsuite.TestSuite):
31 32 33 34 35
  def __init__(self, *args, **kwargs):
    super(TestSuite, self).__init__(*args, **kwargs)
    self.test_root = os.path.join(self.root, "tests")
    self._test_loader.test_root = self.test_root

36 37
  def _test_loader_class(self):
    return TestLoader
38

39
  def _test_class(self):
40
    return TestCase
41

42
class TestCase(testcase.D8TestCase):
43
  def _get_files_params(self):
44
    return [os.path.join(self.suite.test_root, self.path + self._get_suffix())]
45

46 47 48 49
  def _get_source_flags(self):
    for proposal in proposal_flags:
      if os.sep.join(['proposals', proposal['name']]) in self.path:
        return proposal['flags']
50
    return []
51

52

53 54
def GetSuite(*args, **kwargs):
  return TestSuite(*args, **kwargs)