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 import time |
7 | 7 |
8 from autotest_lib.client.bin import factory | 8 from autotest_lib.client.bin import factory |
9 from autotest_lib.client.bin import factory_ui_lib as ful | 9 from autotest_lib.client.bin import factory_ui_lib as ful |
10 from autotest_lib.client.bin import test, utils | 10 from autotest_lib.client.bin import test, utils |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if not self.job.run_test('hardware_EepromWriteProtect'): | 61 if not self.job.run_test('hardware_EepromWriteProtect'): |
62 raise error.TestFail('Flashrom write protection test failed.') | 62 raise error.TestFail('Flashrom write protection test failed.') |
63 | 63 |
64 def check_google_required_tests(self, do_check, status_file, test_list): | 64 def check_google_required_tests(self, do_check, status_file, test_list): |
65 """ Checks if all previous and Google Required Tests are passed. """ | 65 """ Checks if all previous and Google Required Tests are passed. """ |
66 if not do_check: | 66 if not do_check: |
67 self.alert_bypassed('REQUIRED TESTS') | 67 self.alert_bypassed('REQUIRED TESTS') |
68 return | 68 return |
69 | 69 |
70 # check if all previous tests are passed. | 70 # check if all previous tests are passed. |
71 status_map = factory.StatusMap(test_list, status_file) | 71 db = factory.TestDatabase(test_list) |
72 db = status_map.test_db | 72 status_map = factory.StatusMap(test_list, status_file, db) |
73 failed_list = status_map.filter(ful.FAILED) | 73 failed_list = status_map.filter(ful.FAILED) |
74 if failed_list: | 74 if failed_list: |
75 failed = ','.join([db.get_unique_details(t) for t in failed_list]) | 75 failed = ','.join([db.get_unique_id_str(t) for t in failed_list]) |
76 raise error.TestFail('Some previous tests failed: %s' % | 76 raise error.TestFail('Some previous tests failed: %s' % failed) |
77 failed) | |
78 | 77 |
79 # check if all Google Required Tests are passed | 78 # check if all Google Required Tests are passed |
80 missing = [] | 79 missing = [] |
81 for g in GOOGLE_REQUIRED_TESTS: | 80 for g in GOOGLE_REQUIRED_TESTS: |
82 t = db.get_test_by_unique_name(g) | 81 t = db.get_test_by_unique_name(g) |
83 if status_map.lookup_status(t) != ful.PASSED: | 82 if status_map.lookup_status(t) != ful.PASSED: |
84 missing.append('%s(%s)' % (g, db.get_unique_details(t))) | 83 missing.append('%s(%s)' % (g, db.get_unique_id_str(t))) |
85 if missing: | 84 if missing: |
86 missing_msg = ', '.join(missing) | 85 missing_msg = ', '.join(missing) |
87 raise error.TestFail('You need to execute following ' + | 86 raise error.TestFail('You need to execute following ' + |
88 'Google Required Tests: %s' % missing_msg) | 87 'Google Required Tests: %s' % missing_msg) |
89 | 88 |
90 def run_once(self, | 89 def run_once(self, |
91 check_required_tests=True, | 90 check_required_tests=True, |
92 check_developer_switch=True, | 91 check_developer_switch=True, |
93 check_and_enable_write_protect=True, | 92 check_and_enable_write_protect=True, |
94 status_file_path=None, | 93 status_file_path=None, |
95 test_list=None): | 94 test_list=None): |
96 | 95 |
97 # apply each final tests | 96 # apply each final tests |
98 self.check_google_required_tests(check_required_tests, | 97 self.check_google_required_tests(check_required_tests, |
99 status_file_path, | 98 status_file_path, |
100 test_list) | 99 test_list) |
101 self.check_developer_switch(check_developer_switch) | 100 self.check_developer_switch(check_developer_switch) |
102 self.check_flashrom_write_protect(check_and_enable_write_protect) | 101 self.check_flashrom_write_protect(check_and_enable_write_protect) |
OLD | NEW |