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

Unified Diff: server/site_server_job.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: 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
« server/server_job.py ('K') | « server/server_job.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/site_server_job.py
diff --git a/server/site_server_job.py b/server/site_server_job.py
new file mode 100644
index 0000000000000000000000000000000000000000..69fcfd30e1eb5afaa6504ef730dae622e680e4a7
--- /dev/null
+++ b/server/site_server_job.py
@@ -0,0 +1,53 @@
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# 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
+from autotest_lib.server.server_job import base_server_job
+
+
+class site_server_job(base_server_job):
kmixter1 2011/02/23 02:00:39 Will this be used by all server tests automaticall
thieule 2011/03/03 01:27:41 Yes.
+
+ def _generate_minidump_stacktrace(self, minidump_path):
+ symbol_dir = '%s/../../../lib/debug' % utils.get_server_dir()
kmixter1 2011/02/23 02:00:39 I guess this only works for tests autotests run wi
thieule 2011/03/03 01:27:41 Done.
+ 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(self):
+ for dir, subdirs, files in os.walk(self.resultdir):
+ for file in files:
+ if not file.endswith('.dmp'):
+ continue
+ minidump = os.path.join(dir, file)
+ rc = self._generate_minidump_stacktrace(minidump)
+ if (rc == 0):
kmixter1 2011/02/23 02:00:39 extra parens?
thieule 2011/03/03 01:27:41 Done.
+ 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 run(self, cleanup=False, install_before=False, install_after=False,
+ collect_crashdumps=True, namespace={}, control=None,
+ control_file_dir=None, only_collect_crashinfo=False):
+ """
+ Site specific implementation of base_server_job.run().
+
+ Override the base class implementation so we can perform some
+ of our own operations when the server job is completed.
+
+ See base_server_job.run() for more info.
+ """
+ try:
+ base_server_job.run(self, cleanup, install_before, install_after,
+ collect_crashdumps, namespace, control,
+ control_file_dir, only_collect_crashinfo)
+ finally:
+ self._find_and_generate_minidump_stacktraces()
ericli 2011/02/23 04:49:34 There is already a try/finally block inside base_s
thieule 2011/03/03 01:27:41 Done. I've moved the minidump generation to site_
« server/server_job.py ('K') | « server/server_job.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698