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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/cros/crash_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # 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
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging
6 import os
7 from autotest_lib.client.common_lib import utils as client_utils
8 from autotest_lib.server import utils
9
10 def generate_minidump_stacktrace(minidump_path):
11 """
12 Generates a stacktrace for the specified minidump.
13
14 This function expects the debug symbols to reside under:
15 /build/<board>/usr/lib/debug
16 """
17 symbol_dir = '%s/../../../lib/debug' % utils.get_server_dir()
18 logging.info('symbol_dir: %s' % symbol_dir)
19 result = client_utils.run('minidump_stackwalk %s %s > %s.txt' %
20 (minidump_path, symbol_dir, minidump_path))
21 return result.exit_status
22
23
24 def find_and_generate_minidump_stacktraces(host):
25 """
26 Finds all minidump files and generates a stack trace for each.
27
28 Enumerates all files under the test results directory (recursively)
29 and generates a stack trace file for the minidumps. Minidump files are
30 identified as files with .dmp extension. The stack trace filename is
31 composed by appending the .txt extension to the minidump filename.
32 """
33 host_resultdir = getattr(getattr(host, "job", None), "resultdir", None)
34 for dir, subdirs, files in os.walk(host_resultdir):
35 for file in files:
36 if not file.endswith('.dmp'):
37 continue
38 minidump = os.path.join(dir, file)
39 rc = generate_minidump_stacktrace(minidump)
40 if rc == 0:
41 logging.info('Generated stack trace for dump %s' %
42 minidump)
43 else:
44 logging.error('Failed to generate stack trace for ' \
45 'dump %s (rc=%d)' % (minidump, rc))
46
47
48 def get_site_crashdumps(host, test_start_time):
49 find_and_generate_minidump_stacktraces(host)
OLDNEW
« 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