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 17 matching lines...) Expand all Loading... |
28 import test | 28 import test |
29 import os | 29 import os |
30 from os.path import join, dirname, exists, basename, isdir | 30 from os.path import join, dirname, exists, basename, isdir |
31 import re | 31 import re |
32 | 32 |
33 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") | 33 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") |
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) | 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 self.mode = mode | |
43 | 42 |
44 def IgnoreLine(self, str): | 43 def IgnoreLine(self, str): |
45 """Ignore empty lines and valgrind output.""" | 44 """Ignore empty lines and valgrind output.""" |
46 if not str: return True | 45 if not str: return True |
47 else: return str.startswith('==') or str.startswith('**') | 46 else: return str.startswith('==') or str.startswith('**') |
48 | 47 |
49 def IsFailureOutput(self, output): | 48 def IsFailureOutput(self, output): |
50 f = file(self.expected) | 49 f = file(self.expected) |
51 # Skip initial '#' comment and spaces | 50 # Skip initial '#' comment and spaces |
52 for line in f: | 51 for line in f: |
(...skipping 19 matching lines...) Expand all Loading... |
72 return True | 71 return True |
73 return False | 72 return False |
74 | 73 |
75 def GetLabel(self): | 74 def GetLabel(self): |
76 return "%s %s" % (self.mode, self.GetName()) | 75 return "%s %s" % (self.mode, self.GetName()) |
77 | 76 |
78 def GetName(self): | 77 def GetName(self): |
79 return self.path[-1] | 78 return self.path[-1] |
80 | 79 |
81 def GetCommand(self): | 80 def GetCommand(self): |
82 result = [self.config.context.GetVm(self.mode)] | 81 result = self.config.context.GetVmCommand(self, self.mode) |
83 source = open(self.file).read() | 82 source = open(self.file).read() |
84 flags_match = FLAGS_PATTERN.search(source) | 83 flags_match = FLAGS_PATTERN.search(source) |
85 if flags_match: | 84 if flags_match: |
86 result += flags_match.group(1).strip().split() | 85 result += flags_match.group(1).strip().split() |
87 result.append(self.file) | 86 result.append(self.file) |
88 return result | 87 return result |
89 | 88 |
90 def GetSource(self): | 89 def GetSource(self): |
91 return (open(self.file).read() | 90 return (open(self.file).read() |
92 + "\n--- expected output ---\n" | 91 + "\n--- expected output ---\n" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return ['sample', 'sample=shell'] | 125 return ['sample', 'sample=shell'] |
127 | 126 |
128 def GetTestStatus(self, sections, defs): | 127 def GetTestStatus(self, sections, defs): |
129 status_file = join(self.root, 'message.status') | 128 status_file = join(self.root, 'message.status') |
130 if exists(status_file): | 129 if exists(status_file): |
131 test.ReadConfigurationInto(status_file, sections, defs) | 130 test.ReadConfigurationInto(status_file, sections, defs) |
132 | 131 |
133 | 132 |
134 def GetConfiguration(context, root): | 133 def GetConfiguration(context, root): |
135 return MessageTestConfiguration(context, root) | 134 return MessageTestConfiguration(context, root) |
OLD | NEW |