Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 import itertools | 28 import itertools |
| 29 import os | 29 import os |
| 30 import re | 30 import re |
| 31 | |
|
Jakob Kummerow
2013/06/27 16:33:58
nit: I liked this line, please keep it.
| |
| 32 from testrunner.local import testsuite | 31 from testrunner.local import testsuite |
| 33 from testrunner.objects import testcase | 32 from testrunner.objects import testcase |
| 34 | 33 |
| 35 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") | 34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") |
| 36 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") | 35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") |
| 37 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") | 36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") |
| 38 | 37 |
| 39 | 38 |
| 40 # TODO (machenbach): Share commonalities with mjstest. | 39 # TODO (machenbach): Share commonalities with mjstest. |
| 41 class WebkitTestSuite(testsuite.TestSuite): | 40 class WebkitTestSuite(testsuite.TestSuite): |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 string.startswith("tools/nacl-run.py") or | 108 string.startswith("tools/nacl-run.py") or |
| 110 string.find("BYPASSING ALL ACL CHECKS") > 0 or | 109 string.find("BYPASSING ALL ACL CHECKS") > 0 or |
| 111 string.find("Native Client module will be loaded") > 0 or | 110 string.find("Native Client module will be loaded") > 0 or |
| 112 string.find("NaClHostDescOpen:") > 0) | 111 string.find("NaClHostDescOpen:") > 0) |
| 113 | 112 |
| 114 def IsFailureOutput(self, output, testpath): | 113 def IsFailureOutput(self, output, testpath): |
| 115 if super(WebkitTestSuite, self).IsFailureOutput(output, testpath): | 114 if super(WebkitTestSuite, self).IsFailureOutput(output, testpath): |
| 116 return True | 115 return True |
| 117 file_name = os.path.join(self.root, testpath) + "-expected.txt" | 116 file_name = os.path.join(self.root, testpath) + "-expected.txt" |
| 118 with file(file_name, "r") as expected: | 117 with file(file_name, "r") as expected: |
| 119 def ExpIterator(): | 118 expected_lines = expected.readlines() |
| 120 for line in expected.readlines(): | 119 |
| 121 if line.startswith("#") or not line.strip(): continue | 120 def ExpIterator(): |
| 122 yield line.strip() | 121 for line in expected_lines: |
| 123 def ActIterator(): | 122 if line.startswith("#") or not line.strip(): continue |
| 124 for line in output.stdout.splitlines(): | 123 yield line.strip() |
| 125 if self._IgnoreLine(line.strip()): continue | 124 |
| 126 yield line.strip() | 125 def ActIterator(lines): |
| 126 for line in lines: | |
| 127 if self._IgnoreLine(line.strip()): continue | |
| 128 yield line.strip() | |
| 129 | |
| 130 def ActBlockIterator(): | |
| 131 """Iterates over blocks of actual output lines.""" | |
| 132 lines = output.stdout.splitlines() | |
| 133 start_index = 0 | |
| 134 found_eqeq = False | |
| 135 for index, line in enumerate(lines): | |
| 136 # If a stress test separator is found: | |
| 137 if line.startswith("=="): | |
| 138 # Iterate over all lines before a separator except the first. | |
| 139 if not found_eqeq: | |
| 140 found_eqeq = True | |
| 141 else: | |
| 142 yield ActIterator(lines[start_index:index]) | |
| 143 # The next block of ouput lines starts after the separator. | |
| 144 start_index = index + 1 | |
| 145 # Iterate over complete output if no seperator was found. | |
|
Jakob Kummerow
2013/06/27 16:33:58
nit: separator
| |
| 146 if not found_eqeq: | |
| 147 yield ActIterator(lines) | |
| 148 | |
| 149 for act_iterator in ActBlockIterator(): | |
| 127 for (expected, actual) in itertools.izip_longest( | 150 for (expected, actual) in itertools.izip_longest( |
| 128 ExpIterator(), ActIterator(), fillvalue=''): | 151 ExpIterator(), act_iterator, fillvalue=''): |
| 129 if expected != actual: | 152 if expected != actual: |
| 130 return True | 153 return True |
| 131 return False | 154 return False |
| 132 | 155 |
| 133 | 156 |
| 134 def GetSuite(name, root): | 157 def GetSuite(name, root): |
| 135 return WebkitTestSuite(name, root) | 158 return WebkitTestSuite(name, root) |
| OLD | NEW |