| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 string == "Warning: unknown flag --enable-slow-asserts." or | 64 string == "Warning: unknown flag --enable-slow-asserts." or |
| 65 string == "Try --help for options") | 65 string == "Try --help for options") |
| 66 | 66 |
| 67 def IsFailureOutput(self, testcase): | 67 def IsFailureOutput(self, testcase): |
| 68 file_name = os.path.join(self.root, testcase.path) + EXPECTED_SUFFIX | 68 file_name = os.path.join(self.root, testcase.path) + EXPECTED_SUFFIX |
| 69 with file(file_name, "r") as expected: | 69 with file(file_name, "r") as expected: |
| 70 expected_lines = expected.readlines() | 70 expected_lines = expected.readlines() |
| 71 | 71 |
| 72 def ExpIterator(): | 72 def ExpIterator(): |
| 73 for line in expected_lines: | 73 for line in expected_lines: |
| 74 if line.startswith("#") or not line.strip(): continue | 74 if not line.strip(): continue |
| 75 yield line.strip() | 75 yield line.strip() |
| 76 | 76 |
| 77 def ActIterator(lines): | 77 def ActIterator(lines): |
| 78 for line in lines: | 78 for line in lines: |
| 79 if self._IgnoreLine(line.strip()): continue | 79 if self._IgnoreLine(line.strip()): continue |
| 80 yield line.strip() | 80 yield line.strip() |
| 81 | 81 |
| 82 def ActBlockIterator(): | 82 def ActBlockIterator(): |
| 83 """Iterates over blocks of actual output lines.""" | 83 """Iterates over blocks of actual output lines.""" |
| 84 lines = testcase.output.stdout.splitlines() | 84 lines = testcase.output.stdout.splitlines() |
| (...skipping 15 matching lines...) Expand all Loading... |
| 100 | 100 |
| 101 for act_iterator in ActBlockIterator(): | 101 for act_iterator in ActBlockIterator(): |
| 102 for (expected, actual) in itertools.izip_longest( | 102 for (expected, actual) in itertools.izip_longest( |
| 103 ExpIterator(), act_iterator, fillvalue=''): | 103 ExpIterator(), act_iterator, fillvalue=''): |
| 104 if expected != actual: | 104 if expected != actual: |
| 105 return True | 105 return True |
| 106 return False | 106 return False |
| 107 | 107 |
| 108 def GetSuite(name, root): | 108 def GetSuite(name, root): |
| 109 return InspectorProtocolTestSuite(name, root) | 109 return InspectorProtocolTestSuite(name, root) |
| OLD | NEW |