Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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, complete=True) : |
|
petkov
2010/12/13 19:44:09
80 chars
| |
| 123 last_line = '' | 123 last_line = '' |
| 124 if complete: | 124 if complete: |
| 125 last_line = 'done=1\n' | 125 last_line = 'done=1\n' |
| 126 return self.write_crash_dir_entry(name, | 126 contents = ('exec_name=%s\n' |
| 127 'exec_name=%s\n' | 127 'ver=my_ver\n' |
| 128 'ver=my_ver\n' | 128 'payload=%s\n' |
| 129 'payload=%s\n' | 129 '%s' % (exec_name, payload, |
| 130 '%s' % (exec_name, payload, | 130 last_line)) |
| 131 last_line)) | 131 if log: |
| 132 contents = ('log=%s\n' % log) + contents | |
| 133 return self.write_crash_dir_entry(name, contents) | |
| 132 | 134 |
| 133 | 135 |
| 134 def _prepare_sender_one_crash(self, | 136 def _prepare_sender_one_crash(self, |
| 135 send_success, | 137 send_success, |
| 136 reports_enabled, | 138 reports_enabled, |
| 137 username, | 139 username, |
| 138 report): | 140 report): |
| 139 self._set_sending_mock(mock_enabled=True, send_success=send_success) | 141 self._set_sending_mock(mock_enabled=True, send_success=send_success) |
| 140 self._set_consent(reports_enabled) | 142 self._set_consent(reports_enabled) |
| 141 if report is None: | 143 if report is None: |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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)() |
| OLD | NEW |