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

Side by Side Diff: client/bin/site_crash_test.py

Issue 5763003: autotest: Test that logs can be sent when processes crash (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: Respond to review Created 10 years 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 | « no previous file | client/site_tests/logging_CrashSender/logging_CrashSender.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging, os, re, shutil 5 import logging, os, re, shutil
6 from autotest_lib.client.bin import site_log_reader, site_utils, test 6 from autotest_lib.client.bin import site_log_reader, site_utils, test
7 from autotest_lib.client.common_lib import error, utils 7 from autotest_lib.client.common_lib import error, utils
8 8
9 9
10 class CrashTest(test.test): 10 class CrashTest(test.test):
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 113
114 def write_crash_dir_entry(self, name, contents): 114 def write_crash_dir_entry(self, name, contents):
115 entry = os.path.join(self._SYSTEM_CRASH_DIR, name) 115 entry = os.path.join(self._SYSTEM_CRASH_DIR, name)
116 if not os.path.exists(self._SYSTEM_CRASH_DIR): 116 if not os.path.exists(self._SYSTEM_CRASH_DIR):
117 os.makedirs(self._SYSTEM_CRASH_DIR) 117 os.makedirs(self._SYSTEM_CRASH_DIR)
118 utils.open_write_close(entry, contents) 118 utils.open_write_close(entry, contents)
119 return entry 119 return entry
120 120
121 121
122 def write_fake_meta(self, name, exec_name, payload, complete=True): 122 def write_fake_meta(self, name, exec_name, payload, log=None,
123 complete=True):
123 last_line = '' 124 last_line = ''
124 if complete: 125 if complete:
125 last_line = 'done=1\n' 126 last_line = 'done=1\n'
126 return self.write_crash_dir_entry(name, 127 contents = ('exec_name=%s\n'
127 'exec_name=%s\n' 128 'ver=my_ver\n'
128 'ver=my_ver\n' 129 'payload=%s\n'
129 'payload=%s\n' 130 '%s' % (exec_name, payload,
130 '%s' % (exec_name, payload, 131 last_line))
131 last_line)) 132 if log:
133 contents = ('log=%s\n' % log) + contents
134 return self.write_crash_dir_entry(name, contents)
132 135
133 136
134 def _prepare_sender_one_crash(self, 137 def _prepare_sender_one_crash(self,
135 send_success, 138 send_success,
136 reports_enabled, 139 reports_enabled,
137 username, 140 username,
138 report): 141 report):
139 self._set_sending_mock(mock_enabled=True, send_success=send_success) 142 self._set_sending_mock(mock_enabled=True, send_success=send_success)
140 self._set_consent(reports_enabled) 143 self._set_consent(reports_enabled)
141 if report is None: 144 if report is None:
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 self._initialize_crash_reporter() 354 self._initialize_crash_reporter()
352 # Disable crash_sender from running, kill off any running ones, but 355 # Disable crash_sender from running, kill off any running ones, but
353 # set environment so crash_sender may run as a child process. 356 # set environment so crash_sender may run as a child process.
354 self._set_system_sending(False) 357 self._set_system_sending(False)
355 self._set_child_sending(True) 358 self._set_child_sending(True)
356 self._kill_running_sender() 359 self._kill_running_sender()
357 self._reset_rate_limiting() 360 self._reset_rate_limiting()
358 if clear_spool_first: 361 if clear_spool_first:
359 self._clear_spooled_crashes() 362 self._clear_spooled_crashes()
360 getattr(self, '_test_' + test_name)() 363 getattr(self, '_test_' + test_name)()
OLDNEW
« no previous file with comments | « no previous file | client/site_tests/logging_CrashSender/logging_CrashSender.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698