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 | 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): |
11 | 11 |
12 _CONSENT_FILE = '/home/chronos/Consent To Send Stats' | 12 _CONSENT_FILE = '/home/chronos/Consent To Send Stats' |
13 _CORE_PATTERN = '/proc/sys/kernel/core_pattern' | 13 _CORE_PATTERN = '/proc/sys/kernel/core_pattern' |
14 _CRASH_REPORTER_PATH = '/sbin/crash_reporter' | 14 _CRASH_REPORTER_PATH = '/sbin/crash_reporter' |
15 _CRASH_SENDER_PATH = '/sbin/crash_sender' | 15 _CRASH_SENDER_PATH = '/sbin/crash_sender' |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 else: | 78 else: |
79 utils.system('rm -f "%s"' % (self._CONSENT_FILE)) | 79 utils.system('rm -f "%s"' % (self._CONSENT_FILE)) |
80 | 80 |
81 | 81 |
82 def _get_pushed_consent_file_path(self): | 82 def _get_pushed_consent_file_path(self): |
83 return os.path.join(self.bindir, 'pushed_consent') | 83 return os.path.join(self.bindir, 'pushed_consent') |
84 | 84 |
85 | 85 |
86 def _push_consent(self): | 86 def _push_consent(self): |
87 if os.path.exists(self._CONSENT_FILE): | 87 if os.path.exists(self._CONSENT_FILE): |
88 os.rename(self._CONSENT_FILE, self._get_pushed_consent_file_path()) | 88 shutil.move(self._CONSENT_FILE, |
| 89 self._get_pushed_consent_file_path()) |
89 | 90 |
90 | 91 |
91 def _pop_consent(self): | 92 def _pop_consent(self): |
92 self._set_consent(False) | 93 self._set_consent(False) |
93 if os.path.exists(self._get_pushed_consent_file_path()): | 94 if os.path.exists(self._get_pushed_consent_file_path()): |
94 os.rename(self._get_pushed_consent_file_path(), self._CONSENT_FILE) | 95 shutil.move(self._get_pushed_consent_file_path(), |
| 96 self._CONSENT_FILE) |
95 | 97 |
96 | 98 |
97 def _get_crash_dir(self, username): | 99 def _get_crash_dir(self, username): |
98 if username == 'chronos': | 100 if username == 'chronos': |
99 return self._USER_CRASH_DIR | 101 return self._USER_CRASH_DIR |
100 else: | 102 else: |
101 return self._SYSTEM_CRASH_DIR | 103 return self._SYSTEM_CRASH_DIR |
102 | 104 |
103 | 105 |
104 def _initialize_crash_reporter(self): | 106 def _initialize_crash_reporter(self): |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 self._initialize_crash_reporter() | 351 self._initialize_crash_reporter() |
350 # Disable crash_sender from running, kill off any running ones, but | 352 # Disable crash_sender from running, kill off any running ones, but |
351 # set environment so crash_sender may run as a child process. | 353 # set environment so crash_sender may run as a child process. |
352 self._set_system_sending(False) | 354 self._set_system_sending(False) |
353 self._set_child_sending(True) | 355 self._set_child_sending(True) |
354 self._kill_running_sender() | 356 self._kill_running_sender() |
355 self._reset_rate_limiting() | 357 self._reset_rate_limiting() |
356 if clear_spool_first: | 358 if clear_spool_first: |
357 self._clear_spooled_crashes() | 359 self._clear_spooled_crashes() |
358 getattr(self, '_test_' + test_name)() | 360 getattr(self, '_test_' + test_name)() |
OLD | NEW |