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

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 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
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 log_reader
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 'sleep_time': sleep_time, 206 'sleep_time': sleep_time,
205 'output': output} 207 'output': output}
206 208
207 209
208 def wait_for_sender_completion(self): 210 def wait_for_sender_completion(self):
209 """Wait for crash_sender to complete. 211 """Wait for crash_sender to complete.
210 212
211 Wait for no crash_sender's last message to be placed in the 213 Wait for no crash_sender's last message to be placed in the
212 system log before continuing and for the process to finish. 214 system log before continuing and for the process to finish.
213 Otherwise we might get only part of the output.""" 215 Otherwise we might get only part of the output."""
214 site_utils.poll_for_condition( 216 utils.poll_for_condition(
kmixter1 2010/12/16 03:12:57 this is confusing with the utils that's part of co
ericli 2010/12/17 21:48:39 cros_utils would be good. But due the massive numb
215 lambda: self._log_reader.can_find('crash_sender done.'), 217 lambda: self._log_reader.can_find('crash_sender done.'),
216 timeout=60, 218 timeout=60,
217 exception=error.TestError( 219 exception=error.TestError(
218 'Timeout waiting for crash_sender to emit done: ' + 220 'Timeout waiting for crash_sender to emit done: ' +
219 self._log_reader.get_logs())) 221 self._log_reader.get_logs()))
220 site_utils.poll_for_condition( 222 utils.poll_for_condition(
221 lambda: utils.system('pgrep crash_sender', 223 lambda: utils.system('pgrep crash_sender',
222 ignore_status=True) != 0, 224 ignore_status=True) != 0,
223 timeout=60, 225 timeout=60,
224 exception=error.TestError( 226 exception=error.TestError(
225 'Timeout waiting for crash_sender to finish: ' + 227 'Timeout waiting for crash_sender to finish: ' +
226 self._log_reader.get_logs())) 228 self._log_reader.get_logs()))
227 229
228 230
229 def _call_sender_one_crash(self, 231 def _call_sender_one_crash(self,
230 send_success=True, 232 send_success=True,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 def enable_crash_filtering(self, name): 299 def enable_crash_filtering(self, name):
298 self._replace_crash_reporter_filter_in('--filter_in=' + name) 300 self._replace_crash_reporter_filter_in('--filter_in=' + name)
299 301
300 302
301 def disable_crash_filtering(self): 303 def disable_crash_filtering(self):
302 self._replace_crash_reporter_filter_in('') 304 self._replace_crash_reporter_filter_in('')
303 305
304 306
305 def initialize(self): 307 def initialize(self):
306 test.test.initialize(self) 308 test.test.initialize(self)
307 self._log_reader = site_log_reader.LogReader() 309 self._log_reader = log_reader.LogReader()
308 self._leave_crash_sending = True 310 self._leave_crash_sending = True
309 self._automatic_consent_saving = True 311 self._automatic_consent_saving = True
310 self.enable_crash_filtering('none') 312 self.enable_crash_filtering('none')
311 313
312 314
313 def cleanup(self): 315 def cleanup(self):
314 self._reset_rate_limiting() 316 self._reset_rate_limiting()
315 self._clear_spooled_crashes() 317 self._clear_spooled_crashes()
316 self._set_system_sending(self._leave_crash_sending) 318 self._set_system_sending(self._leave_crash_sending)
317 self._set_sending_mock(mock_enabled=False) 319 self._set_sending_mock(mock_enabled=False)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 self._initialize_crash_reporter() 353 self._initialize_crash_reporter()
352 # Disable crash_sender from running, kill off any running ones, but 354 # Disable crash_sender from running, kill off any running ones, but
353 # set environment so crash_sender may run as a child process. 355 # set environment so crash_sender may run as a child process.
354 self._set_system_sending(False) 356 self._set_system_sending(False)
355 self._set_child_sending(True) 357 self._set_child_sending(True)
356 self._kill_running_sender() 358 self._kill_running_sender()
357 self._reset_rate_limiting() 359 self._reset_rate_limiting()
358 if clear_spool_first: 360 if clear_spool_first:
359 self._clear_spooled_crashes() 361 self._clear_spooled_crashes()
360 getattr(self, '_test_' + test_name)() 362 getattr(self, '_test_' + test_name)()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698