OLD | NEW |
1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 string.startswith("tools/nacl-run.py") or | 109 string.startswith("tools/nacl-run.py") or |
110 string.find("BYPASSING ALL ACL CHECKS") > 0 or | 110 string.find("BYPASSING ALL ACL CHECKS") > 0 or |
111 string.find("Native Client module will be loaded") > 0 or | 111 string.find("Native Client module will be loaded") > 0 or |
112 string.find("NaClHostDescOpen:") > 0) | 112 string.find("NaClHostDescOpen:") > 0) |
113 | 113 |
114 def IsFailureOutput(self, output, testpath): | 114 def IsFailureOutput(self, output, testpath): |
115 if super(WebkitTestSuite, self).IsFailureOutput(output, testpath): | 115 if super(WebkitTestSuite, self).IsFailureOutput(output, testpath): |
116 return True | 116 return True |
117 file_name = os.path.join(self.root, testpath) + "-expected.txt" | 117 file_name = os.path.join(self.root, testpath) + "-expected.txt" |
118 with file(file_name, "r") as expected: | 118 with file(file_name, "r") as expected: |
119 def ExpIterator(): | 119 expected_lines = expected.readlines() |
120 for line in expected.readlines(): | 120 |
121 if line.startswith("#") or not line.strip(): continue | 121 def ExpIterator(): |
122 yield line.strip() | 122 for line in expected_lines: |
123 def ActIterator(): | 123 if line.startswith("#") or not line.strip(): continue |
124 for line in output.stdout.splitlines(): | 124 yield line.strip() |
125 if self._IgnoreLine(line.strip()): continue | 125 |
126 yield line.strip() | 126 def ActIterator(lines): |
| 127 for line in lines: |
| 128 if self._IgnoreLine(line.strip()): continue |
| 129 yield line.strip() |
| 130 |
| 131 def ActBlockIterator(): |
| 132 """Iterates over blocks of actual output lines.""" |
| 133 lines = output.stdout.splitlines() |
| 134 start_index = 0 |
| 135 found_eqeq = False |
| 136 for index, line in enumerate(lines): |
| 137 # If a stress test separator is found: |
| 138 if line.startswith("=="): |
| 139 # Iterate over all lines before a separator except the first. |
| 140 if not found_eqeq: |
| 141 found_eqeq = True |
| 142 else: |
| 143 yield ActIterator(lines[start_index:index]) |
| 144 # The next block of ouput lines starts after the separator. |
| 145 start_index = index + 1 |
| 146 # Iterate over complete output if no separator was found. |
| 147 if not found_eqeq: |
| 148 yield ActIterator(lines) |
| 149 |
| 150 for act_iterator in ActBlockIterator(): |
127 for (expected, actual) in itertools.izip_longest( | 151 for (expected, actual) in itertools.izip_longest( |
128 ExpIterator(), ActIterator(), fillvalue=''): | 152 ExpIterator(), act_iterator, fillvalue=''): |
129 if expected != actual: | 153 if expected != actual: |
130 return True | 154 return True |
131 return False | 155 return False |
132 | 156 |
133 | 157 |
134 def GetSuite(name, root): | 158 def GetSuite(name, root): |
135 return WebkitTestSuite(name, root) | 159 return WebkitTestSuite(name, root) |
OLD | NEW |