OLD | NEW |
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 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 |
6 | 6 |
7 from autotest_lib.client.bin import test, utils | 7 from autotest_lib.client.bin import test, utils |
8 from autotest_lib.client.common_lib import error | 8 from autotest_lib.client.common_lib import error |
9 | 9 |
10 class hardware_StorageFio(test.test): | 10 class hardware_StorageFio(test.test): |
(...skipping 20 matching lines...) Expand all Loading... |
31 utils.make(make='%s %s make' % (var_ldflags, var_cflags)) | 31 utils.make(make='%s %s make' % (var_ldflags, var_cflags)) |
32 | 32 |
33 | 33 |
34 def __find_free_root_partition(self): | 34 def __find_free_root_partition(self): |
35 """Locate the spare root partition that we didn't boot off""" | 35 """Locate the spare root partition that we didn't boot off""" |
36 | 36 |
37 spare_root_map = { | 37 spare_root_map = { |
38 '3': '5', | 38 '3': '5', |
39 '5': '3', | 39 '5': '3', |
40 } | 40 } |
41 rootdev = utils.system_output('rootdev') | 41 rootdev = utils.system_output('rootdev -s') |
42 spare_root = rootdev[:-1] + spare_root_map[rootdev[-1]] | 42 spare_root = rootdev[:-1] + spare_root_map[rootdev[-1]] |
43 self.__filename = spare_root | 43 self.__filename = spare_root |
44 | 44 |
45 | 45 |
46 def __get_file_size(self): | 46 def __get_file_size(self): |
47 """Return the size in bytes of the device pointed to by __filename""" | 47 """Return the size in bytes of the device pointed to by __filename""" |
48 | 48 |
49 device = os.path.basename(self.__filename) | 49 device = os.path.basename(self.__filename) |
50 for line in file('/proc/partitions'): | 50 for line in file('/proc/partitions'): |
51 try: | 51 try: |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 results[units + '_' + test] = result[metric] | 200 results[units + '_' + test] = result[metric] |
201 | 201 |
202 # Output keys relevent to the performance, larger filesize will run | 202 # Output keys relevent to the performance, larger filesize will run |
203 # slower, and sda5 should be slightly slower than sda3 on a rotational | 203 # slower, and sda5 should be slightly slower than sda3 on a rotational |
204 # disk | 204 # disk |
205 self.write_test_keyval({'filesize': self.__filesize, | 205 self.write_test_keyval({'filesize': self.__filesize, |
206 'filename': self.__filename, | 206 'filename': self.__filename, |
207 'device': self.__description}) | 207 'device': self.__description}) |
208 logging.info('Device Description: %s' % self.__description) | 208 logging.info('Device Description: %s' % self.__description) |
209 self.write_perf_keyval(results) | 209 self.write_perf_keyval(results) |
OLD | NEW |