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

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

Issue 3209001: Make cardreader mis-matched a special case to prompt error. (Closed) Base URL: http://src.chromium.org/git/autotest.git
Patch Set: Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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 5 import glob, hashlib, logging, os, pprint, re
6 from autotest_lib.client.bin import test, utils 6 from autotest_lib.client.bin import test, utils
7 from autotest_lib.client.common_lib import error 7 from autotest_lib.client.common_lib import error
8 from autotest_lib.client.common_lib import flashrom_util 8 from autotest_lib.client.common_lib import flashrom_util
9 from autotest_lib.client.common_lib import site_vblock 9 from autotest_lib.client.common_lib import site_vblock
10 10
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 def pformat(self, obj): 286 def pformat(self, obj):
287 return "\n" + self._pp.pformat(obj) + "\n" 287 return "\n" + self._pp.pformat(obj) + "\n"
288 288
289 289
290 def initialize(self): 290 def initialize(self):
291 self._pp = pprint.PrettyPrinter() 291 self._pp = pprint.PrettyPrinter()
292 292
293 293
294 def run_once(self, approved_dbs='approved_components', ignored_cids=[]): 294 def run_once(self, approved_dbs='approved_components', ignored_cids=[]):
295 self._ignored = ignored_cids 295 self._ignored = ignored_cids
296 all_failures = '' 296 only_cardreader_failed = False
297 all_failures = 'The following components are not matched.\n'
297 os.chdir(self.bindir) 298 os.chdir(self.bindir)
298 299
299 # approved_dbs supports shell-like filename expansion. 300 # approved_dbs supports shell-like filename expansion.
300 for db in glob.iglob(approved_dbs): 301 for db in glob.iglob(approved_dbs):
301 self._system = {} 302 self._system = {}
302 self._failures = {} 303 self._failures = {}
303 304
304 if not os.path.exists(db): 305 if not os.path.exists(db):
305 raise error.TestError('Unable to find approved db: %s' % db) 306 raise error.TestError('Unable to find approved db: %s' % db)
306 307
(...skipping 11 matching lines...) Expand all
318 319
319 for cid in self._check_existence_cids: 320 for cid in self._check_existence_cids:
320 self.check_approved_part_id_existence(cid, type='others') 321 self.check_approved_part_id_existence(cid, type='others')
321 322
322 logging.debug('System: %s', self.pformat(self._system)) 323 logging.debug('System: %s', self.pformat(self._system))
323 324
324 outdb = os.path.join(self.resultsdir, 'system_components') 325 outdb = os.path.join(self.resultsdir, 'system_components')
325 utils.open_write_close(outdb, self.pformat(self._system)) 326 utils.open_write_close(outdb, self.pformat(self._system))
326 327
327 if self._failures: 328 if self._failures:
328 all_failures += 'Approved DB: %s' % db 329 if self._failures.keys() == ['part_id_cardreader']:
330 only_cardreader_failed = True
331 all_failures += 'For DB %s:' % db
329 all_failures += self.pformat(self._failures) 332 all_failures += self.pformat(self._failures)
330 else: 333 else:
331 # If one of DBs is matched, record the hwqual_id and exit. 334 # If one of DBs is matched, record the hwqual_id and exit.
332 self.write_test_keyval( 335 self.write_test_keyval(
333 {'hwqual_id': self._approved['part_id_hwqual'][0]}) 336 {'hwqual_id': self._approved['part_id_hwqual'][0]})
334 return 337 return
335 338
339 if only_cardreader_failed:
340 all_failures = ('You may forget to insert an SD card.\n' +
341 all_failures)
342
336 raise error.TestFail(all_failures) 343 raise error.TestFail(all_failures)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698