| 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 |
| 11 from testrunner.objects import testcase | 11 from testrunner.objects import testcase |
| 12 | 12 |
| 13 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") | 13 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") |
| 14 PROTOCOL_TEST_JS = "protocol-test.js" | 14 PROTOCOL_TEST_JS = "protocol-test.js" |
| 15 EXPECTED_SUFFIX = "-expected.txt" | 15 EXPECTED_SUFFIX = "-expected.txt" |
| 16 RESOURCES_FOLDER = "resources" |
| 16 | 17 |
| 17 class InspectorProtocolTestSuite(testsuite.TestSuite): | 18 class InspectorProtocolTestSuite(testsuite.TestSuite): |
| 18 | 19 |
| 19 def __init__(self, name, root): | 20 def __init__(self, name, root): |
| 20 super(InspectorProtocolTestSuite, self).__init__(name, root) | 21 super(InspectorProtocolTestSuite, self).__init__(name, root) |
| 21 | 22 |
| 22 def ListTests(self, context): | 23 def ListTests(self, context): |
| 23 tests = [] | 24 tests = [] |
| 24 for dirname, dirs, files in os.walk(os.path.join(self.root), followlinks=Tru
e): | 25 for dirname, dirs, files in os.walk(os.path.join(self.root), followlinks=Tru
e): |
| 25 for dotted in [x for x in dirs if x.startswith('.')]: | 26 for dotted in [x for x in dirs if x.startswith('.')]: |
| 26 dirs.remove(dotted) | 27 dirs.remove(dotted) |
| 28 if dirname.endswith(os.path.sep + RESOURCES_FOLDER): |
| 29 continue |
| 27 dirs.sort() | 30 dirs.sort() |
| 28 files.sort() | 31 files.sort() |
| 29 for filename in files: | 32 for filename in files: |
| 30 if filename.endswith(".js") and filename != PROTOCOL_TEST_JS: | 33 if filename.endswith(".js") and filename != PROTOCOL_TEST_JS: |
| 31 fullpath = os.path.join(dirname, filename) | 34 fullpath = os.path.join(dirname, filename) |
| 32 relpath = fullpath[len(self.root) + 1 : -3] | 35 relpath = fullpath[len(self.root) + 1 : -3] |
| 33 testname = relpath.replace(os.path.sep, "/") | 36 testname = relpath.replace(os.path.sep, "/") |
| 34 test = testcase.TestCase(self, testname) | 37 test = testcase.TestCase(self, testname) |
| 35 tests.append(test) | 38 tests.append(test) |
| 36 return tests | 39 return tests |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 103 |
| 101 for act_iterator in ActBlockIterator(): | 104 for act_iterator in ActBlockIterator(): |
| 102 for (expected, actual) in itertools.izip_longest( | 105 for (expected, actual) in itertools.izip_longest( |
| 103 ExpIterator(), act_iterator, fillvalue=''): | 106 ExpIterator(), act_iterator, fillvalue=''): |
| 104 if expected != actual: | 107 if expected != actual: |
| 105 return True | 108 return True |
| 106 return False | 109 return False |
| 107 | 110 |
| 108 def GetSuite(name, root): | 111 def GetSuite(name, root): |
| 109 return InspectorProtocolTestSuite(name, root) | 112 return InspectorProtocolTestSuite(name, root) |
| OLD | NEW |