Modify autotest to support preserving minidumps generated during tests.
Crash information is retained for all tests that are not testing the
crash facilities themselves. Crash tests touch
/tmp/crash-test-in-progress to indicate that crash facilities are being
tested and minidumps should not be retained all the time. At the end of
each job, autotest enumerates the test results directory and creates
stack traces for all minidumps.
BUG=chromium-os:12207
TEST=logging_UserCrash, logging_CrashSender, manual test which involves
purposely crashing a test to determine if minidump information is
properly collected
Change-Id: Iad4180ed6aba2ef434aa29f2aac587c8d5d4dfcc
Review URL: http://codereview.chromium.org/6557003
diff --git a/client/cros/crash_test.py b/client/cros/crash_test.py
index 774f5bb..069fdde 100644
--- a/client/cros/crash_test.py
+++ b/client/cros/crash_test.py
@@ -17,6 +17,7 @@
_CRASH_SENDER_PATH = '/sbin/crash_sender'
_CRASH_SENDER_RATE_DIR = '/var/lib/crash_sender'
_CRASH_SENDER_RUN_PATH = '/var/run/crash_sender.pid'
+ _CRASH_TEST_IN_PROGRESS = '/tmp/crash-test-in-progress'
_MOCK_CRASH_SENDING = '/tmp/mock-crash-sending'
_PAUSE_FILE = '/var/lib/crash_sender_paused'
_SYSTEM_CRASH_DIR = '/var/spool/crash'
@@ -81,6 +82,14 @@
utils.system('rm -f "%s"' % (self._CONSENT_FILE))
+ def _set_crash_test_in_progress(self, in_progress):
+ if in_progress:
+ utils.open_write_close(self._CRASH_TEST_IN_PROGRESS, 'in-progress')
+ logging.info('Created ' + self._CRASH_TEST_IN_PROGRESS)
+ else:
+ utils.system('rm -f "%s"' % (self._CRASH_TEST_IN_PROGRESS))
+
+
def _get_pushed_consent_file_path(self):
return os.path.join(self.bindir, 'pushed_consent')
@@ -313,6 +322,7 @@
self._leave_crash_sending = True
self._automatic_consent_saving = True
self.enable_crash_filtering('none')
+ self._set_crash_test_in_progress(True)
def cleanup(self):
@@ -323,6 +333,7 @@
if self._automatic_consent_saving:
self._pop_consent()
self.disable_crash_filtering()
+ self._set_crash_test_in_progress(False)
test.test.cleanup(self)