Index: snapshot/win/end_to_end_test.py |
diff --git a/snapshot/win/end_to_end_test.py b/snapshot/win/end_to_end_test.py |
index 74cbc56edc17e047e5b428a7642e79e7fe06ac75..21f93d5d500da36eff4849e487917149749c2f37 100644 |
--- a/snapshot/win/end_to_end_test.py |
+++ b/snapshot/win/end_to_end_test.py |
@@ -77,9 +77,11 @@ def GetCdbPath(): |
def GetDumpFromProgram(out_dir, pipe_name, executable_name): |
- """Initialize a crash database, run crashpad_handler, run |executable_name| |
- connecting to the crash_handler. Returns the minidump generated by |
- crash_handler for further testing. |
+ """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 |
+ further testing. |
""" |
test_database = MakeTempDir() |
handler = None |
@@ -91,13 +93,18 @@ def GetDumpFromProgram(out_dir, pipe_name, executable_name): |
print 'could not initialize report database' |
return None |
- handler = subprocess.Popen([ |
- os.path.join(out_dir, 'crashpad_handler.exe'), |
- '--pipe-name=' + pipe_name, |
- '--database=' + test_database |
- ]) |
+ if pipe_name is not None: |
+ handler = subprocess.Popen([ |
+ os.path.join(out_dir, 'crashpad_handler.exe'), |
+ '--pipe-name=' + pipe_name, |
+ '--database=' + test_database |
+ ]) |
- subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) |
+ subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) |
+ else: |
+ subprocess.call([os.path.join(out_dir, executable_name), |
+ os.path.join(out_dir, 'crashpad_handler.exe'), |
+ test_database]) |
out = subprocess.check_output([ |
os.path.join(out_dir, 'crashpad_database_util.exe'), |
@@ -159,7 +166,12 @@ class CdbRun(object): |
sys.exit(1) |
-def RunTests(cdb_path, dump_path, destroyed_dump_path, z7_dump_path, pipe_name): |
+def RunTests(cdb_path, |
+ dump_path, |
+ start_handler_dump_path, |
+ destroyed_dump_path, |
+ z7_dump_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 |
confused for output from another. |
@@ -171,6 +183,13 @@ def RunTests(cdb_path, dump_path, destroyed_dump_path, z7_dump_path, pipe_name): |
'crashy_program!crashpad::`anonymous namespace\'::SomeCrashyFunction', |
'exception at correct location') |
+ out = CdbRun(cdb_path, start_handler_dump_path, '.ecxr') |
+ out.Check('This dump file has an exception of interest stored in it', |
+ 'captured exception (using StartHandler())') |
+ out.Check( |
+ 'crashy_program!crashpad::`anonymous namespace\'::SomeCrashyFunction', |
+ 'exception at correct location (using StartHandler())') |
+ |
out = CdbRun(cdb_path, dump_path, '!peb') |
out.Check(r'PEB at', 'found the PEB') |
out.Check(r'Ldr\.InMemoryOrderModuleList:.*\d+ \. \d+', 'PEB_LDR_DATA saved') |
@@ -251,6 +270,10 @@ def main(args): |
if not crashy_dump_path: |
return 1 |
+ start_handler_dump_path = GetDumpFromCrashyProgram(args[0], None) |
+ if not start_handler_dump_path: |
+ return 1 |
+ |
destroyed_dump_path = GetDumpFromSelfDestroyingProgram(args[0], pipe_name) |
if not destroyed_dump_path: |
return 1 |
@@ -261,7 +284,11 @@ def main(args): |
if not z7_dump_path: |
return 1 |
- RunTests(cdb_path, crashy_dump_path, destroyed_dump_path, z7_dump_path, |
+ RunTests(cdb_path, |
+ crashy_dump_path, |
+ start_handler_dump_path, |
+ destroyed_dump_path, |
+ z7_dump_path, |
pipe_name) |
return 0 |