Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: test/debugger/testcfg.py

Issue 2425973002: [debugger] basic test infrastructure for new debugger test api. (Closed)
Patch Set: fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import os
6 import re
7
8 from testrunner.local import testsuite
9 from testrunner.objects import testcase
10
11 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
12
13 class DebuggerTestSuite(testsuite.TestSuite):
14
15 def __init__(self, name, root):
16 super(DebuggerTestSuite, self).__init__(name, root)
17
18 def ListTests(self, context):
19 tests = []
20 for dirname, dirs, files in os.walk(self.root):
21 for dotted in [x for x in dirs if x.startswith('.')]:
22 dirs.remove(dotted)
23 dirs.sort()
24 files.sort()
25 for filename in files:
26 if (filename.endswith(".js") and filename != "test-api.js"):
27 fullpath = os.path.join(dirname, filename)
28 relpath = fullpath[len(self.root) + 1 : -3]
29 testname = relpath.replace(os.path.sep, "/")
30 test = testcase.TestCase(self, testname)
31 tests.append(test)
32 return tests
33
34 def GetFlagsForTestCase(self, testcase, context):
35 source = self.GetSourceForTest(testcase)
36 flags = ["--enable-inspector"] + context.mode_flags
37 flags_match = re.findall(FLAGS_PATTERN, source)
38 for match in flags_match:
39 flags += match.strip().split()
40
41 files = []
42 files.append(os.path.normpath(os.path.join(self.root, "..", "mjsunit", "mjsu nit.js")))
43 files.append(os.path.join(self.root, "test-api.js"))
44 files.append(os.path.join(self.root, testcase.path + self.suffix()))
45
46 flags += files
47 if context.isolates:
48 flags.append("--isolate")
49 flags += files
50
51 return testcase.flags + flags
52
53 def GetSourceForTest(self, testcase):
54 filename = os.path.join(self.root, testcase.path + self.suffix())
55 with open(filename) as f:
56 return f.read()
57
58 def GetSuite(name, root):
59 return DebuggerTestSuite(name, root)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698