Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 | 176 |
| 177 out = CdbRun(cdb_path, dump_path, '!gle') | 177 out = CdbRun(cdb_path, dump_path, '!gle') |
| 178 out.Check('LastErrorValue: \(Win32\) 0x2 \(2\) - The system cannot find the ' | 178 out.Check('LastErrorValue: \(Win32\) 0x2 \(2\) - The system cannot find the ' |
| 179 'file specified.', '!gle gets last error') | 179 'file specified.', '!gle gets last error') |
| 180 out.Check('LastStatusValue: \(NTSTATUS\) 0xc000000f - {File Not Found} The ' | 180 out.Check('LastStatusValue: \(NTSTATUS\) 0xc000000f - {File Not Found} The ' |
| 181 'file %hs does not exist.', '!gle gets last ntstatus') | 181 'file %hs does not exist.', '!gle gets last ntstatus') |
| 182 | 182 |
| 183 out = CdbRun(cdb_path, dump_path, '!locks') | 183 out = CdbRun(cdb_path, dump_path, '!locks') |
| 184 out.Check(r'CritSec crashy_program!crashpad::`anonymous namespace\'::' | 184 out.Check(r'CritSec crashy_program!crashpad::`anonymous namespace\'::' |
| 185 r'g_test_critical_section', 'lock was captured') | 185 r'g_test_critical_section', 'lock was captured') |
| 186 if float(platform.win32_ver()[0]) != 7: | 186 if platform.win32_ver()[0] != '7': |
| 187 # We can't allocate CRITICAL_SECTIONs with .DebugInfo on Win 7. | 187 # We can't allocate CRITICAL_SECTIONs with .DebugInfo on Win 7. |
| 188 out.Check(r'\*\*\* Locked', 'lock debug info was captured, and is locked') | 188 out.Check(r'\*\*\* Locked', 'lock debug info was captured, and is locked') |
| 189 | 189 |
| 190 out = CdbRun(cdb_path, dump_path, '!handle') | |
| 191 out.Check(r'\d+ Handles', 'captured handles') | |
| 192 out.Check(r'Event\s+\d+', 'capture some event handles') | |
| 193 out.Check(r'File\s+\d+', 'capture some file handles') | |
| 190 | 194 |
| 191 def main(args): | 195 def main(args): |
| 192 try: | 196 try: |
| 193 if len(args) != 1: | 197 if len(args) != 1: |
| 194 print >>sys.stderr, 'must supply binary dir' | 198 print >>sys.stderr, 'must supply binary dir' |
| 195 return 1 | 199 return 1 |
| 196 | 200 |
| 197 cdb_path = GetCdbPath() | 201 cdb_path = GetCdbPath() |
| 198 if not cdb_path: | 202 if not cdb_path: |
| 199 print >>sys.stderr, 'could not find cdb' | 203 print >>sys.stderr, 'could not find cdb' |
| 200 return 1 | 204 return 1 |
| 201 | 205 |
| 202 # Make sure we can download Windows symbols. | 206 # Make sure we can download Windows symbols. |
| 203 if not os.environ.get('_NT_SYMBOL_PATH'): | 207 if not os.environ.get('_NT_SYMBOL_PATH'): |
| 204 symbol_dir = MakeTempDir() | 208 symbol_dir = MakeTempDir() |
| 209 protocol = 'https' if platform.win32_ver()[0] != 'XP' else 'http' | |
|
Mark Mentovai
2015/10/21 00:04:21
Oh no, poor XP!
scottmg
2015/10/21 00:14:15
Yeah, took me a while to realize what was going on
| |
| 205 os.environ['_NT_SYMBOL_PATH'] = ( | 210 os.environ['_NT_SYMBOL_PATH'] = ( |
| 206 'SRV*' + symbol_dir + '*https://msdl.microsoft.com/download/symbols') | 211 'SRV*' + symbol_dir + '*' + |
| 212 protocol + '://msdl.microsoft.com/download/symbols') | |
| 207 | 213 |
| 208 pipe_name = r'\\.\pipe\end-to-end_%s_%s' % ( | 214 pipe_name = r'\\.\pipe\end-to-end_%s_%s' % ( |
| 209 os.getpid(), str(random.getrandbits(64))) | 215 os.getpid(), str(random.getrandbits(64))) |
| 210 | 216 |
| 211 dump_path = GetDumpFromCrashyProgram(args[0], pipe_name) | 217 dump_path = GetDumpFromCrashyProgram(args[0], pipe_name) |
| 212 if not dump_path: | 218 if not dump_path: |
| 213 return 1 | 219 return 1 |
| 214 | 220 |
| 215 RunTests(cdb_path, dump_path, pipe_name) | 221 RunTests(cdb_path, dump_path, pipe_name) |
| 216 | 222 |
| 217 return 0 | 223 return 0 |
| 218 finally: | 224 finally: |
| 219 CleanUpTempDirs() | 225 CleanUpTempDirs() |
| 220 | 226 |
| 221 | 227 |
| 222 if __name__ == '__main__': | 228 if __name__ == '__main__': |
| 223 sys.exit(main(sys.argv[1:])) | 229 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |