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

Side by Side Diff: snapshot/win/end_to_end_test.py

Issue 1390913008: make cdb test using SYSTEMROOT case-insensitive (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright 2015 The Crashpad Authors. All rights reserved. 3 # Copyright 2015 The Crashpad Authors. All rights reserved.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 def __init__(self, cdb_path, dump_path, command): 121 def __init__(self, cdb_path, dump_path, command):
122 # Run a command line that loads the dump, runs the specified cdb command, 122 # Run a command line that loads the dump, runs the specified cdb command,
123 # and then quits, and capturing stdout. 123 # and then quits, and capturing stdout.
124 self.out = subprocess.check_output([ 124 self.out = subprocess.check_output([
125 cdb_path, 125 cdb_path,
126 '-z', dump_path, 126 '-z', dump_path,
127 '-c', command + ';q' 127 '-c', command + ';q'
128 ]) 128 ])
129 129
130 def Check(self, pattern, message): 130 def Check(self, pattern, message, re_flags=0):
131 match_obj = re.search(pattern, self.out) 131 match_obj = re.search(pattern, self.out, re_flags)
132 if match_obj: 132 if match_obj:
133 # Matched. Consume up to end of match. 133 # Matched. Consume up to end of match.
134 self.out = self.out[match_obj.end(0):] 134 self.out = self.out[match_obj.end(0):]
135 print 'ok - %s' % message 135 print 'ok - %s' % message
136 else: 136 else:
137 print >>sys.stderr, '-' * 80 137 print >>sys.stderr, '-' * 80
138 print >>sys.stderr, 'FAILED - %s' % message 138 print >>sys.stderr, 'FAILED - %s' % message
139 print >>sys.stderr, '-' * 80 139 print >>sys.stderr, '-' * 80
140 print >>sys.stderr, 'did not match:\n %s' % pattern 140 print >>sys.stderr, 'did not match:\n %s' % pattern
141 print >>sys.stderr, '-' * 80 141 print >>sys.stderr, '-' * 80
(...skipping 14 matching lines...) Expand all
156 'crashy_program!crashpad::`anonymous namespace\'::SomeCrashyFunction', 156 'crashy_program!crashpad::`anonymous namespace\'::SomeCrashyFunction',
157 'exception at correct location') 157 'exception at correct location')
158 158
159 out = CdbRun(cdb_path, dump_path, '!peb') 159 out = CdbRun(cdb_path, dump_path, '!peb')
160 out.Check(r'PEB at', 'found the PEB') 160 out.Check(r'PEB at', 'found the PEB')
161 out.Check(r'Ldr\.InMemoryOrderModuleList:.*\d+ \. \d+', 'PEB_LDR_DATA saved') 161 out.Check(r'Ldr\.InMemoryOrderModuleList:.*\d+ \. \d+', 'PEB_LDR_DATA saved')
162 out.Check(r'Base TimeStamp Module', 'module list present') 162 out.Check(r'Base TimeStamp Module', 'module list present')
163 pipe_name_escaped = pipe_name.replace('\\', '\\\\') 163 pipe_name_escaped = pipe_name.replace('\\', '\\\\')
164 out.Check(r'CommandLine: *\'.*crashy_program.exe *' + pipe_name_escaped, 164 out.Check(r'CommandLine: *\'.*crashy_program.exe *' + pipe_name_escaped,
165 'some PEB data is correct') 165 'some PEB data is correct')
166 out.Check(r'SystemRoot=C:\\Windows', 'some of environment captured') 166 out.Check(r'SystemRoot=C:\\Windows', 'some of environment captured',
Mark Mentovai 2015/10/09 23:40:51 Is this the right number of backslashes, too?
scottmg 2015/10/09 23:44:37 I believe so. The r'' takes care of not needing an
167 re.IGNORECASE)
167 168
168 out = CdbRun(cdb_path, dump_path, '!teb') 169 out = CdbRun(cdb_path, dump_path, '!teb')
169 out.Check(r'TEB at', 'found the TEB') 170 out.Check(r'TEB at', 'found the TEB')
170 out.Check(r'ExceptionList:\s+[0-9a-fA-F]+', 'some valid teb data') 171 out.Check(r'ExceptionList:\s+[0-9a-fA-F]+', 'some valid teb data')
171 out.Check(r'LastErrorValue:\s+2', 'correct LastErrorValue') 172 out.Check(r'LastErrorValue:\s+2', 'correct LastErrorValue')
172 173
173 out = CdbRun(cdb_path, dump_path, '!gle') 174 out = CdbRun(cdb_path, dump_path, '!gle')
174 out.Check('LastErrorValue: \(Win32\) 0x2 \(2\) - The system cannot find the ' 175 out.Check('LastErrorValue: \(Win32\) 0x2 \(2\) - The system cannot find the '
175 'file specified.', '!gle gets last error') 176 'file specified.', '!gle gets last error')
176 out.Check('LastStatusValue: \(NTSTATUS\) 0xc000000f - {File Not Found} The ' 177 out.Check('LastStatusValue: \(NTSTATUS\) 0xc000000f - {File Not Found} The '
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 211
211 RunTests(cdb_path, dump_path, pipe_name) 212 RunTests(cdb_path, dump_path, pipe_name)
212 213
213 return 0 214 return 0
214 finally: 215 finally:
215 CleanUpTempDirs() 216 CleanUpTempDirs()
216 217
217 218
218 if __name__ == '__main__': 219 if __name__ == '__main__':
219 sys.exit(main(sys.argv[1:])) 220 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698