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

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

Issue 6880182: Ensure crashes are copied out before cryptohome is wiped. (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 8 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 | « 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) 2011 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2011 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 dbus, logging, os, re, shutil, socket, sys 5 import dbus, logging, os, re, shutil, socket, sys
6 import common 6 import common
7 import auth_server, constants, cryptohome, dns_server 7 import auth_server, constants, cryptohome, dns_server
8 import cros_logging, cros_ui, login, ownership 8 import cros_logging, cros_ui, login, ownership
9 from autotest_lib.client.bin import test, utils 9 from autotest_lib.client.bin import test, utils
10 from autotest_lib.client.common_lib import error 10 from autotest_lib.client.common_lib import error
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 logging.debug("Considering " + interface) 82 logging.debug("Considering " + interface)
83 for path in properties['IPConfigs']: 83 for path in properties['IPConfigs']:
84 ipconfig = self._flim.GetObjectInterface('IPConfig', path) 84 ipconfig = self._flim.GetObjectInterface('IPConfig', path)
85 85
86 servers = ipconfig.GetProperties().get('NameServers', None) 86 servers = ipconfig.GetProperties().get('NameServers', None)
87 if servers != None: 87 if servers != None:
88 self._dns[path] = ','.join(servers) 88 self._dns[path] = ','.join(servers)
89 logging.debug("Stored %s for %s" % (self._dns[path], 89 logging.debug("Stored %s for %s" % (self._dns[path],
90 interface)) 90 interface))
91 ipconfig.SetProperty('NameServers', '127.0.0.1') 91 ipconfig.SetProperty('NameServers', '127.0.0.1')
92 logging.debug("Using local DNS for " + interface) 92 logging.debug("Using local DNS for " + interface)
93 93
94 utils.poll_for_condition( 94 utils.poll_for_condition(
95 lambda: self.__attempt_resolve('www.google.com', '127.0.0.1'), 95 lambda: self.__attempt_resolve('www.google.com', '127.0.0.1'),
96 login.TimeoutError('Timed out waiting for DNS changes.'), 96 login.TimeoutError('Timed out waiting for DNS changes.'),
97 10) 97 10)
98 98
99 99
100 def revert_dns(self): 100 def revert_dns(self):
101 """Clear the custom DNS setting for all devices and force them to use 101 """Clear the custom DNS setting for all devices and force them to use
102 DHCP to pull the network's real settings again. 102 DHCP to pull the network's real settings again.
103 """ 103 """
104 for device in self._flim.GetObjectList('Device'): 104 for device in self._flim.GetObjectList('Device'):
105 properties = device.GetProperties() 105 properties = device.GetProperties()
106 interface = properties['Interface'] 106 interface = properties['Interface']
107 logging.debug("Considering " + interface) 107 logging.debug("Considering " + interface)
108 for path in properties['IPConfigs']: 108 for path in properties['IPConfigs']:
109 if path in self._dns: 109 if path in self._dns:
110 ipconfig = self._flim.GetObjectInterface('IPConfig', path) 110 ipconfig = self._flim.GetObjectInterface('IPConfig', path)
111 ipconfig.SetProperty('NameServers', self._dns[path]) 111 ipconfig.SetProperty('NameServers', self._dns[path])
112 logging.debug("Reverted DNS for " + interface) 112 logging.debug("Reverted DNS for " + interface)
113 else: 113 else:
114 logging.debug("No stored DNS for " + interface) 114 logging.debug("No stored DNS for " + interface)
115 115
116 utils.poll_for_condition( 116 utils.poll_for_condition(
117 lambda: self.__attempt_resolve('www.google.com', 117 lambda: self.__attempt_resolve('www.google.com',
118 '127.0.0.1', 118 '127.0.0.1',
119 expected=False), 119 expected=False),
120 login.TimeoutError('Timed out waiting to revert DNS.'), 120 login.TimeoutError('Timed out waiting to revert DNS.'),
121 10) 121 10)
122 122
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 filename)) 362 filename))
363 363
364 except (IOError, OSError) as err: 364 except (IOError, OSError) as err:
365 logging.error(err) 365 logging.error(err)
366 366
367 if login.logged_in(): 367 if login.logged_in():
368 try: 368 try:
369 shutil.copy( 369 shutil.copy(
370 os.path.join(constants.CRYPTOHOME_MOUNT_PT, 370 os.path.join(constants.CRYPTOHOME_MOUNT_PT,
371 'log', 'chrome'), 371 'log', 'chrome'),
372 self.resultsdir+'/chrome_postlogin_log') 372 os.path.join(self.resultsdir, 'chrome_postlogin_log'))
373 # Retrieve any cores left by crashes during testing.
374 shutil.copytree(
375 os.path.join(constants.CRYPTOHOME_MOUNT_PT, 'crash'),
376 os.path.join(self.resultsdir, 'crashes'))
373 except (IOError, OSError) as err: 377 except (IOError, OSError) as err:
374 logging.error(err) 378 logging.error(err)
375 self.logout() 379 self.logout()
376 380
377 if os.path.isfile(constants.CRYPTOHOMED_LOG): 381 if os.path.isfile(constants.CRYPTOHOMED_LOG):
378 try: 382 try:
379 base = os.path.basename(constants.CRYPTOHOMED_LOG) 383 base = os.path.basename(constants.CRYPTOHOMED_LOG)
380 shutil.copy(constants.CRYPTOHOMED_LOG, 384 shutil.copy(constants.CRYPTOHOMED_LOG,
381 os.path.join(self.resultsdir, base)) 385 os.path.join(self.resultsdir, base))
382 except (IOError, OSError) as err: 386 except (IOError, OSError) as err:
383 logging.error(err) 387 logging.error(err)
384 388
385 if self.fake_owner: 389 if self.fake_owner:
386 logging.info('Erasing fake owner state.') 390 logging.info('Erasing fake owner state.')
387 ownership.clear_ownership() 391 ownership.clear_ownership()
388 392
389 self.stop_authserver() 393 self.stop_authserver()
390 self.__log_crashed_processes(self.crash_blacklist) 394 self.__log_crashed_processes(self.crash_blacklist)
391 395
392 396
393 def get_auth_endpoint_misses(self): 397 def get_auth_endpoint_misses(self):
394 if hasattr(self, '_authServer'): 398 if hasattr(self, '_authServer'):
395 return self._authServer.get_endpoint_misses() 399 return self._authServer.get_endpoint_misses()
396 else: 400 else:
397 return {} 401 return {}
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