OLD | NEW |
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 os | 5 import os |
6 | 6 |
7 from autotest_lib.client.bin import factory, test, utils | 7 from autotest_lib.client.bin import factory, test, utils |
8 from autotest_lib.client.common_lib import error | 8 from autotest_lib.client.common_lib import error |
9 from autotest_lib.client.common_lib import flashrom_util | 9 from autotest_lib.client.common_lib import flashrom_util |
10 from autotest_lib.client.common_lib import site_gpio | 10 from autotest_lib.client.cros import gpio |
11 | 11 |
12 | 12 |
13 class hardware_EepromWriteProtect(test.test): | 13 class hardware_EepromWriteProtect(test.test): |
14 """ | 14 """ |
15 Autotest for EEPROM Write Protection status | 15 Autotest for EEPROM Write Protection status |
16 | 16 |
17 WARNING: DO NOT INTERRUPT THIS TEST OTHERWISE YOUR FLASHROM MAY BE CORRUPTED | 17 WARNING: DO NOT INTERRUPT THIS TEST OTHERWISE YOUR FLASHROM MAY BE CORRUPTED |
18 | 18 |
19 NOTE: This test only verifies write-protection status. | 19 NOTE: This test only verifies write-protection status. |
20 If you want to enable write protection, run factory_EnableWriteProtect. | 20 If you want to enable write protection, run factory_EnableWriteProtect. |
21 """ | 21 """ |
22 version = 2 | 22 version = 2 |
23 verbose = True | 23 verbose = True |
24 | 24 |
25 def setup(self): | 25 def setup(self): |
26 """ autotest setup procedure """ | 26 """ autotest setup procedure """ |
27 self.flashrom = flashrom_util.flashrom_util(verbose=self.verbose) | 27 self.flashrom = flashrom_util.flashrom_util(verbose=self.verbose) |
28 self.gpio = site_gpio.Gpio(error.TestError) | 28 self.gpio = gpio.Gpio(error.TestError) |
29 | 29 |
30 def check_gpio_write_protection(self): | 30 def check_gpio_write_protection(self): |
31 try: | 31 try: |
32 status_val = self.gpio.read('write_protect') | 32 status_val = self.gpio.read('write_protect') |
33 except: | 33 except: |
34 raise error.TestFail('Cannot read GPIO Write Protection status.') | 34 raise error.TestFail('Cannot read GPIO Write Protection status.') |
35 if status_val != 1: | 35 if status_val != 1: |
36 raise error.TestFail('GPIO Write Protection is not enabled') | 36 raise error.TestFail('GPIO Write Protection is not enabled') |
37 | 37 |
38 def check_write_protection(self, layout_map, write_list, expected, | 38 def check_write_protection(self, layout_map, write_list, expected, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 (conf['name'], ','.join(rw_list))) | 204 (conf['name'], ','.join(rw_list))) |
205 self.check_write_protection(layout_map, rw_list, True, original) | 205 self.check_write_protection(layout_map, rw_list, True, original) |
206 | 206 |
207 # restore default selection. | 207 # restore default selection. |
208 if not self.flashrom.select_target(system_default_selection): | 208 if not self.flashrom.select_target(system_default_selection): |
209 raise error.TestError('ERROR: cannot restore target.') | 209 raise error.TestError('ERROR: cannot restore target.') |
210 | 210 |
211 | 211 |
212 if __name__ == "__main__": | 212 if __name__ == "__main__": |
213 print "please run this program with autotest." | 213 print "please run this program with autotest." |
OLD | NEW |