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

Side by Side Diff: client/site_tests/logging_LogVolume/logging_LogVolume.py

Issue 1565001: test: Clean up site_login.py a bit. (Closed)
Patch Set: update one more call to attempt_logout() Created 10 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
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, subprocess, utils 5 import logging, os, re, subprocess, utils
6 from autotest_lib.client.bin import site_login, site_ui_test, test 6 from autotest_lib.client.bin import site_login, site_ui_test, test
7 from autotest_lib.client.common_lib import error 7 from autotest_lib.client.common_lib import error
8 8
9 9
10 class logging_LogVolume(site_ui_test.UITest): 10 class logging_LogVolume(site_ui_test.UITest):
11 version = 1 11 version = 1
12 12
13 13
14 def log_stateful_used(self): 14 def log_stateful_used(self):
15 output = utils.system_output('df /mnt/stateful_partition/') 15 output = utils.system_output('df /mnt/stateful_partition/')
16 matches = re.search('(\d+)%', output) 16 matches = re.search('(\d+)%', output)
17 if matches is None: 17 if matches is None:
18 error.TestError('df failed') 18 error.TestError('df failed')
19 self._perf['percent_stateful_used'] = int(matches.group(1)) 19 self._perf['percent_stateful_used'] = int(matches.group(1))
20 20
21 21
22 def run_once(self): 22 def run_once(self):
23 if not site_login.wait_for_cryptohome(): 23 site_login.wait_for_cryptohome()
24 raise error.TestFail('Could not wait for crytohome')
25 24
26 self._perf = {} 25 self._perf = {}
27 self.log_stateful_used() 26 self.log_stateful_used()
28 whitelist = open(os.path.join(self.bindir, 27 whitelist = open(os.path.join(self.bindir,
29 'stateful_whitelist.txt')) 28 'stateful_whitelist.txt'))
30 patterns = {} 29 patterns = {}
31 for pattern in whitelist.readlines(): 30 for pattern in whitelist.readlines():
32 pattern = pattern.strip() 31 pattern = pattern.strip()
33 if pattern == '' or pattern[0] == '#': 32 if pattern == '' or pattern[0] == '#':
34 continue 33 continue
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 self._perf['percent_unused_patterns'] = \ 69 self._perf['percent_unused_patterns'] = \
71 int(100 * unmatched_patterns / len(patterns)) 70 int(100 * unmatched_patterns / len(patterns))
72 71
73 self._perf['files_in_stateful_partition'] = stateful_files 72 self._perf['files_in_stateful_partition'] = stateful_files
74 73
75 self.write_perf_keyval(self._perf) 74 self.write_perf_keyval(self._perf)
76 75
77 if unexpected_files > 0: 76 if unexpected_files > 0:
78 raise error.TestError('There were %d unexpected files' % 77 raise error.TestError('There were %d unexpected files' %
79 unexpected_files) 78 unexpected_files)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698