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 import time |
6 | 7 |
7 from autotest_lib.client.bin import factory | 8 from autotest_lib.client.bin import factory |
8 from autotest_lib.client.bin import factory_ui_lib as ful | 9 from autotest_lib.client.bin import factory_ui_lib as ful |
9 from autotest_lib.client.bin import test, utils | 10 from autotest_lib.client.bin import test, utils |
10 from autotest_lib.client.common_lib import error | 11 from autotest_lib.client.common_lib import error |
11 | 12 |
12 | 13 |
13 GPIO_ROOT = '/home/gpio' | 14 GPIO_ROOT = '/home/gpio' |
14 GOOGLE_REQUIRED_TESTS = [ 'hardware_Components', 'hardware_DeveloperRecovery' ] | 15 GOOGLE_REQUIRED_TESTS = [ 'hardware_Components', 'hardware_DeveloperRecovery' ] |
15 | 16 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 # and all bits in RW is writable. | 75 # and all bits in RW is writable. |
75 factory.log('verify write protect (hardware_EepromWriteProtect)') | 76 factory.log('verify write protect (hardware_EepromWriteProtect)') |
76 if not self.job.run_test('hardware_EepromWriteProtect'): | 77 if not self.job.run_test('hardware_EepromWriteProtect'): |
77 raise error.TestFail('Flashrom write protection test failed.') | 78 raise error.TestFail('Flashrom write protection test failed.') |
78 | 79 |
79 def run_once(self, | 80 def run_once(self, |
80 secure_wipe, | 81 secure_wipe, |
81 write_protect=True, | 82 write_protect=True, |
82 check_developer_switch=True, | 83 check_developer_switch=True, |
83 status_file_path=None, | 84 status_file_path=None, |
84 test_list=None): | 85 test_list=None, |
85 # first, check if all previous tests are passed. | 86 force_skip_required_test_check=False): |
86 status_map = ful.StatusMap(status_file_path, test_list) | |
87 failed = status_map.filter(ful.FAILED) | |
88 if failed: | |
89 raise error.TestFail('Some tests were failed. Cannot start wipe.') | |
90 | 87 |
91 # check if all Google Required Tests are passed | 88 if force_skip_required_test_check: |
92 passed = [t.formal_name for t in status_map.filter(ful.PASSED)] | 89 # alert user what he is doing |
93 if not set(GOOGLE_REQUIRED_TESTS).issubset(passed): | 90 alert_seconds = 3 |
94 missing = list(set(GOOGLE_REQUIRED_TESTS).difference(passed)) | 91 for i in range(alert_seconds): |
95 raise error.TestFail('You need to execute following Google Required' | 92 factory.log('WARNING: REQUIRED TEST CHECK IS BYPASSED. ' + |
96 ' Tests: %s' % (','.join(missing))) | 93 'THIS DEVICE CANNOT BE QUALIFIED.') |
| 94 factory.log("Waiting %d seconds before test start." % alert_seconds) |
| 95 for i in range(alert_seconds, 0, -1): |
| 96 factory.log(">> wipe test will start in %d seconds..." % i) |
| 97 time.sleep(1) |
| 98 else: |
| 99 # first, check if all previous tests are passed. |
| 100 status_map = ful.StatusMap(status_file_path, test_list) |
| 101 failed = status_map.filter(ful.FAILED) |
| 102 if failed: |
| 103 raise error.TestFail('Some tests were failed. ' + |
| 104 'Cannot start wipe.') |
| 105 |
| 106 # check if all Google Required Tests are passed |
| 107 passed = [t.formal_name for t in status_map.filter(ful.PASSED)] |
| 108 if not set(GOOGLE_REQUIRED_TESTS).issubset(passed): |
| 109 missing = list(set(GOOGLE_REQUIRED_TESTS).difference(passed)) |
| 110 raise error.TestFail('You need to execute following ' + |
| 111 'Google Required Tests: %s' % |
| 112 (','.join(missing))) |
97 | 113 |
98 # apply each final tests | 114 # apply each final tests |
99 self.check_developer_switch(check_developer_switch) | 115 self.check_developer_switch(check_developer_switch) |
100 self.flashrom_write_protect(write_protect) | 116 self.flashrom_write_protect(write_protect) |
101 self.wipe_stateful_partition(secure_wipe) | 117 self.wipe_stateful_partition(secure_wipe) |
OLD | NEW |