testcfg.py 1.82 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': 'simd',
                    'flags': ['--experimental-wasm-simd',
                              '--wasm-staging']
                  },
25 26 27 28 29
                  {
                    'name': 'memory64',
                    'flags': ['--experimental-wasm-memory64',
                              '--wasm-staging']
                  },
30
                  ]
31 32 33 34

class TestLoader(testsuite.JSTestLoader):
  pass

35
class TestSuite(testsuite.TestSuite):
36 37 38 39 40
  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

41 42
  def _test_loader_class(self):
    return TestLoader
43

44
  def _test_class(self):
45
    return TestCase
46

47
class TestCase(testcase.D8TestCase):
48
  def _get_files_params(self):
49
    return [os.path.join(self.suite.test_root, self.path + self._get_suffix())]
50

51 52 53 54
  def _get_source_flags(self):
    for proposal in proposal_flags:
      if os.sep.join(['proposals', proposal['name']]) in self.path:
        return proposal['flags']
55
    return ['--experimental-wasm-reftypes']
56

57

58 59
def GetSuite(*args, **kwargs):
  return TestSuite(*args, **kwargs)