Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: test/message/testcfg.py

Issue 53089: Fixed test memory leaks (Closed)
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/flags.cc ('K') | « test/cctest/test-strings.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
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)
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 42 self.mode = mode
43 43
Søren Thygesen Gjesse 2009/03/26 10:50:09 Please add a comment on why these lines are ignore
Christian Plesner Hansen 2009/03/27 00:24:26 Done
44 def IgnoreLine(self, str):
45 if not str: return True
46 else: return str.startswith('==') or str.startswith('**')
47
44 def IsFailureOutput(self, output): 48 def IsFailureOutput(self, output):
45 f = file(self.expected) 49 f = file(self.expected)
46 # Skip initial '#' comment and spaces 50 # Skip initial '#' comment and spaces
47 for line in f: 51 for line in f:
48 if (not line.startswith('#')) and (not line.strip()): 52 if (not line.startswith('#')) and (not line.strip()):
49 break 53 break
50 # Convert output lines to regexps that we can match 54 # Convert output lines to regexps that we can match
51 env = { 'basename': basename(self.file) } 55 env = { 'basename': basename(self.file) }
52 patterns = [ ] 56 patterns = [ ]
53 for line in f: 57 for line in f:
54 if not line.strip(): 58 if not line.strip():
55 continue 59 continue
56 pattern = re.escape(line.rstrip() % env) 60 pattern = re.escape(line.rstrip() % env)
57 pattern = pattern.replace('\\*', '.*') 61 pattern = pattern.replace('\\*', '.*')
58 pattern = '^%s$' % pattern 62 pattern = '^%s$' % pattern
59 patterns.append(pattern) 63 patterns.append(pattern)
60 # Compare actual output with the expected 64 # Compare actual output with the expected
61 outlines = [ s for s in output.stdout.split('\n') if s ] 65 raw_lines = output.stdout.split('\n')
66 outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ]
62 if len(outlines) != len(patterns): 67 if len(outlines) != len(patterns):
63 return True 68 return True
64 for i in xrange(len(patterns)): 69 for i in xrange(len(patterns)):
65 if not re.match(patterns[i], outlines[i]): 70 if not re.match(patterns[i], outlines[i]):
66 return True 71 return True
67 return False 72 return False
68 73
69 def GetLabel(self): 74 def GetLabel(self):
70 return "%s %s" % (self.mode, self.GetName()) 75 return "%s %s" % (self.mode, self.GetName())
71 76
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return ['sample', 'sample=shell'] 125 return ['sample', 'sample=shell']
121 126
122 def GetTestStatus(self, sections, defs): 127 def GetTestStatus(self, sections, defs):
123 status_file = join(self.root, 'message.status') 128 status_file = join(self.root, 'message.status')
124 if exists(status_file): 129 if exists(status_file):
125 test.ReadConfigurationInto(status_file, sections, defs) 130 test.ReadConfigurationInto(status_file, sections, defs)
126 131
127 132
128 def GetConfiguration(context, root): 133 def GetConfiguration(context, root):
129 return MessageTestConfiguration(context, root) 134 return MessageTestConfiguration(context, root)
OLDNEW
« src/flags.cc ('K') | « test/cctest/test-strings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698