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 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 class MessageTestCase(test.TestCase): | 35 class MessageTestCase(test.TestCase): |
36 | 36 |
37 def __init__(self, path, file, expected, mode, context, config): | 37 def __init__(self, path, file, expected, mode, context, config): |
38 super(MessageTestCase, self).__init__(context, path, mode) | 38 super(MessageTestCase, self).__init__(context, path, mode) |
39 self.file = file | 39 self.file = file |
40 self.expected = expected | 40 self.expected = expected |
41 self.config = config | 41 self.config = config |
42 | 42 |
43 def IgnoreLine(self, str): | 43 def IgnoreLine(self, str): |
44 """Ignore empty lines and valgrind output.""" | 44 """Ignore empty lines, valgrind output and Android output.""" |
45 if not str: return True | 45 if not str: return True |
46 else: return str.startswith('==') or str.startswith('**') | 46 else: return str.startswith('==') or str.startswith('**') or str.startswith( 'Error') |
Jakob Kummerow
2012/07/18 11:52:15
nit: long line
| |
47 | 47 |
48 def IsFailureOutput(self, output): | 48 def IsFailureOutput(self, output): |
49 f = file(self.expected) | 49 f = file(self.expected) |
50 # Skip initial '#' comment and spaces | 50 # Skip initial '#' comment and spaces |
51 for line in f: | 51 for line in f: |
52 if (not line.startswith('#')) and (not line.strip()): | 52 if (not line.startswith('#')) and (not line.strip()): |
53 break | 53 break |
54 # Convert output lines to regexps that we can match | 54 # Convert output lines to regexps that we can match |
55 env = { 'basename': basename(self.file) } | 55 env = { 'basename': basename(self.file) } |
56 patterns = [ ] | 56 patterns = [ ] |
57 for line in f: | 57 for line in f: |
58 if not line.strip(): | 58 if not line.strip(): |
59 continue | 59 continue |
60 pattern = re.escape(line.rstrip() % env) | 60 pattern = re.escape(line.rstrip() % env) |
61 pattern = pattern.replace('\\*', '.*') | 61 pattern = pattern.replace('\\*', '.*') |
62 pattern = '^%s$' % pattern | 62 pattern = '^%s$' % pattern |
63 patterns.append(pattern) | 63 patterns.append(pattern) |
64 # Compare actual output with the expected | 64 # Compare actual output with the expected |
65 raw_lines = output.stdout.split('\n') | 65 raw_lines = output.stdout.splitlines() |
66 outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ] | 66 outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ] |
67 if len(outlines) != len(patterns): | 67 if len(outlines) != len(patterns): |
68 return True | 68 return True |
69 for i in xrange(len(patterns)): | 69 for i in xrange(len(patterns)): |
70 if not re.match(patterns[i], outlines[i]): | 70 if not re.match(patterns[i], outlines[i]): |
71 return True | 71 return True |
72 return False | 72 return False |
73 | 73 |
74 def GetLabel(self): | 74 def GetLabel(self): |
75 return "%s %s" % (self.mode, self.GetName()) | 75 return "%s %s" % (self.mode, self.GetName()) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 return ['d8'] | 128 return ['d8'] |
129 | 129 |
130 def GetTestStatus(self, sections, defs): | 130 def GetTestStatus(self, sections, defs): |
131 status_file = join(self.root, 'message.status') | 131 status_file = join(self.root, 'message.status') |
132 if exists(status_file): | 132 if exists(status_file): |
133 test.ReadConfigurationInto(status_file, sections, defs) | 133 test.ReadConfigurationInto(status_file, sections, defs) |
134 | 134 |
135 | 135 |
136 def GetConfiguration(context, root): | 136 def GetConfiguration(context, root): |
137 return MessageTestConfiguration(context, root) | 137 return MessageTestConfiguration(context, root) |
OLD | NEW |