OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # | 2 # |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 # DESCRIPTION : | 8 # DESCRIPTION : |
9 # | 9 # |
10 # This is a factory test to test external SD and USB ports. | 10 # This is a factory test to test external SD and USB ports. |
(...skipping 21 matching lines...) Expand all Loading... |
32 _TESTING_FMT_STR = lambda t:'testing %s...\n%s 檢查當中...' % (t, t) | 32 _TESTING_FMT_STR = lambda t:'testing %s...\n%s 檢查當中...' % (t, t) |
33 _ERR_TOO_MANY_REMOVE_FMT_STR = \ | 33 _ERR_TOO_MANY_REMOVE_FMT_STR = \ |
34 lambda target_dev, removed_dev: \ | 34 lambda target_dev, removed_dev: \ |
35 'Too many device removed (%s). Please only remove %s.\n' \ | 35 'Too many device removed (%s). Please only remove %s.\n' \ |
36 '有太多外部儲存裝置被移除 (%s),請只移除 %s 即可\n' % \ | 36 '有太多外部儲存裝置被移除 (%s),請只移除 %s 即可\n' % \ |
37 (removed_dev, target_dev, removed_dev, target_dev) | 37 (removed_dev, target_dev, removed_dev, target_dev) |
38 _ERR_DEV_NOT_REMOVE_FMT_STR = \ | 38 _ERR_DEV_NOT_REMOVE_FMT_STR = \ |
39 lambda t: 'Please remove %s.\n請移除 %s\n' % (t, t) | 39 lambda t: 'Please remove %s.\n請移除 %s\n' % (t, t) |
40 | 40 |
41 def find_root_dev(): | 41 def find_root_dev(): |
42 rootdev = utils.system_output('rootdev') | 42 rootdev = utils.system_output('rootdev -s -d') |
43 return os.path.basename(rootdev[:-1]) | 43 return os.path.basename(rootdev) |
44 | 44 |
45 | 45 |
46 def find_all_storage_dev(): | 46 def find_all_storage_dev(): |
47 lssys = utils.run('ls -d /sys/block/sd*') | 47 lssys = utils.run('ls -d /sys/block/sd*') |
48 devices = lssys.stdout.rsplit('\n') | 48 devices = lssys.stdout.rsplit('\n') |
49 new_devices = set(os.path.basename(d.rstrip()) for d in devices if d) | 49 new_devices = set(os.path.basename(d.rstrip()) for d in devices if d) |
50 return new_devices | 50 return new_devices |
51 | 51 |
52 | 52 |
53 class factory_ExternalStorage(test.test): | 53 class factory_ExternalStorage(test.test): |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 test_widget = gtk.EventBox() | 147 test_widget = gtk.EventBox() |
148 test_widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black')) | 148 test_widget.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black')) |
149 test_widget.add(vbox) | 149 test_widget.add(vbox) |
150 | 150 |
151 ful.run_test_widget(self.job, test_widget) | 151 ful.run_test_widget(self.job, test_widget) |
152 | 152 |
153 if self._error: | 153 if self._error: |
154 raise error.TestFail(self._error) | 154 raise error.TestFail(self._error) |
155 | 155 |
156 factory.log('%s run_once finished' % self.__class__) | 156 factory.log('%s run_once finished' % self.__class__) |
OLD | NEW |