| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 def GetDumpFromCrashyProgram(out_dir, pipe_name): | 137 def GetDumpFromCrashyProgram(out_dir, pipe_name): |
| 138 return GetDumpFromProgram(out_dir, pipe_name, 'crashy_program.exe') | 138 return GetDumpFromProgram(out_dir, pipe_name, 'crashy_program.exe') |
| 139 | 139 |
| 140 | 140 |
| 141 def GetDumpFromOtherProgram(out_dir, pipe_name, *args): | 141 def GetDumpFromOtherProgram(out_dir, pipe_name, *args): |
| 142 return GetDumpFromProgram(out_dir, pipe_name, 'crash_other_program.exe', | 142 return GetDumpFromProgram(out_dir, pipe_name, 'crash_other_program.exe', |
| 143 *args) | 143 *args) |
| 144 | 144 |
| 145 | 145 |
| 146 def GetDumpFromSignal(out_dir, pipe_name, *args): |
| 147 return GetDumpFromProgram(out_dir, pipe_name, 'crashy_signal.exe', *args) |
| 148 |
| 149 |
| 146 def GetDumpFromSelfDestroyingProgram(out_dir, pipe_name): | 150 def GetDumpFromSelfDestroyingProgram(out_dir, pipe_name): |
| 147 return GetDumpFromProgram(out_dir, pipe_name, 'self_destroying_program.exe') | 151 return GetDumpFromProgram(out_dir, pipe_name, 'self_destroying_program.exe') |
| 148 | 152 |
| 149 | 153 |
| 150 def GetDumpFromZ7Program(out_dir, pipe_name): | 154 def GetDumpFromZ7Program(out_dir, pipe_name): |
| 151 return GetDumpFromProgram(out_dir, pipe_name, 'crashy_z7_loader.exe') | 155 return GetDumpFromProgram(out_dir, pipe_name, 'crashy_z7_loader.exe') |
| 152 | 156 |
| 153 | 157 |
| 154 class CdbRun(object): | 158 class CdbRun(object): |
| 155 """Run cdb.exe passing it a cdb command and capturing the output. | 159 """Run cdb.exe passing it a cdb command and capturing the output. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return None | 198 return None |
| 195 | 199 |
| 196 | 200 |
| 197 def RunTests(cdb_path, | 201 def RunTests(cdb_path, |
| 198 dump_path, | 202 dump_path, |
| 199 start_handler_dump_path, | 203 start_handler_dump_path, |
| 200 destroyed_dump_path, | 204 destroyed_dump_path, |
| 201 z7_dump_path, | 205 z7_dump_path, |
| 202 other_program_path, | 206 other_program_path, |
| 203 other_program_no_exception_path, | 207 other_program_no_exception_path, |
| 208 sigabrt_main_path, |
| 209 sigabrt_background_path, |
| 204 pipe_name): | 210 pipe_name): |
| 205 """Runs various tests in sequence. Runs a new cdb instance on the dump for | 211 """Runs various tests in sequence. Runs a new cdb instance on the dump for |
| 206 each block of tests to reduce the chances that output from one command is | 212 each block of tests to reduce the chances that output from one command is |
| 207 confused for output from another. | 213 confused for output from another. |
| 208 """ | 214 """ |
| 209 out = CdbRun(cdb_path, dump_path, '.ecxr') | 215 out = CdbRun(cdb_path, dump_path, '.ecxr') |
| 210 out.Check('This dump file has an exception of interest stored in it', | 216 out.Check('This dump file has an exception of interest stored in it', |
| 211 'captured exception') | 217 'captured exception') |
| 212 | 218 |
| 213 # When SomeCrashyFunction is inlined, cdb doesn't demangle its namespace as | 219 # When SomeCrashyFunction is inlined, cdb doesn't demangle its namespace as |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 count += 1 | 360 count += 1 |
| 355 else: | 361 else: |
| 356 break | 362 break |
| 357 assert count > 2 | 363 assert count > 2 |
| 358 | 364 |
| 359 out = CdbRun(cdb_path, other_program_no_exception_path, '.ecxr;k') | 365 out = CdbRun(cdb_path, other_program_no_exception_path, '.ecxr;k') |
| 360 out.Check('Unknown exception - code 0cca11ed', | 366 out.Check('Unknown exception - code 0cca11ed', |
| 361 'other program with no exception given') | 367 'other program with no exception given') |
| 362 out.Check('!RaiseException', 'other program in RaiseException()') | 368 out.Check('!RaiseException', 'other program in RaiseException()') |
| 363 | 369 |
| 370 out = CdbRun(cdb_path, sigabrt_main_path, '.ecxr') |
| 371 out.Check('code 40000015', 'got sigabrt signal') |
| 372 out.Check('::HandleAbortSignal', ' stack in expected location') |
| 373 |
| 374 out = CdbRun(cdb_path, sigabrt_background_path, '.ecxr') |
| 375 out.Check('code 40000015', 'got sigabrt signal from background thread') |
| 376 |
| 364 | 377 |
| 365 def main(args): | 378 def main(args): |
| 366 try: | 379 try: |
| 367 if len(args) != 1: | 380 if len(args) != 1: |
| 368 print >>sys.stderr, 'must supply binary dir' | 381 print >>sys.stderr, 'must supply binary dir' |
| 369 return 1 | 382 return 1 |
| 370 | 383 |
| 371 cdb_path = GetCdbPath() | 384 cdb_path = GetCdbPath() |
| 372 if not cdb_path: | 385 if not cdb_path: |
| 373 print >>sys.stderr, 'could not find cdb' | 386 print >>sys.stderr, 'could not find cdb' |
| (...skipping 30 matching lines...) Expand all Loading... |
| 404 | 417 |
| 405 other_program_path = GetDumpFromOtherProgram(args[0], pipe_name) | 418 other_program_path = GetDumpFromOtherProgram(args[0], pipe_name) |
| 406 if not other_program_path: | 419 if not other_program_path: |
| 407 return 1 | 420 return 1 |
| 408 | 421 |
| 409 other_program_no_exception_path = GetDumpFromOtherProgram( | 422 other_program_no_exception_path = GetDumpFromOtherProgram( |
| 410 args[0], pipe_name, 'noexception') | 423 args[0], pipe_name, 'noexception') |
| 411 if not other_program_no_exception_path: | 424 if not other_program_no_exception_path: |
| 412 return 1 | 425 return 1 |
| 413 | 426 |
| 427 sigabrt_main_path = GetDumpFromSignal(args[0], pipe_name, 'main') |
| 428 if not sigabrt_main_path: |
| 429 return 1 |
| 430 |
| 431 sigabrt_background_path = GetDumpFromSignal( |
| 432 args[0], pipe_name, 'background') |
| 433 if not sigabrt_background_path: |
| 434 return 1 |
| 435 |
| 414 RunTests(cdb_path, | 436 RunTests(cdb_path, |
| 415 crashy_dump_path, | 437 crashy_dump_path, |
| 416 start_handler_dump_path, | 438 start_handler_dump_path, |
| 417 destroyed_dump_path, | 439 destroyed_dump_path, |
| 418 z7_dump_path, | 440 z7_dump_path, |
| 419 other_program_path, | 441 other_program_path, |
| 420 other_program_no_exception_path, | 442 other_program_no_exception_path, |
| 443 sigabrt_main_path, |
| 444 sigabrt_background_path, |
| 421 pipe_name) | 445 pipe_name) |
| 422 | 446 |
| 423 return 1 if g_had_failures else 0 | 447 return 1 if g_had_failures else 0 |
| 424 finally: | 448 finally: |
| 425 CleanUpTempDirs() | 449 CleanUpTempDirs() |
| 426 | 450 |
| 427 | 451 |
| 428 if __name__ == '__main__': | 452 if __name__ == '__main__': |
| 429 sys.exit(main(sys.argv[1:])) | 453 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |