Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1504)

Unified Diff: server/site_crashcollect.py

Issue 6557003: Modify autotest to support preserving minidumps generated during tests. (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: Addressed code review feedbacks. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/cros/crash_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/site_crashcollect.py
diff --git a/server/site_crashcollect.py b/server/site_crashcollect.py
new file mode 100644
index 0000000000000000000000000000000000000000..428d1e133f6b9ac5639b268ce2617b8e9b83d894
--- /dev/null
+++ b/server/site_crashcollect.py
@@ -0,0 +1,49 @@
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
kmixter1 2011/03/03 01:49:54 Can we name this differently? "crash_collector" is
thieule 2011/03/03 02:22:45 Unfortunately, the name is dictated by autotest in
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging
+import os
+from autotest_lib.client.common_lib import utils as client_utils
+from autotest_lib.server import utils
+
+def generate_minidump_stacktrace(minidump_path):
+ """
+ Generates a stacktrace for the specified minidump.
+
+ This function expects the debug symbols to reside under:
+ /build/<board>/usr/lib/debug
+ """
+ symbol_dir = '%s/../../../lib/debug' % utils.get_server_dir()
+ logging.info('symbol_dir: %s' % symbol_dir)
+ result = client_utils.run('minidump_stackwalk %s %s > %s.txt' %
+ (minidump_path, symbol_dir, minidump_path))
+ return result.exit_status
+
+
+def find_and_generate_minidump_stacktraces(host):
+ """
+ Finds all minidump files and generates a stack trace for each.
+
+ Enumerates all files under the test results directory (recursively)
+ and generates a stack trace file for the minidumps. Minidump files are
+ 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'):
+ continue
+ minidump = os.path.join(dir, file)
+ rc = generate_minidump_stacktrace(minidump)
+ if rc == 0:
+ logging.info('Generated stack trace for dump %s' %
+ minidump)
+ else:
+ logging.error('Failed to generate stack trace for ' \
+ 'dump %s (rc=%d)' % (minidump, rc))
+
+
+def get_site_crashdumps(host, test_start_time):
+ find_and_generate_minidump_stacktraces(host)
« no previous file with comments | « client/cros/crash_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698