| 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..9ed5fda71faddb8b32ae552b6949df016db66df6 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,18 @@ 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')
|
|
|
| + out = CdbRun(cdb_path, destroyed_dump_path, '.ecxr;!peb;k 2')
|
| + out.Check(r'Ldr\.InMemoryOrderModuleList:.*\d+ \. \d+', 'PEB_LDR_DATA saved')
|
| + out.Check(r'ntdll\.dll', 'ntdll present', re.IGNORECASE)
|
| +
|
| + # 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.
|
| + 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 +234,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:
|
|
|