def test_ubuntu4(self): import tempfile import os import shutil import datetime dirpath=tempfile.mkdtemp() try: # Test setup stacktrace_path = os.path.join(dirpath, "Stacktrace.txt") with open(stacktrace_path, 'w') as stacktrace_file: stacktrace_file.write(self.example_ubuntu_stacktrace4) post_path = os.path.join(dirpath, "Post.txt") with open(post_path, 'w') as post_file: post_file.write(self.example_ubuntu_post4) # Test crash loader crash = Crash.load_from_file(dirpath) # test that contents are loaded correctly assert (isinstance(crash, Crash)) stacktrace = crash['stacktrace'] assert stacktrace is crash.stacktrace assert (isinstance(stacktrace, Stacktrace)) assert (isinstance(stacktrace[0], Stackframe)) assert stacktrace[0]['function'] is None finally: shutil.rmtree(dirpath)
def test_ubuntu2(self): import tempfile import os import shutil import datetime dirpath=tempfile.mkdtemp() try: # Test setup stacktrace_path = os.path.join(dirpath, "Stacktrace.txt (retraced)") with open(stacktrace_path, 'w') as stacktrace_file: stacktrace_file.write(self.example_ubuntu_stacktrace2) post_path = os.path.join(dirpath, "Post.txt") with open(post_path, 'w') as post_file: post_file.write(self.example_ubuntu_post2) # Test crash loader crash = Crash.load_from_file(dirpath) # test that contents are loaded correctly assert (isinstance(crash, Crash)) assert (crash['cpu'] == 'amd64') assert (crash['date'] == datetime.datetime(2007, 6, 20, 10, 27, 6)) stacktrace = crash['stacktrace'] assert stacktrace is crash.stacktrace assert (isinstance(stacktrace, Stacktrace)) assert (isinstance(stacktrace[0], Stackframe)) assert (stacktrace[0]['depth'] == 0) assert (stacktrace[0]['function'] == 'cairo_transform') assert (not 'address' in stacktrace[0]) assert (stacktrace[1]['depth'] == 1) assert (stacktrace[1]['address'] == '0x00002b344498a150') finally: shutil.rmtree(dirpath)
def test_ubuntu3(self): import tempfile import os import shutil import datetime dirpath=tempfile.mkdtemp() try: # Test setup stacktrace_path = os.path.join(dirpath, "Stacktrace.txt (retraced)") with open(stacktrace_path, 'w') as stacktrace_file: stacktrace_file.write(self.example_ubuntu_stacktrace3) post_path = os.path.join(dirpath, "Post.txt") with open(post_path, 'w') as post_file: post_file.write(self.example_ubuntu_post3) # Test crash loader crash = Crash.load_from_file(dirpath) # test that contents are loaded correctly assert (isinstance(crash, Crash)) stacktrace = crash['stacktrace'] assert stacktrace is crash.stacktrace assert (isinstance(stacktrace, Stacktrace)) assert (isinstance(stacktrace[0], Stackframe)) assert (stacktrace[0]['depth'] == 0) assert (stacktrace[1]['depth'] == 1) assert (stacktrace[6]['function'] == '<signal handler called>') assert (stacktrace[4]['extra'][0] == 'No locals.') assert (stacktrace[0]['file'] == '../../src/QuExt.c') assert (stacktrace[0]['fileline'] == '46') assert (len(stacktrace[0]['extra']) == 2) finally: shutil.rmtree(dirpath)
def test_ubuntu(self): import tempfile import os import shutil import datetime dirpath=tempfile.mkdtemp() try: # Test setup stacktrace_path = os.path.join(dirpath, "Stacktrace.txt") with open(stacktrace_path, 'w') as stacktrace_file: stacktrace_file.write(self.example_ubuntu_stacktrace) post_path = os.path.join(dirpath, "Post.txt") with open(post_path, 'w') as post_file: post_file.write(self.example_ubuntu_post) # Test crash loader crash = Crash.load_from_file(dirpath) # test that contents are loaded correctly assert (isinstance(crash, Crash)) assert (crash['cpu'] == 'i386') assert (crash['date'] == datetime.datetime(2008, 4, 11, 22, 12, 11)) stacktrace = crash['stacktrace'] assert stacktrace is crash.stacktrace assert (isinstance(stacktrace, Stacktrace)) assert (isinstance(stacktrace[0], Stackframe)) assert (stacktrace[0]['depth'] == 0) assert (stacktrace[0]['function'] == 'free') assert (stacktrace[1]['depth'] == 1) assert (stacktrace[1]['address'] == '0xb78e78b1') finally: shutil.rmtree(dirpath)