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

Side by Side Diff: client/cros/crash_test.py

Issue 5740004: Move site_chrome_test, site_logging, site_log_reader, site_crash_test into cros dir. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 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/chrome_test.py ('k') | client/cros/cros_logging.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 import common
7 from autotest_lib.client.common_lib import error, utils 7 import cros_logging
8 from autotest_lib.client.bin import test, utils
9 from autotest_lib.client.common_lib import error
8 10
9 11
10 class CrashTest(test.test): 12 class CrashTest(test.test):
11 13
12 _CONSENT_FILE = '/home/chronos/Consent To Send Stats' 14 _CONSENT_FILE = '/home/chronos/Consent To Send Stats'
13 _CORE_PATTERN = '/proc/sys/kernel/core_pattern' 15 _CORE_PATTERN = '/proc/sys/kernel/core_pattern'
14 _CRASH_REPORTER_PATH = '/sbin/crash_reporter' 16 _CRASH_REPORTER_PATH = '/sbin/crash_reporter'
15 _CRASH_SENDER_PATH = '/sbin/crash_sender' 17 _CRASH_SENDER_PATH = '/sbin/crash_sender'
16 _CRASH_SENDER_RATE_DIR = '/var/lib/crash_sender' 18 _CRASH_SENDER_RATE_DIR = '/var/lib/crash_sender'
17 _CRASH_SENDER_RUN_PATH = '/var/run/crash_sender.pid' 19 _CRASH_SENDER_RUN_PATH = '/var/run/crash_sender.pid'
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 'sleep_time': sleep_time, 209 'sleep_time': sleep_time,
208 'output': output} 210 'output': output}
209 211
210 212
211 def wait_for_sender_completion(self): 213 def wait_for_sender_completion(self):
212 """Wait for crash_sender to complete. 214 """Wait for crash_sender to complete.
213 215
214 Wait for no crash_sender's last message to be placed in the 216 Wait for no crash_sender's last message to be placed in the
215 system log before continuing and for the process to finish. 217 system log before continuing and for the process to finish.
216 Otherwise we might get only part of the output.""" 218 Otherwise we might get only part of the output."""
217 site_utils.poll_for_condition( 219 utils.poll_for_condition(
218 lambda: self._log_reader.can_find('crash_sender done.'), 220 lambda: self._log_reader.can_find('crash_sender done.'),
219 timeout=60, 221 timeout=60,
220 exception=error.TestError( 222 exception=error.TestError(
221 'Timeout waiting for crash_sender to emit done: ' + 223 'Timeout waiting for crash_sender to emit done: ' +
222 self._log_reader.get_logs())) 224 self._log_reader.get_logs()))
223 site_utils.poll_for_condition( 225 utils.poll_for_condition(
224 lambda: utils.system('pgrep crash_sender', 226 lambda: utils.system('pgrep crash_sender',
225 ignore_status=True) != 0, 227 ignore_status=True) != 0,
226 timeout=60, 228 timeout=60,
227 exception=error.TestError( 229 exception=error.TestError(
228 'Timeout waiting for crash_sender to finish: ' + 230 'Timeout waiting for crash_sender to finish: ' +
229 self._log_reader.get_logs())) 231 self._log_reader.get_logs()))
230 232
231 233
232 def _call_sender_one_crash(self, 234 def _call_sender_one_crash(self,
233 send_success=True, 235 send_success=True,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 def enable_crash_filtering(self, name): 302 def enable_crash_filtering(self, name):
301 self._replace_crash_reporter_filter_in('--filter_in=' + name) 303 self._replace_crash_reporter_filter_in('--filter_in=' + name)
302 304
303 305
304 def disable_crash_filtering(self): 306 def disable_crash_filtering(self):
305 self._replace_crash_reporter_filter_in('') 307 self._replace_crash_reporter_filter_in('')
306 308
307 309
308 def initialize(self): 310 def initialize(self):
309 test.test.initialize(self) 311 test.test.initialize(self)
310 self._log_reader = site_log_reader.LogReader() 312 self._log_reader = cros_logging.LogReader()
311 self._leave_crash_sending = True 313 self._leave_crash_sending = True
312 self._automatic_consent_saving = True 314 self._automatic_consent_saving = True
313 self.enable_crash_filtering('none') 315 self.enable_crash_filtering('none')
314 316
315 317
316 def cleanup(self): 318 def cleanup(self):
317 self._reset_rate_limiting() 319 self._reset_rate_limiting()
318 self._clear_spooled_crashes() 320 self._clear_spooled_crashes()
319 self._set_system_sending(self._leave_crash_sending) 321 self._set_system_sending(self._leave_crash_sending)
320 self._set_sending_mock(mock_enabled=False) 322 self._set_sending_mock(mock_enabled=False)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 self._initialize_crash_reporter() 356 self._initialize_crash_reporter()
355 # Disable crash_sender from running, kill off any running ones, but 357 # Disable crash_sender from running, kill off any running ones, but
356 # set environment so crash_sender may run as a child process. 358 # set environment so crash_sender may run as a child process.
357 self._set_system_sending(False) 359 self._set_system_sending(False)
358 self._set_child_sending(True) 360 self._set_child_sending(True)
359 self._kill_running_sender() 361 self._kill_running_sender()
360 self._reset_rate_limiting() 362 self._reset_rate_limiting()
361 if clear_spool_first: 363 if clear_spool_first:
362 self._clear_spooled_crashes() 364 self._clear_spooled_crashes()
363 getattr(self, '_test_' + test_name)() 365 getattr(self, '_test_' + test_name)()
OLDNEW
« no previous file with comments | « client/cros/chrome_test.py ('k') | client/cros/cros_logging.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698