| 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 itertools | 5 import itertools |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 from testrunner.local import testsuite | 9 from testrunner.local import testsuite |
| 10 from testrunner.local import utils | 10 from testrunner.local import utils |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 if filename.endswith(".js") and filename != PROTOCOL_TEST_JS: | 33 if filename.endswith(".js") and filename != PROTOCOL_TEST_JS: |
| 34 fullpath = os.path.join(dirname, filename) | 34 fullpath = os.path.join(dirname, filename) |
| 35 relpath = fullpath[len(self.root) + 1 : -3] | 35 relpath = fullpath[len(self.root) + 1 : -3] |
| 36 testname = relpath.replace(os.path.sep, "/") | 36 testname = relpath.replace(os.path.sep, "/") |
| 37 test = testcase.TestCase(self, testname) | 37 test = testcase.TestCase(self, testname) |
| 38 tests.append(test) | 38 tests.append(test) |
| 39 return tests | 39 return tests |
| 40 | 40 |
| 41 def GetFlagsForTestCase(self, testcase, context): | 41 def GetFlagsForTestCase(self, testcase, context): |
| 42 source = self.GetSourceForTest(testcase) | 42 source = self.GetSourceForTest(testcase) |
| 43 flags = [] + context.mode_flags |
| 43 flags_match = re.findall(FLAGS_PATTERN, source) | 44 flags_match = re.findall(FLAGS_PATTERN, source) |
| 44 flags = [] | |
| 45 for match in flags_match: | 45 for match in flags_match: |
| 46 flags += match.strip().split() | 46 flags += match.strip().split() |
| 47 testname = testcase.path.split(os.path.sep)[-1] | 47 testname = testcase.path.split(os.path.sep)[-1] |
| 48 testfilename = os.path.join(self.root, testcase.path + self.suffix()) | 48 testfilename = os.path.join(self.root, testcase.path + self.suffix()) |
| 49 protocoltestfilename = os.path.join(self.root, PROTOCOL_TEST_JS) | 49 protocoltestfilename = os.path.join(self.root, PROTOCOL_TEST_JS) |
| 50 return [ protocoltestfilename, testfilename ] + flags | 50 return testcase.flags + flags + [ protocoltestfilename, testfilename ] |
| 51 | 51 |
| 52 def GetSourceForTest(self, testcase): | 52 def GetSourceForTest(self, testcase): |
| 53 filename = os.path.join(self.root, testcase.path + self.suffix()) | 53 filename = os.path.join(self.root, testcase.path + self.suffix()) |
| 54 with open(filename) as f: | 54 with open(filename) as f: |
| 55 return f.read() | 55 return f.read() |
| 56 | 56 |
| 57 def shell(self): | 57 def shell(self): |
| 58 return "inspector-test" | 58 return "inspector-test" |
| 59 | 59 |
| 60 def _IgnoreLine(self, string): | 60 def _IgnoreLine(self, string): |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 for act_iterator in ActBlockIterator(): | 104 for act_iterator in ActBlockIterator(): |
| 105 for (expected, actual) in itertools.izip_longest( | 105 for (expected, actual) in itertools.izip_longest( |
| 106 ExpIterator(), act_iterator, fillvalue=''): | 106 ExpIterator(), act_iterator, fillvalue=''): |
| 107 if expected != actual: | 107 if expected != actual: |
| 108 return True | 108 return True |
| 109 return False | 109 return False |
| 110 | 110 |
| 111 def GetSuite(name, root): | 111 def GetSuite(name, root): |
| 112 return InspectorProtocolTestSuite(name, root) | 112 return InspectorProtocolTestSuite(name, root) |
| OLD | NEW |