| 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 glob, hashlib, logging, os, pprint, re, sys | 5 import glob, hashlib, logging, os, pprint, re, sys | 
| 6 from autotest_lib.client.bin import factory | 6 from autotest_lib.client.bin import factory | 
| 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 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 gbb_util | 10 from autotest_lib.client.common_lib import gbb_util | 
| 11 from autotest_lib.client.common_lib import site_vblock | 11 from autotest_lib.client.common_lib import site_vblock | 
| 12 | 12 | 
| 13 | 13 | 
| 14 class hardware_Components(test.test): | 14 class hardware_Components(test.test): | 
| 15     version = 1 | 15     version = 1 | 
| 16     _cids = [ | 16     _cids = [ | 
|  | 17         'data_display_geometry', | 
| 17         'hash_ro_firmware', | 18         'hash_ro_firmware', | 
| 18         'part_id_audio_codec', | 19         'part_id_audio_codec', | 
| 19         'part_id_cpu', | 20         'part_id_cpu', | 
| 20         'part_id_display_panel', | 21         'part_id_display_panel', | 
| 21         'part_id_embedded_controller', | 22         'part_id_embedded_controller', | 
| 22         'part_id_ethernet', | 23         'part_id_ethernet', | 
| 23         'part_id_flash_chip', | 24         'part_id_flash_chip', | 
| 24         'part_id_hwqual', | 25         'part_id_hwqual', | 
| 25         'part_id_storage', | 26         'part_id_storage', | 
| 26         'part_id_wireless', | 27         'part_id_wireless', | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 39         'part_id_3g', | 40         'part_id_3g', | 
| 40         'part_id_gps', | 41         'part_id_gps', | 
| 41     ] | 42     ] | 
| 42     _check_existence_cids = [ | 43     _check_existence_cids = [ | 
| 43         'key_recovery', | 44         'key_recovery', | 
| 44         'key_root', | 45         'key_root', | 
| 45         'part_id_chrontel', | 46         'part_id_chrontel', | 
| 46     ] | 47     ] | 
| 47     _non_check_cids = [ | 48     _non_check_cids = [ | 
| 48         'data_bitmap_fv', | 49         'data_bitmap_fv', | 
| 49         'data_display_geometry', |  | 
| 50         'data_recovery_url', | 50         'data_recovery_url', | 
| 51     ] | 51     ] | 
| 52     _not_present = 'Not Present' | 52     _not_present = 'Not Present' | 
| 53 | 53 | 
| 54 | 54 | 
| 55     def check_component(self, comp_key, comp_id): | 55     def check_component(self, comp_key, comp_ids): | 
| 56         if comp_key in self._ignored: | 56         if comp_key in self._ignored: | 
| 57             return | 57             return | 
| 58 | 58 | 
| 59         self._system[comp_key] = [ comp_id ] | 59         if not isinstance(comp_ids, list): | 
|  | 60             comp_ids = [ comp_ids ] | 
|  | 61         self._system[comp_key] = comp_ids | 
| 60 | 62 | 
| 61         if not self._approved.has_key(comp_key): | 63         if not self._approved.has_key(comp_key): | 
| 62             raise error.TestFail('%s missing from database' % comp_key) | 64             raise error.TestFail('%s missing from database' % comp_key) | 
| 63 | 65 | 
| 64         app_cids = self._approved[comp_key] | 66         app_cids = self._approved[comp_key] | 
| 65 | 67 | 
| 66         if '*' in app_cids: | 68         if '*' in app_cids: | 
| 67             return | 69             return | 
| 68 | 70 | 
| 69         if not comp_id in app_cids: | 71         for comp_id in comp_ids: | 
| 70             self._failures[comp_key] = [ comp_id ] | 72             if not comp_id in app_cids: | 
|  | 73                 if comp_key in self._failures: | 
|  | 74                     self._failures[comp_key].append(comp_id) | 
|  | 75                 else: | 
|  | 76                     self._failures[comp_key] = [ comp_id ] | 
| 71 | 77 | 
| 72 | 78 | 
| 73     def check_approved_part_id_existence(self, cid, type): | 79     def check_approved_part_id_existence(self, cid, type): | 
| 74         """ | 80         """ | 
| 75         Check if there are matching devices on the system. | 81         Check if there are matching devices on the system. | 
| 76         Parameter type should be one of 'pci', 'usb', or 'others'. | 82         Parameter type should be one of 'pci', 'usb', or 'others'. | 
| 77         """ | 83         """ | 
| 78         if cid in self._ignored: | 84         if cid in self._ignored: | 
| 79             return | 85             return | 
| 80 | 86 | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 132             probe_cmd = 'ch7036_monitor -p' | 138             probe_cmd = 'ch7036_monitor -p' | 
| 133             present = (utils.system(probe_cmd, ignore_status=True) == 0) | 139             present = (utils.system(probe_cmd, ignore_status=True) == 0) | 
| 134 | 140 | 
| 135             if not i2c_loaded: | 141             if not i2c_loaded: | 
| 136                 utils.system('modprobe -r i2c_dev') | 142                 utils.system('modprobe -r i2c_dev') | 
| 137             return present | 143             return present | 
| 138 | 144 | 
| 139         return False | 145         return False | 
| 140 | 146 | 
| 141 | 147 | 
|  | 148     def get_data_display_geometry(self): | 
|  | 149         cmd = ('get-edid | parse-edid | grep "Mode " | ' | 
|  | 150                'sed \'s/^.*"\(.*\)".*$/\\1/\'') | 
|  | 151         data = utils.system_output(cmd).split() | 
|  | 152         if not data: | 
|  | 153             data = [ '' ] | 
|  | 154         return data | 
|  | 155 | 
|  | 156 | 
| 142     def get_part_id_audio_codec(self): | 157     def get_part_id_audio_codec(self): | 
| 143         cmd = 'grep -R Codec: /proc/asound/* | head -n 1 | sed s/.\*Codec://' | 158         cmd = 'grep -R Codec: /proc/asound/* | head -n 1 | sed s/.\*Codec://' | 
| 144         part_id = utils.system_output(cmd).strip() | 159         part_id = utils.system_output(cmd).strip() | 
| 145         return part_id | 160         return part_id | 
| 146 | 161 | 
| 147 | 162 | 
| 148     def get_part_id_cpu(self): | 163     def get_part_id_cpu(self): | 
| 149         cmd = 'grep -m 1 \'model name\' /proc/cpuinfo | sed s/.\*://' | 164         cmd = 'grep -m 1 \'model name\' /proc/cpuinfo | sed s/.\*://' | 
| 150         part_id = utils.system_output(cmd).strip() | 165         part_id = utils.system_output(cmd).strip() | 
| 151         return part_id | 166         return part_id | 
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 375                 cids_need_to_be_record = ['part_id_hwqual'] | 390                 cids_need_to_be_record = ['part_id_hwqual'] | 
| 376                 for cid in cids_need_to_be_record: | 391                 for cid in cids_need_to_be_record: | 
| 377                     factory.log_shared_data(cid, self._approved[cid][0]) | 392                     factory.log_shared_data(cid, self._approved[cid][0]) | 
| 378                 return | 393                 return | 
| 379 | 394 | 
| 380         if only_cardreader_failed: | 395         if only_cardreader_failed: | 
| 381             all_failures = ('You may forget to insert an SD card.\n' + | 396             all_failures = ('You may forget to insert an SD card.\n' + | 
| 382                             all_failures) | 397                             all_failures) | 
| 383 | 398 | 
| 384         raise error.TestFail(all_failures) | 399         raise error.TestFail(all_failures) | 
| OLD | NEW | 
|---|