mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 885591 - Add a silent argument to check_for_crashes. r=jhammel
This commit is contained in:
parent
211dccca9c
commit
72a17cab71
@ -21,7 +21,8 @@ from mozfile import is_url
|
||||
def check_for_crashes(dump_directory, symbols_path,
|
||||
stackwalk_binary=None,
|
||||
dump_save_path=None,
|
||||
test_name=None):
|
||||
test_name=None,
|
||||
quiet=False):
|
||||
"""
|
||||
Print a stack trace for minidump files left behind by a crashing program.
|
||||
|
||||
@ -44,6 +45,9 @@ def check_for_crashes(dump_directory, symbols_path,
|
||||
If `test_name` is set it will be used as the test name in log output. If not set the
|
||||
filename of the calling function will be used.
|
||||
|
||||
If `quiet` is set, no PROCESS-CRASH message will be printed to stdout if a
|
||||
crash is detected.
|
||||
|
||||
Returns True if any minidumps were found, False otherwise.
|
||||
"""
|
||||
dumps = glob.glob(os.path.join(dump_directory, '*.dmp'))
|
||||
@ -120,8 +124,9 @@ def check_for_crashes(dump_directory, symbols_path,
|
||||
stackwalk_output.append("MINIDUMP_STACKWALK binary not found: %s" % stackwalk_binary)
|
||||
if not top_frame:
|
||||
top_frame = "Unknown top frame"
|
||||
print "PROCESS-CRASH | %s | application crashed [%s]" % (test_name, top_frame)
|
||||
print '\n'.join(stackwalk_output)
|
||||
if not quiet:
|
||||
print "PROCESS-CRASH | %s | application crashed [%s]" % (test_name, top_frame)
|
||||
print '\n'.join(stackwalk_output)
|
||||
if dump_save_path is None:
|
||||
dump_save_path = os.environ.get('MINIDUMP_SAVE_PATH', None)
|
||||
if dump_save_path:
|
||||
|
@ -55,7 +55,8 @@ class TestCrash(unittest.TestCase):
|
||||
self.stdouts.append(["this is some output"])
|
||||
self.assertFalse(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path',
|
||||
stackwalk_binary=self.stackwalk))
|
||||
stackwalk_binary=self.stackwalk,
|
||||
quiet=True))
|
||||
|
||||
def test_simple(self):
|
||||
"""
|
||||
@ -65,7 +66,8 @@ class TestCrash(unittest.TestCase):
|
||||
self.stdouts.append(["this is some output"])
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path',
|
||||
stackwalk_binary=self.stackwalk))
|
||||
stackwalk_binary=self.stackwalk,
|
||||
quiet=True))
|
||||
|
||||
def test_stackwalk_envvar(self):
|
||||
"""
|
||||
@ -75,7 +77,8 @@ class TestCrash(unittest.TestCase):
|
||||
self.stdouts.append(["this is some output"])
|
||||
os.environ['MINIDUMP_STACKWALK'] = self.stackwalk
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path'))
|
||||
'symbols_path',
|
||||
quiet=True))
|
||||
del os.environ['MINIDUMP_STACKWALK']
|
||||
|
||||
def test_save_path(self):
|
||||
@ -89,7 +92,8 @@ class TestCrash(unittest.TestCase):
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path',
|
||||
stackwalk_binary=self.stackwalk,
|
||||
dump_save_path=save_path))
|
||||
dump_save_path=save_path,
|
||||
quiet=True))
|
||||
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
|
||||
|
||||
def test_save_path_not_present(self):
|
||||
@ -102,7 +106,8 @@ class TestCrash(unittest.TestCase):
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path',
|
||||
stackwalk_binary=self.stackwalk,
|
||||
dump_save_path=save_path))
|
||||
dump_save_path=save_path,
|
||||
quiet=True))
|
||||
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
|
||||
|
||||
def test_save_path_isfile(self):
|
||||
@ -117,7 +122,8 @@ class TestCrash(unittest.TestCase):
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path',
|
||||
stackwalk_binary=self.stackwalk,
|
||||
dump_save_path=save_path))
|
||||
dump_save_path=save_path,
|
||||
quiet=True))
|
||||
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
|
||||
|
||||
def test_save_path_envvar(self):
|
||||
@ -131,7 +137,8 @@ class TestCrash(unittest.TestCase):
|
||||
os.environ['MINIDUMP_SAVE_PATH'] = save_path
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
'symbols_path',
|
||||
stackwalk_binary=self.stackwalk))
|
||||
stackwalk_binary=self.stackwalk,
|
||||
quiet=True))
|
||||
del os.environ['MINIDUMP_SAVE_PATH']
|
||||
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
|
||||
|
||||
@ -158,7 +165,8 @@ class TestCrash(unittest.TestCase):
|
||||
'/symbols','',''))
|
||||
self.assert_(mozcrash.check_for_crashes(self.tempdir,
|
||||
symbol_url,
|
||||
stackwalk_binary=self.stackwalk))
|
||||
stackwalk_binary=self.stackwalk,
|
||||
quiet=True))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user