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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 # Can't use utils.ReadLinesFrom() here because it strips whitespace. | 88 # Can't use utils.ReadLinesFrom() here because it strips whitespace. |
89 with open(expected_path) as f: | 89 with open(expected_path) as f: |
90 for line in f: | 90 for line in f: |
91 if line.startswith("#") or not line.strip(): continue | 91 if line.startswith("#") or not line.strip(): continue |
92 expected_lines.append(line) | 92 expected_lines.append(line) |
93 raw_lines = output.stdout.splitlines() | 93 raw_lines = output.stdout.splitlines() |
94 actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ] | 94 actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ] |
95 env = { "basename": os.path.basename(testpath + ".js") } | 95 env = { "basename": os.path.basename(testpath + ".js") } |
96 if len(expected_lines) != len(actual_lines): | 96 if len(expected_lines) != len(actual_lines): |
97 return True | 97 return True |
98 for (expected, actual) in itertools.izip(expected_lines, actual_lines): | 98 for (expected, actual) in itertools.izip_longest( |
| 99 expected_lines, actual_lines, fillvalue=''): |
99 pattern = re.escape(expected.rstrip() % env) | 100 pattern = re.escape(expected.rstrip() % env) |
100 pattern = pattern.replace("\\*", ".*") | 101 pattern = pattern.replace("\\*", ".*") |
101 pattern = "^%s$" % pattern | 102 pattern = "^%s$" % pattern |
102 if not re.match(pattern, actual): | 103 if not re.match(pattern, actual): |
103 return True | 104 return True |
104 return False | 105 return False |
105 | 106 |
106 def StripOutputForTransmit(self, testcase): | 107 def StripOutputForTransmit(self, testcase): |
107 pass | 108 pass |
108 | 109 |
109 | 110 |
110 def GetSuite(name, root): | 111 def GetSuite(name, root): |
111 return MessageTestSuite(name, root) | 112 return MessageTestSuite(name, root) |
OLD | NEW |