Index: third_party/crashpad/crashpad/snapshot/win/end_to_end_test.py |
diff --git a/third_party/crashpad/crashpad/snapshot/win/end_to_end_test.py b/third_party/crashpad/crashpad/snapshot/win/end_to_end_test.py |
index a3506b64d8d41396cf4178710daf28cecd610ecd..a5540e58fcf9538910c42de680278861aa3d39ec 100755 |
--- a/third_party/crashpad/crashpad/snapshot/win/end_to_end_test.py |
+++ b/third_party/crashpad/crashpad/snapshot/win/end_to_end_test.py |
@@ -79,11 +79,12 @@ def GetCdbPath(): |
return None |
-def GetDumpFromProgram(out_dir, pipe_name, executable_name): |
+def GetDumpFromProgram(out_dir, pipe_name, executable_name, *args): |
"""Initialize a crash database, and run |executable_name| connecting to a |
crash handler. If pipe_name is set, crashpad_handler will be started first. If |
pipe_name is empty, the executable is responsible for starting |
- crashpad_handler. Returns the minidump generated by crashpad_handler for |
+ crashpad_handler. *args will be passed after other arguments to |
+ executable_name. Returns the minidump generated by crashpad_handler for |
further testing. |
""" |
test_database = MakeTempDir() |
@@ -111,11 +112,12 @@ def GetDumpFromProgram(out_dir, pipe_name, executable_name): |
printed = True |
time.sleep(0.1) |
- subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) |
+ subprocess.call([os.path.join(out_dir, executable_name), pipe_name] + |
+ list(args)) |
else: |
subprocess.call([os.path.join(out_dir, executable_name), |
os.path.join(out_dir, 'crashpad_handler.exe'), |
- test_database]) |
+ test_database] + list(args)) |
out = subprocess.check_output([ |
os.path.join(out_dir, 'crashpad_database_util.exe'), |
@@ -135,6 +137,11 @@ def GetDumpFromCrashyProgram(out_dir, pipe_name): |
return GetDumpFromProgram(out_dir, pipe_name, 'crashy_program.exe') |
+def GetDumpFromOtherProgram(out_dir, pipe_name, *args): |
+ return GetDumpFromProgram(out_dir, pipe_name, 'crash_other_program.exe', |
+ *args) |
+ |
+ |
def GetDumpFromSelfDestroyingProgram(out_dir, pipe_name): |
return GetDumpFromProgram(out_dir, pipe_name, 'self_destroying_program.exe') |
@@ -182,6 +189,8 @@ def RunTests(cdb_path, |
start_handler_dump_path, |
destroyed_dump_path, |
z7_dump_path, |
+ other_program_path, |
+ other_program_no_exception_path, |
pipe_name): |
"""Runs various tests in sequence. Runs a new cdb instance on the dump for |
each block of tests to reduce the chances that output from one command is |
@@ -280,15 +289,19 @@ def RunTests(cdb_path, |
r'\?\?\?\?\?\?\?\? \?\?\?\?\?\?\?\?', |
' and not memory after range') |
- out = CdbRun(cdb_path, dump_path, |
- 'dd poi(crashy_program!crashpad::g_extra_memory_not_saved)' |
- '+0x1f30 L4') |
- # We save only the pointer, not the pointed-to data. If the pointer itself |
- # wasn't saved, then we won't get any memory printed, so here we're confirming |
- # the pointer was saved but the memory wasn't. |
- out.Check(r'\?\?\?\?\?\?\?\? \?\?\?\?\?\?\?\? ' |
- r'\?\?\?\?\?\?\?\? \?\?\?\?\?\?\?\?', |
- 'extra memory removal') |
+ if False: |
+ # TODO(scottmg): This is flakily capturing too much memory in Debug builds, |
+ # possibly because a stale pointer is being captured via the stack. |
+ # See: https://bugs.chromium.org/p/crashpad/issues/detail?id=101. |
+ out = CdbRun(cdb_path, dump_path, |
+ 'dd poi(crashy_program!crashpad::g_extra_memory_not_saved)' |
+ '+0x1f30 L4') |
+ # We save only the pointer, not the pointed-to data. If the pointer itself |
+ # wasn't saved, then we won't get any memory printed, so here we're |
+ # confirming the pointer was saved but the memory wasn't. |
+ out.Check(r'\?\?\?\?\?\?\?\? \?\?\?\?\?\?\?\? ' |
+ r'\?\?\?\?\?\?\?\? \?\?\?\?\?\?\?\?', |
+ 'extra memory removal') |
out = CdbRun(cdb_path, dump_path, '.dumpdebug') |
out.Check(r'type \?\?\? \(333333\), size 00001000', |
@@ -307,6 +320,18 @@ def RunTests(cdb_path, |
out.Check(r'z7_test C \(codeview symbols\) z7_test.dll', |
'expected non-pdb symbol format') |
+ out = CdbRun(cdb_path, other_program_path, '.ecxr;k;~') |
+ out.Check('Unknown exception - code deadbea7', |
+ 'other program dump exception code') |
+ out.Check('!Sleep', 'other program reasonable location') |
+ out.Check('hanging_program!Thread1', 'other program dump right thread') |
+ out.Check('\. 1 Id', 'other program exception on correct thread') |
+ |
+ out = CdbRun(cdb_path, other_program_no_exception_path, '.ecxr;k') |
+ out.Check('Unknown exception - code 0cca11ed', |
+ 'other program with no exception given') |
+ out.Check('!RaiseException', 'other program in RaiseException()') |
+ |
def main(args): |
try: |
@@ -348,11 +373,22 @@ def main(args): |
if not z7_dump_path: |
return 1 |
+ other_program_path = GetDumpFromOtherProgram(args[0], pipe_name) |
+ if not other_program_path: |
+ return 1 |
+ |
+ other_program_no_exception_path = GetDumpFromOtherProgram( |
+ args[0], pipe_name, 'noexception') |
+ if not other_program_no_exception_path: |
+ return 1 |
+ |
RunTests(cdb_path, |
crashy_dump_path, |
start_handler_dump_path, |
destroyed_dump_path, |
z7_dump_path, |
+ other_program_path, |
+ other_program_no_exception_path, |
pipe_name) |
return 0 |