testcfg.py 1.55 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

  def __init__(self, ctx, *args, **kwargs):
    super(TestSuite, self).__init__(ctx, *args, **kwargs)
34 35 36
    self.test_root = os.path.join(self.root, "tests")
    self._test_loader.test_root = self.test_root

37 38
  def _test_loader_class(self):
    return TestLoader
39

40
  def _test_class(self):
41
    return TestCase
42

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

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