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 2252bd58a896521f3b7559bcc42b20a025911468..28e08a58ba05d5c2fe50585784776c22b168afde 100644 |
| --- a/snapshot/win/end_to_end_test.py |
| +++ b/snapshot/win/end_to_end_test.py |
| @@ -76,8 +76,8 @@ def GetCdbPath(): |
| return None |
| -def GetDumpFromCrashyProgram(out_dir, pipe_name): |
| - """Initialize a crash database, run crashpad_handler, run crashy_program |
| +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. |
| """ |
| @@ -97,7 +97,7 @@ def GetDumpFromCrashyProgram(out_dir, pipe_name): |
| '--database=' + test_database |
| ]) |
| - subprocess.call([os.path.join(out_dir, 'crashy_program.exe'), pipe_name]) |
| + subprocess.call([os.path.join(out_dir, executable_name), pipe_name]) |
| out = subprocess.check_output([ |
| os.path.join(out_dir, 'crashpad_database_util.exe'), |
| @@ -113,6 +113,14 @@ def GetDumpFromCrashyProgram(out_dir, pipe_name): |
| handler.kill() |
| +def GetDumpFromCrashyProgram(out_dir, pipe_name): |
| + return GetDumpFromProgram(out_dir, pipe_name, 'crashy_program.exe') |
| + |
| + |
| +def GetDumpFromSelfDestroyingProgram(out_dir, pipe_name): |
| + return GetDumpFromProgram(out_dir, pipe_name, 'self_destroying_program.exe') |
| + |
| + |
| class CdbRun(object): |
| """Run cdb.exe passing it a cdb command and capturing the output. |
| `Check()` searches for regex patterns in sequence allowing verification of |
| @@ -147,7 +155,7 @@ class CdbRun(object): |
| sys.exit(1) |
| -def RunTests(cdb_path, dump_path, pipe_name): |
| +def RunTests(cdb_path, 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. |
| @@ -192,6 +200,15 @@ def RunTests(cdb_path, dump_path, pipe_name): |
| out.Check(r'Event\s+\d+', 'capture some event handles') |
| out.Check(r'File\s+\d+', 'capture some file handles') |
| + # Check that there is no stack trace in the self-destroyed process. Confirm |
| + # that the top is where we expect it (that's based only on IP), but subsequent |
| + # stack entries will not be available. This confirms that we have a mostly |
| + # valid dump, but that the stack was omitted. |
|
Mark Mentovai
2015/10/21 22:49:29
Is it worth also checking that the module list is
scottmg
2015/10/21 22:58:08
Sure, done.
|
| + out = CdbRun(cdb_path, destroyed_dump_path, '.ecxr;k 2') |
| + out.Check(r'self_destroying_program!crashpad::`anonymous namespace\'::' |
| + r'FreeOwnStackAndBreak.*\nquit:', |
| + 'at correct location, no additional stack entries') |
| + |
| def main(args): |
| try: |
| if len(args) != 1: |
| @@ -214,11 +231,15 @@ def main(args): |
| pipe_name = r'\\.\pipe\end-to-end_%s_%s' % ( |
| os.getpid(), str(random.getrandbits(64))) |
| - dump_path = GetDumpFromCrashyProgram(args[0], pipe_name) |
| - if not dump_path: |
| + crashy_dump_path = GetDumpFromCrashyProgram(args[0], pipe_name) |
| + if not crashy_dump_path: |
| + return 1 |
| + |
| + destroyed_dump_path = GetDumpFromSelfDestroyingProgram(args[0], pipe_name) |
| + if not destroyed_dump_path: |
| return 1 |
| - RunTests(cdb_path, dump_path, pipe_name) |
| + RunTests(cdb_path, crashy_dump_path, destroyed_dump_path, pipe_name) |
| return 0 |
| finally: |