summaryrefslogtreecommitdiff
path: root/deps/v8/test/wasm-spec-tests/testcfg.py
blob: d3b06d076b8af9338fb231265c6a4fbd9f57dd56 (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
# 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
from testrunner.objects import testcase

class WasmSpecTestsTestSuite(testsuite.TestSuite):
  def __init__(self, name, root):
    super(WasmSpecTestsTestSuite, self).__init__(name, root)

  def ListTests(self, context):
    tests = []
    for dirname, dirs, files in os.walk(self.root):
      for dotted in [x for x in dirs if x.startswith('.')]:
        dirs.remove(dotted)
      for filename in files:
        if (filename.endswith(".js")):
          fullpath = os.path.join(dirname, filename)
          relpath = fullpath[len(self.root) + 1 : -3]
          testname = relpath.replace(os.path.sep, "/")
          test = testcase.TestCase(self, testname)
          tests.append(test)
    return tests

  def GetFlagsForTestCase(self, testcase, context):
    flags = [] + context.mode_flags
    flags.append(os.path.join(self.root, testcase.path + self.suffix()))
    return testcase.flags + flags


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