OLD | NEW |
1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if not string.strip(): return True | 87 if not string.strip(): return True |
88 return (string.startswith("==") or string.startswith("**") or | 88 return (string.startswith("==") or string.startswith("**") or |
89 string.startswith("ANDROID") or | 89 string.startswith("ANDROID") or |
90 # These five patterns appear in normal Native Client output. | 90 # These five patterns appear in normal Native Client output. |
91 string.startswith("DEBUG MODE ENABLED") or | 91 string.startswith("DEBUG MODE ENABLED") or |
92 string.startswith("tools/nacl-run.py") or | 92 string.startswith("tools/nacl-run.py") or |
93 string.find("BYPASSING ALL ACL CHECKS") > 0 or | 93 string.find("BYPASSING ALL ACL CHECKS") > 0 or |
94 string.find("Native Client module will be loaded") > 0 or | 94 string.find("Native Client module will be loaded") > 0 or |
95 string.find("NaClHostDescOpen:") > 0) | 95 string.find("NaClHostDescOpen:") > 0) |
96 | 96 |
97 def IsFailureOutput(self, output, testpath): | 97 def IsFailureOutput(self, testcase): |
| 98 output = testcase.output |
| 99 testpath = testcase.path |
98 expected_path = os.path.join(self.root, testpath + ".out") | 100 expected_path = os.path.join(self.root, testpath + ".out") |
99 expected_lines = [] | 101 expected_lines = [] |
100 # Can't use utils.ReadLinesFrom() here because it strips whitespace. | 102 # Can't use utils.ReadLinesFrom() here because it strips whitespace. |
101 with open(expected_path) as f: | 103 with open(expected_path) as f: |
102 for line in f: | 104 for line in f: |
103 if line.startswith("#") or not line.strip(): continue | 105 if line.startswith("#") or not line.strip(): continue |
104 expected_lines.append(line) | 106 expected_lines.append(line) |
105 raw_lines = output.stdout.splitlines() | 107 raw_lines = output.stdout.splitlines() |
106 actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ] | 108 actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ] |
107 env = { "basename": os.path.basename(testpath + ".js") } | 109 env = { "basename": os.path.basename(testpath + ".js") } |
108 if len(expected_lines) != len(actual_lines): | 110 if len(expected_lines) != len(actual_lines): |
109 return True | 111 return True |
110 for (expected, actual) in itertools.izip_longest( | 112 for (expected, actual) in itertools.izip_longest( |
111 expected_lines, actual_lines, fillvalue=''): | 113 expected_lines, actual_lines, fillvalue=''): |
112 pattern = re.escape(expected.rstrip() % env) | 114 pattern = re.escape(expected.rstrip() % env) |
113 pattern = pattern.replace("\\*", ".*") | 115 pattern = pattern.replace("\\*", ".*") |
114 pattern = "^%s$" % pattern | 116 pattern = "^%s$" % pattern |
115 if not re.match(pattern, actual): | 117 if not re.match(pattern, actual): |
116 return True | 118 return True |
117 return False | 119 return False |
118 | 120 |
119 def StripOutputForTransmit(self, testcase): | 121 def StripOutputForTransmit(self, testcase): |
120 pass | 122 pass |
121 | 123 |
122 | 124 |
123 def GetSuite(name, root): | 125 def GetSuite(name, root): |
124 return MessageTestSuite(name, root) | 126 return MessageTestSuite(name, root) |
OLD | NEW |