# coding: utf8 from django.test import TestCase from crash.stacktrace_to_json import pipe_dump_to_json_dump stacktrace = r"""OS|Windows NT|6.1.7600 CPU|x86|GenuineIntel family 6 model 42 stepping 7|4 Crash|EXCEPTION_ACCESS_VIOLATION_WRITE|0x0|0 Module|BreakpadTestApp.exe||BreakpadTestApp.pdb|C1C0FA629EAA4B4D9DD2ADE270A231CC1|0x01240000|0x01249fff|1 Module|dbghelp.dll|6.1.7600.16385|dbghelp.pdb|44CEF9DBD9F04BB08B6DD16C1D8EA04B2|0x69c80000|0x69d6afff|0 Module|powrprof.dll|6.1.7600.16385|powrprof.pdb|B1F8F66CCBAD4869BADFD20C1F24AC832|0x6eee0000|0x6ef04fff|0 Module|msvcp90.dll|9.0.30729.4926|msvcp90.i386.pdb|55F07BFDDE684DCBA0000747BCF9C32E1|0x712d0000|0x7135dfff|0 Module|msvcr90.dll|9.0.30729.4926|msvcr90.i386.pdb|063D658EE9B54C669D86EAB72E5AD0801|0x75470000|0x75512fff|0 Module|CRYPTBASE.dll|6.1.7600.16385|cryptbase.pdb|E62FEAE559EE4CD995614215B01AC2102|0x75870000|0x7587bfff|0 Module|sspicli.dll|6.1.7600.16484|wsspicli.pdb|70B1619CF4B04AD499CAC187FCEE7CE91|0x75880000|0x758dffff|0 Module|gdi32.dll|6.1.7600.16385|wgdi32.pdb|4AFCCD0C08C94A6995600DD65392988F2|0x75a20000|0x75aaffff|0 Module|ole32.dll|6.1.7600.16385|ole32.pdb|21425202547E4A5DA0F12B17C4131B272|0x75ae0000|0x75c3bfff|0 Module|rpcrt4.dll|6.1.7600.16385|wrpcrt4.pdb|6EEAEDF802FE407B947FCFE825DAF1582|0x75c40000|0x75d2ffff|0 Module|lpk.dll|6.1.7600.16385|wlpk.pdb|C39166A53CCE43F0ADF876B9C637A1EA1|0x75d40000|0x75d49fff|0 Module|cfgmgr32.dll|6.1.7600.16385|cfgmgr32.pdb|8E6E976F862B40D59BA4AFFE0921744C2|0x75d50000|0x75d76fff|0 Module|imm32.dll|6.1.7600.16385|wimm32.pdb|68C7808EB69642399E0B930F19CCEFBD2|0x76b30000|0x76b8ffff|0 Module|advapi32.dll|6.1.7600.16385|advapi32.pdb|8215E3385BE64C70AD230B20F032B9402|0x76cb0000|0x76d4ffff|0 Module|setupapi.dll|6.1.7600.16385|setupapi.pdb|F7D7468DFCD247CAA97C8C8BD291E1492|0x76e70000|0x7700cfff|0 Module|usp10.dll|1.626.7600.16385|usp10.pdb|0F136332ED524622ACD511B27629058A1|0x77010000|0x770acfff|0 Module|msvcrt.dll|7.0.7600.16385|msvcrt.pdb|6EC79267530C45188F2A816AD59DBBF92|0x770f0000|0x7719bfff|0 Module|KERNELBASE.dll|6.1.7600.16385|wkernelbase.pdb|74D5C6E200BD410780AD91A62D03C8CA1|0x771b0000|0x771f5fff|0 Module|devobj.dll|6.1.7600.16385|devobj.pdb|5EC40EC65C5045EB96F4CFDCFC6E19062|0x77290000|0x772a1fff|0 Module|sechost.dll|6.1.7600.16385|sechost.pdb|7AF14D02D41E4CD6942745FE0E6372B11|0x77390000|0x773a8fff|0 Module|msctf.dll|6.1.7600.16385|msctf.pdb|173DAEF86B2548DBA6134EB74C4D2F232|0x773b0000|0x7747bfff|0 Module|user32.dll|6.1.7600.16385|wuser32.pdb|438BB768E2434151BA04E6929C0100522|0x77480000|0x7757ffff|0 Module|oleaut32.dll|6.1.7600.16385|oleaut32.pdb|204621952AB4418390863F295E593B882|0x77580000|0x7760efff|0 Module|kernel32.dll|6.1.7600.16385|wkernel32.pdb|247C9009E69B43AB95E8DDA34622320A2|0x77810000|0x7790ffff|0 Module|ntdll.dll|6.1.7600.16559|wntdll.pdb|ACE318E6A2F44F23A6CC5628F10A7DDC2|0x77d10000|0x77e8ffff|0 0|0|BreakpadTestApp.exe|crashedFunc()|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|34|0x3 0|1|BreakpadTestApp.exe|deeperFunc()|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|39|0x4 0|2|BreakpadTestApp.exe|deepFunc()|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|44|0x4 0|3|BreakpadTestApp.exe|anotherFunc()|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|49|0x4 0|4|BreakpadTestApp.exe|someFunc()|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|54|0x4 0|5|BreakpadTestApp.exe|func()|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|59|0x4 0|6|BreakpadTestApp.exe|wmain|c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp|84|0x4 0|7|BreakpadTestApp.exe|__tmainCRTStartup|f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c|579|0x16 0|8|kernel32.dll||||0x13676 0|9|ntdll.dll||||0x39d41 0|10|ntdll.dll||||0x39d14""" stacktrace_dict = {'crash_info': {'crash_address': '0x0', 'crashing_thread': 0, 'type': 'EXCEPTION_ACCESS_VIOLATION_WRITE'}, 'crashing_thread': { 'frames': [{'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 0, 'function': 'crashedFunc()', 'lineno': 34, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 1, 'function': 'deeperFunc()', 'lineno': 39, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 2, 'function': 'deepFunc()', 'lineno': 44, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 3, 'function': 'anotherFunc()', 'lineno': 49, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 4, 'function': 'someFunc()', 'lineno': 54, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 5, 'function': 'func()', 'lineno': 59, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 6, 'function': 'wmain', 'lineno': 84, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c', 'frame': 7, 'function': '__tmainCRTStartup', 'lineno': 579, 'filename': 'BreakpadTestApp.exe'}, {'frame': 8, 'filename': 'kernel32.dll', 'module_offset': '0x13676'}, {'frame': 9, 'filename': 'ntdll.dll', 'module_offset': '0x39d41'}], 'threads_index': 0, 'total_frames': 11}, 'main_module': 0, 'modules': [{'base_addr': '0x01240000', 'debug_file': 'BreakpadTestApp.pdb', 'debug_id': 'C1C0FA629EAA4B4D9DD2ADE270A231CC1', 'end_addr': '0x01249fff', 'filename': 'BreakpadTestApp.exe'}, {'base_addr': '0x69c80000', 'debug_file': 'dbghelp.pdb', 'debug_id': '44CEF9DBD9F04BB08B6DD16C1D8EA04B2', 'end_addr': '0x69d6afff', 'filename': 'dbghelp.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x6eee0000', 'debug_file': 'powrprof.pdb', 'debug_id': 'B1F8F66CCBAD4869BADFD20C1F24AC832', 'end_addr': '0x6ef04fff', 'filename': 'powrprof.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x712d0000', 'debug_file': 'msvcp90.i386.pdb', 'debug_id': '55F07BFDDE684DCBA0000747BCF9C32E1', 'end_addr': '0x7135dfff', 'filename': 'msvcp90.dll', 'version': '9.0.30729.4926'}, {'base_addr': '0x75470000', 'debug_file': 'msvcr90.i386.pdb', 'debug_id': '063D658EE9B54C669D86EAB72E5AD0801', 'end_addr': '0x75512fff', 'filename': 'msvcr90.dll', 'version': '9.0.30729.4926'}, {'base_addr': '0x75870000', 'debug_file': 'cryptbase.pdb', 'debug_id': 'E62FEAE559EE4CD995614215B01AC2102', 'end_addr': '0x7587bfff', 'filename': 'CRYPTBASE.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x75880000', 'debug_file': 'wsspicli.pdb', 'debug_id': '70B1619CF4B04AD499CAC187FCEE7CE91', 'end_addr': '0x758dffff', 'filename': 'sspicli.dll', 'version': '6.1.7600.16484'}, {'base_addr': '0x75a20000', 'debug_file': 'wgdi32.pdb', 'debug_id': '4AFCCD0C08C94A6995600DD65392988F2', 'end_addr': '0x75aaffff', 'filename': 'gdi32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x75ae0000', 'debug_file': 'ole32.pdb', 'debug_id': '21425202547E4A5DA0F12B17C4131B272', 'end_addr': '0x75c3bfff', 'filename': 'ole32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x75c40000', 'debug_file': 'wrpcrt4.pdb', 'debug_id': '6EEAEDF802FE407B947FCFE825DAF1582', 'end_addr': '0x75d2ffff', 'filename': 'rpcrt4.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x75d40000', 'debug_file': 'wlpk.pdb', 'debug_id': 'C39166A53CCE43F0ADF876B9C637A1EA1', 'end_addr': '0x75d49fff', 'filename': 'lpk.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x75d50000', 'debug_file': 'cfgmgr32.pdb', 'debug_id': '8E6E976F862B40D59BA4AFFE0921744C2', 'end_addr': '0x75d76fff', 'filename': 'cfgmgr32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x76b30000', 'debug_file': 'wimm32.pdb', 'debug_id': '68C7808EB69642399E0B930F19CCEFBD2', 'end_addr': '0x76b8ffff', 'filename': 'imm32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x76cb0000', 'debug_file': 'advapi32.pdb', 'debug_id': '8215E3385BE64C70AD230B20F032B9402', 'end_addr': '0x76d4ffff', 'filename': 'advapi32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x76e70000', 'debug_file': 'setupapi.pdb', 'debug_id': 'F7D7468DFCD247CAA97C8C8BD291E1492', 'end_addr': '0x7700cfff', 'filename': 'setupapi.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77010000', 'debug_file': 'usp10.pdb', 'debug_id': '0F136332ED524622ACD511B27629058A1', 'end_addr': '0x770acfff', 'filename': 'usp10.dll', 'version': '1.626.7600.16385'}, {'base_addr': '0x770f0000', 'debug_file': 'msvcrt.pdb', 'debug_id': '6EC79267530C45188F2A816AD59DBBF92', 'end_addr': '0x7719bfff', 'filename': 'msvcrt.dll', 'version': '7.0.7600.16385'}, {'base_addr': '0x771b0000', 'debug_file': 'wkernelbase.pdb', 'debug_id': '74D5C6E200BD410780AD91A62D03C8CA1', 'end_addr': '0x771f5fff', 'filename': 'KERNELBASE.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77290000', 'debug_file': 'devobj.pdb', 'debug_id': '5EC40EC65C5045EB96F4CFDCFC6E19062', 'end_addr': '0x772a1fff', 'filename': 'devobj.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77390000', 'debug_file': 'sechost.pdb', 'debug_id': '7AF14D02D41E4CD6942745FE0E6372B11', 'end_addr': '0x773a8fff', 'filename': 'sechost.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x773b0000', 'debug_file': 'msctf.pdb', 'debug_id': '173DAEF86B2548DBA6134EB74C4D2F232', 'end_addr': '0x7747bfff', 'filename': 'msctf.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77480000', 'debug_file': 'wuser32.pdb', 'debug_id': '438BB768E2434151BA04E6929C0100522', 'end_addr': '0x7757ffff', 'filename': 'user32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77580000', 'debug_file': 'oleaut32.pdb', 'debug_id': '204621952AB4418390863F295E593B882', 'end_addr': '0x7760efff', 'filename': 'oleaut32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77810000', 'debug_file': 'wkernel32.pdb', 'debug_id': '247C9009E69B43AB95E8DDA34622320A2', 'end_addr': '0x7790ffff', 'filename': 'kernel32.dll', 'version': '6.1.7600.16385'}, {'base_addr': '0x77d10000', 'debug_file': 'wntdll.pdb', 'debug_id': 'ACE318E6A2F44F23A6CC5628F10A7DDC2', 'end_addr': '0x77e8ffff', 'filename': 'ntdll.dll', 'version': '6.1.7600.16559'}], 'system_info': {'cpu_arch': 'x86', 'cpu_count': 4, 'cpu_info': 'GenuineIntel family 6 model 42 stepping 7', 'os': 'Windows NT', 'os_ver': '6.1.7600'}, 'thread_count': 1, 'threads': [{'frame_count': 11, 'frames': [ {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 0, 'function': 'crashedFunc()', 'lineno': 34, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 1, 'function': 'deeperFunc()', 'lineno': 39, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 2, 'function': 'deepFunc()', 'lineno': 44, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 3, 'function': 'anotherFunc()', 'lineno': 49, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 4, 'function': 'someFunc()', 'lineno': 54, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 5, 'function': 'func()', 'lineno': 59, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'c:\work\breakpadtestapp\breakpadtestapp\breakpadtestapp.cpp', 'frame': 6, 'function': 'wmain', 'lineno': 84, 'filename': 'BreakpadTestApp.exe'}, {'abs_path': r'f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c', 'frame': 7, 'function': '__tmainCRTStartup', 'lineno': 579, 'filename': 'BreakpadTestApp.exe'}, {'frame': 8, 'filename': 'kernel32.dll', 'module_offset': '0x13676'}, {'frame': 9, 'filename': 'ntdll.dll', 'module_offset': '0x39d41'}, {'frame': 10, 'filename': 'ntdll.dll', 'module_offset': '0x39d14'}]}]} class Test(TestCase): maxDiff = None def test_pipe_dump_to_json_dump(self): self.assertDictEqual(pipe_dump_to_json_dump(stacktrace.splitlines()), stacktrace_dict)