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

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

Issue 2836623002: [inspector] always include user scripts in the snapshot. (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « test/inspector/task-runner.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 itertools 5 import itertools
6 import os 6 import os
7 import re 7 import re
8 import shlex
8 9
9 from testrunner.local import testsuite 10 from testrunner.local import testsuite
10 from testrunner.local import utils 11 from testrunner.local import utils
11 from testrunner.objects import testcase 12 from testrunner.objects import testcase
12 13
13 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") 14 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
14 PROTOCOL_TEST_JS = "protocol-test.js" 15 PROTOCOL_TEST_JS = "protocol-test.js"
15 EXPECTED_SUFFIX = "-expected.txt" 16 EXPECTED_SUFFIX = "-expected.txt"
16 RESOURCES_FOLDER = "resources" 17 RESOURCES_FOLDER = "resources"
17 18
(...skipping 18 matching lines...) Expand all
36 testname = relpath.replace(os.path.sep, "/") 37 testname = relpath.replace(os.path.sep, "/")
37 test = testcase.TestCase(self, testname) 38 test = testcase.TestCase(self, testname)
38 tests.append(test) 39 tests.append(test)
39 return tests 40 return tests
40 41
41 def GetFlagsForTestCase(self, testcase, context): 42 def GetFlagsForTestCase(self, testcase, context):
42 source = self.GetSourceForTest(testcase) 43 source = self.GetSourceForTest(testcase)
43 flags = [] + context.mode_flags 44 flags = [] + context.mode_flags
44 flags_match = re.findall(FLAGS_PATTERN, source) 45 flags_match = re.findall(FLAGS_PATTERN, source)
45 for match in flags_match: 46 for match in flags_match:
46 flags += match.strip().split() 47 flags += shlex.split(match.strip())
47 testname = testcase.path.split(os.path.sep)[-1] 48 testname = testcase.path.split(os.path.sep)[-1]
48 testfilename = os.path.join(self.root, testcase.path + self.suffix()) 49 testfilename = os.path.join(self.root, testcase.path + self.suffix())
49 protocoltestfilename = os.path.join(self.root, PROTOCOL_TEST_JS) 50 protocoltestfilename = os.path.join(self.root, PROTOCOL_TEST_JS)
50 return testcase.flags + flags + [ protocoltestfilename, testfilename ] 51 return testcase.flags + flags + [ protocoltestfilename, testfilename ]
51 52
52 def GetSourceForTest(self, testcase): 53 def GetSourceForTest(self, testcase):
53 filename = os.path.join(self.root, testcase.path + self.suffix()) 54 filename = os.path.join(self.root, testcase.path + self.suffix())
54 with open(filename) as f: 55 with open(filename) as f:
55 return f.read() 56 return f.read()
56 57
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 104
104 for act_iterator in ActBlockIterator(): 105 for act_iterator in ActBlockIterator():
105 for (expected, actual) in itertools.izip_longest( 106 for (expected, actual) in itertools.izip_longest(
106 ExpIterator(), act_iterator, fillvalue=''): 107 ExpIterator(), act_iterator, fillvalue=''):
107 if expected != actual: 108 if expected != actual:
108 return True 109 return True
109 return False 110 return False
110 111
111 def GetSuite(name, root): 112 def GetSuite(name, root):
112 return InspectorProtocolTestSuite(name, root) 113 return InspectorProtocolTestSuite(name, root)
OLDNEW
« no previous file with comments | « test/inspector/task-runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698