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

Unified Diff: client/site_tests/hardware_Components/hardware_Components.py

Issue 3108050: Make hardware_Components test work on legacy BIOS (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: modify according to reviewer's suggestion 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/hardware_Components/hardware_Components.py
diff --git a/client/site_tests/hardware_Components/hardware_Components.py b/client/site_tests/hardware_Components/hardware_Components.py
index e6ae5dfde01656077425fe0da1017d428548388f..8574e0b79e62e7e2c724b233ab3781218f30d1e0 100644
--- a/client/site_tests/hardware_Components/hardware_Components.py
+++ b/client/site_tests/hardware_Components/hardware_Components.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import glob, hashlib, logging, os, pprint, re
+import glob, hashlib, logging, os, pprint, re, sys
from autotest_lib.client.bin import test, utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import flashrom_util
@@ -283,6 +283,20 @@ class hardware_Components(test.test):
return '%d' % (versions[0])
+ def force_get_property(self, property_name):
+ """ Returns property value or empty string on error. """
+ try:
+ return getattr(self, property_name)()
+ except error.TestError as e:
+ logging.error("Test error in getting property %s", property_name,
+ exc_info=1)
+ return ''
+ except:
+ logging.error("Exception getting property %s", property_name,
+ exc_info=1)
+ return ''
+
+
def pformat(self, obj):
return "\n" + self._pp.pformat(obj) + "\n"
@@ -308,7 +322,7 @@ class hardware_Components(test.test):
logging.debug('Approved DB: %s', self.pformat(self._approved))
for cid in self._cids:
- self.check_component(cid, getattr(self, 'get_' + cid)())
+ self.check_component(cid, self.force_get_property('get_' + cid))
for cid in self._pci_cids:
self.check_approved_part_id_existence(cid, type='pci')
« 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