Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: client/site_tests/hardware_Components/hardware_Components.py

Issue 3333024: Change the path of qualified DBs in factory tests. (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | client/site_tests/hardware_Components/qualified_components_x86-generic » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if present: 103 if present:
104 self._system[cid] = [ device ] 104 self._system[cid] = [ device ]
105 return 105 return
106 106
107 self._failures[cid] = [ 'No match' ] 107 self._failures[cid] = [ 'No match' ]
108 108
109 109
110 def check_existence_key_recovery(self, part_id): 110 def check_existence_key_recovery(self, part_id):
111 current_key = self._gbb.get_recoverykey() 111 current_key = self._gbb.get_recoverykey()
112 target_key = utils.read_file(part_id) 112 target_key = utils.read_file(part_id)
113 return current_key == target_key 113 return current_key.startswith(target_key)
114 114
115 115
116 def check_existence_key_root(self, part_id): 116 def check_existence_key_root(self, part_id):
117 current_key = self._gbb.get_rootkey() 117 current_key = self._gbb.get_rootkey()
118 target_key = utils.read_file(part_id) 118 target_key = utils.read_file(part_id)
119 return current_key == target_key 119 return current_key.startswith(target_key)
120 120
121 121
122 def check_existence_part_id_chrontel(self, part_id): 122 def check_existence_part_id_chrontel(self, part_id):
123 if part_id == self._not_present: 123 if part_id == self._not_present:
124 return True 124 return True
125 125
126 if part_id == 'ch7036': 126 if part_id == 'ch7036':
127 grep_cmd = 'grep i2c_dev /proc/modules' 127 grep_cmd = 'grep i2c_dev /proc/modules'
128 i2c_loaded = (utils.system(grep_cmd, ignore_status=True) == 0) 128 i2c_loaded = (utils.system(grep_cmd, ignore_status=True) == 0)
129 if not i2c_loaded: 129 if not i2c_loaded:
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 def run_once(self, approved_dbs='approved_components', ignored_cids=[], 325 def run_once(self, approved_dbs='approved_components', ignored_cids=[],
326 shared_dict={}): 326 shared_dict={}):
327 self._ignored = ignored_cids 327 self._ignored = ignored_cids
328 only_cardreader_failed = False 328 only_cardreader_failed = False
329 all_failures = 'The following components are not matched.\n' 329 all_failures = 'The following components are not matched.\n'
330 os.chdir(self.bindir) 330 os.chdir(self.bindir)
331 331
332 # If found the HwQual ID in shared_dict, use the list with the same ID. 332 # If found the HwQual ID in shared_dict, use the list with the same ID.
333 if 'part_id_hwqual' in shared_dict: 333 if 'part_id_hwqual' in shared_dict:
334 id = shared_dict['part_id_hwqual'] 334 id = shared_dict['part_id_hwqual'].replace(' ', '_')
335 id = id.rpartition(' ')[0].replace(' ', '_') 335 approved_dbs = 'data_*/components_%s' % id
336 approved_dbs = 'qualified_components*%s' % id
337 336
338 # approved_dbs supports shell-like filename expansion. 337 # approved_dbs supports shell-like filename expansion.
339 for db in glob.iglob(approved_dbs): 338 existing_dbs = glob.glob(approved_dbs)
339 if not existing_dbs:
340 raise error.TestError('Unable to find approved db: %s' %
341 approved_dbs)
342
343 for db in existing_dbs:
340 self._system = {} 344 self._system = {}
341 self._failures = {} 345 self._failures = {}
342
343 if not os.path.exists(db):
344 raise error.TestError('Unable to find approved db: %s' % db)
345
346 self._approved = eval(utils.read_file(db)) 346 self._approved = eval(utils.read_file(db))
347 logging.debug('Approved DB: %s', self.pformat(self._approved)) 347 logging.debug('Approved DB: %s', self.pformat(self._approved))
348 348
349 for cid in self._cids: 349 for cid in self._cids:
350 self.check_component(cid, self.force_get_property('get_' + cid)) 350 self.check_component(cid, self.force_get_property('get_' + cid))
351 351
352 for cid in self._pci_cids: 352 for cid in self._pci_cids:
353 self.check_approved_part_id_existence(cid, type='pci') 353 self.check_approved_part_id_existence(cid, type='pci')
354 354
355 for cid in self._usb_cids: 355 for cid in self._usb_cids:
(...skipping 17 matching lines...) Expand all
373 cids_need_to_be_record = ['part_id_hwqual'] 373 cids_need_to_be_record = ['part_id_hwqual']
374 for cid in cids_need_to_be_record: 374 for cid in cids_need_to_be_record:
375 factory.log_shared_data(cid, self._approved[cid][0]) 375 factory.log_shared_data(cid, self._approved[cid][0])
376 return 376 return
377 377
378 if only_cardreader_failed: 378 if only_cardreader_failed:
379 all_failures = ('You may forget to insert an SD card.\n' + 379 all_failures = ('You may forget to insert an SD card.\n' +
380 all_failures) 380 all_failures)
381 381
382 raise error.TestFail(all_failures) 382 raise error.TestFail(all_failures)
OLDNEW
« no previous file with comments | « no previous file | client/site_tests/hardware_Components/qualified_components_x86-generic » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698