OLD | NEW |
1 # Copyright 2016 the V8 project authors. All rights reserved. | 1 # Copyright 2016 the V8 project authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 | 7 |
8 from testrunner.local import testsuite | 8 from testrunner.local import testsuite |
9 from testrunner.objects import testcase | 9 from testrunner.objects import testcase |
10 | 10 |
11 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") | 11 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") |
12 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") | 12 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") |
| 13 MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) |
13 | 14 |
14 class DebuggerTestSuite(testsuite.TestSuite): | 15 class DebuggerTestSuite(testsuite.TestSuite): |
15 | 16 |
16 def __init__(self, name, root): | 17 def __init__(self, name, root): |
17 super(DebuggerTestSuite, self).__init__(name, root) | 18 super(DebuggerTestSuite, self).__init__(name, root) |
18 | 19 |
19 def ListTests(self, context): | 20 def ListTests(self, context): |
20 tests = [] | 21 tests = [] |
21 for dirname, dirs, files in os.walk(self.root): | 22 for dirname, dirs, files in os.walk(self.root): |
22 for dotted in [x for x in dirs if x.startswith('.')]: | 23 for dotted in [x for x in dirs if x.startswith('.')]: |
(...skipping 24 matching lines...) Expand all Loading... |
47 files_list += files_match.group(1).strip().split() | 48 files_list += files_match.group(1).strip().split() |
48 files_match = FILES_PATTERN.search(source, files_match.end()) | 49 files_match = FILES_PATTERN.search(source, files_match.end()) |
49 else: | 50 else: |
50 break | 51 break |
51 | 52 |
52 files = [] | 53 files = [] |
53 files.append(os.path.normpath(os.path.join(self.root, "..", "mjsunit", "mjsu
nit.js"))) | 54 files.append(os.path.normpath(os.path.join(self.root, "..", "mjsunit", "mjsu
nit.js"))) |
54 files.append(os.path.join(self.root, "test-api.js")) | 55 files.append(os.path.join(self.root, "test-api.js")) |
55 files.extend([ os.path.normpath(os.path.join(self.root, '..', '..', f)) | 56 files.extend([ os.path.normpath(os.path.join(self.root, '..', '..', f)) |
56 for f in files_list ]) | 57 for f in files_list ]) |
| 58 if MODULE_PATTERN.search(source): |
| 59 files.append("--module") |
57 files.append(os.path.join(self.root, testcase.path + self.suffix())) | 60 files.append(os.path.join(self.root, testcase.path + self.suffix())) |
58 | 61 |
59 flags += files | 62 flags += files |
60 if context.isolates: | 63 if context.isolates: |
61 flags.append("--isolate") | 64 flags.append("--isolate") |
62 flags += files | 65 flags += files |
63 | 66 |
64 return testcase.flags + flags | 67 return testcase.flags + flags |
65 | 68 |
66 def GetSourceForTest(self, testcase): | 69 def GetSourceForTest(self, testcase): |
67 filename = os.path.join(self.root, testcase.path + self.suffix()) | 70 filename = os.path.join(self.root, testcase.path + self.suffix()) |
68 with open(filename) as f: | 71 with open(filename) as f: |
69 return f.read() | 72 return f.read() |
70 | 73 |
71 def GetSuite(name, root): | 74 def GetSuite(name, root): |
72 return DebuggerTestSuite(name, root) | 75 return DebuggerTestSuite(name, root) |
OLD | NEW |