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

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

Issue 5041001: Fix cross-device link errors by using shutil.move instead of os.rename (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: Created 10 years, 1 month 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 | no next file » | 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 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
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
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)()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698