Bug 973937 - [mozcrash] check_for_crashes() doesn't save .extra file to dump_save_path. r=ted

--HG--
extra : rebase_source : 2173eb218be74052b176ba5d02f375f512e4296f
This commit is contained in:
Henrik Skupin 2014-02-20 15:06:38 +01:00
Родитель e188f57729
Коммит 30621fe275
3 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@ -85,6 +85,8 @@ def check_for_crashes(dump_directory, symbols_path,
zfile.close()
for d in dumps:
extra = os.path.splitext(d)[0] + '.extra'
stackwalk_output = []
stackwalk_output.append("Crash dump filename: " + d)
top_frame = None
@ -140,13 +142,18 @@ def check_for_crashes(dump_directory, symbols_path,
os.makedirs(dump_save_path)
except OSError:
pass
shutil.move(d, dump_save_path)
log.info("Saved dump as %s", os.path.join(dump_save_path,
os.path.basename(d)))
log.info("Saved minidump as %s",
os.path.join(dump_save_path, os.path.basename(d)))
if os.path.isfile(extra):
shutil.move(extra, dump_save_path)
log.info("Saved app info as %s",
os.path.join(dump_save_path, os.path.basename(extra)))
else:
mozfile.remove(d)
extra = os.path.splitext(d)[0] + ".extra"
mozfile.remove(extra)
mozfile.remove(extra)
finally:
if remove_symbols:
mozfile.remove(symbols_path)

Просмотреть файл

@ -5,7 +5,7 @@
from setuptools import setup
PACKAGE_NAME = 'mozcrash'
PACKAGE_VERSION = '0.11'
PACKAGE_VERSION = '0.12'
# dependencies
deps = ['mozfile >= 1.0',

Просмотреть файл

@ -86,6 +86,7 @@ class TestCrash(unittest.TestCase):
Test that dump_save_path works.
"""
open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
open(os.path.join(self.tempdir, "test.extra"), "w").write("bar")
save_path = os.path.join(self.tempdir, "saved")
os.mkdir(save_path)
self.stdouts.append(["this is some output"])
@ -95,12 +96,14 @@ class TestCrash(unittest.TestCase):
dump_save_path=save_path,
quiet=True))
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
self.assert_(os.path.isfile(os.path.join(save_path, "test.extra")))
def test_save_path_not_present(self):
"""
Test that dump_save_path works when the directory doesn't exist.
"""
open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
open(os.path.join(self.tempdir, "test.extra"), "w").write("bar")
save_path = os.path.join(self.tempdir, "saved")
self.stdouts.append(["this is some output"])
self.assert_(mozcrash.check_for_crashes(self.tempdir,
@ -109,6 +112,7 @@ class TestCrash(unittest.TestCase):
dump_save_path=save_path,
quiet=True))
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
self.assert_(os.path.isfile(os.path.join(save_path, "test.extra")))
def test_save_path_isfile(self):
"""
@ -116,6 +120,7 @@ class TestCrash(unittest.TestCase):
but a file with the same name exists.
"""
open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
open(os.path.join(self.tempdir, "test.extra"), "w").write("bar")
save_path = os.path.join(self.tempdir, "saved")
open(save_path, "w").write("junk")
self.stdouts.append(["this is some output"])
@ -125,12 +130,14 @@ class TestCrash(unittest.TestCase):
dump_save_path=save_path,
quiet=True))
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
self.assert_(os.path.isfile(os.path.join(save_path, "test.extra")))
def test_save_path_envvar(self):
"""
Test that the MINDUMP_SAVE_PATH environment variable works.
"""
open(os.path.join(self.tempdir, "test.dmp"), "w").write("foo")
open(os.path.join(self.tempdir, "test.extra"), "w").write("bar")
save_path = os.path.join(self.tempdir, "saved")
os.mkdir(save_path)
self.stdouts.append(["this is some output"])
@ -141,6 +148,7 @@ class TestCrash(unittest.TestCase):
quiet=True))
del os.environ['MINIDUMP_SAVE_PATH']
self.assert_(os.path.isfile(os.path.join(save_path, "test.dmp")))
self.assert_(os.path.isfile(os.path.join(save_path, "test.extra")))
def test_symbol_path_url(self):
"""