Chromium Code Reviews| 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 9ed5fda71faddb8b32ae552b6949df016db66df6..c2f4a95d1ff0e0c1c4e6841affee111c1d845287 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: |
| + 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'), |
| @@ -155,7 +162,11 @@ class CdbRun(object): |
| sys.exit(1) |
| -def RunTests(cdb_path, dump_path, destroyed_dump_path, pipe_name): |
| +def RunTests(cdb_path, |
| + dump_path, |
| + start_handler_dump_path, |
| + destroyed_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. |
| @@ -167,6 +178,13 @@ def RunTests(cdb_path, dump_path, destroyed_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') |
| @@ -238,11 +256,19 @@ def main(args): |
| if not crashy_dump_path: |
| return 1 |
| + start_handler_dump_path = GetDumpFromCrashyProgram(args[0], '') |
|
scottmg
2015/10/30 23:16:31
I think None rather than '' would be better.
|
| + if not start_handler_dump_path: |
| + return 1 |
| + |
| destroyed_dump_path = GetDumpFromSelfDestroyingProgram(args[0], pipe_name) |
| if not destroyed_dump_path: |
| return 1 |
| - RunTests(cdb_path, crashy_dump_path, destroyed_dump_path, pipe_name) |
| + RunTests(cdb_path, |
| + crashy_dump_path, |
| + start_handler_dump_path, |
| + destroyed_dump_path, |
| + pipe_name) |
| return 0 |
| finally: |