[autotest] Ensure we grab crash dumps at end of tests
In the event that one of the client tests falls over hard enough that the
device reboots, ABORTing the test in the middle, we still want to enable
autotest to go get any crash dumps that might have been left.
use the get_site_crashdumps() hook to enable this.
BUG=chromium-os:22694
TEST=while run_remote_tests.sh LoginSuccess against some machine, ssh in and send SIGKILL to chrome and reboot the machine. The test harness should wait for a while, time out, and then do some work. You should see messages like "23:41:14 INFO | Collecting /var/spool/crash/chrome.20111110.153745.2243.core..."
Change-Id: I9ba4f01dba7fe500e411e8167b8697804f8938b8
Reviewed-on: https://gerrit.chromium.org/gerrit/11514
Tested-by: Chris Masone <[email protected]>
Reviewed-by: Scott Zawalski <[email protected]>
Commit-Ready: Chris Masone <[email protected]>
diff --git a/server/site_crashcollect.py b/server/site_crashcollect.py
index eaea360..19a9400 100644
--- a/server/site_crashcollect.py
+++ b/server/site_crashcollect.py
@@ -5,6 +5,7 @@
import logging
import os
from autotest_lib.client.common_lib import utils as client_utils
+from autotest_lib.client.cros import constants
from autotest_lib.server import utils
def generate_minidump_stacktrace(minidump_path):
@@ -25,7 +26,7 @@
return rc
-def find_and_generate_minidump_stacktraces(host):
+def find_and_generate_minidump_stacktraces(host_resultdir):
"""
Finds all minidump files and generates a stack trace for each.
@@ -34,7 +35,6 @@
identified as files with .dmp extension. The stack trace filename is
composed by appending the .txt extension to the minidump filename.
"""
- host_resultdir = getattr(getattr(host, "job", None), "resultdir", None)
for dir, subdirs, files in os.walk(host_resultdir):
for file in files:
if not file.endswith('.dmp'):
@@ -49,5 +49,20 @@
'dump %s (rc=%d)' % (minidump, rc))
+def fetch_orphaned_crashdumps(host, host_resultdir):
+ for file in host.list_files_glob(os.path.join(constants.CRASH_DIR, '*')):
+ logging.info("Collecting %s...", file)
+ try:
+ host.get_file(file, host_resultdir, preserve_perm=False)
+ except Exception as e:
+ logging.warning("Collection of %s failed:\n%s", file, e)
+
+
+
def get_site_crashdumps(host, test_start_time):
- find_and_generate_minidump_stacktraces(host)
+ host_resultdir = getattr(getattr(host, "job", None), "resultdir", None)
+ infodir = os.path.join(host_resultdir, "crashinfo.%s" % host.hostname)
+ if not os.path.exists(infodir):
+ os.mkdir(infodir)
+ fetch_orphaned_crashdumps(host, infodir)
+ find_and_generate_minidump_stacktraces(host_resultdir)