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

Unified Diff: client/common_lib/flashrom_util.py

Issue 3493016: Add EC hash in hardware_Components database (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: change field ordering by alphabet 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/site_tests/hardware_Components/approved_components » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/common_lib/flashrom_util.py
diff --git a/client/common_lib/flashrom_util.py b/client/common_lib/flashrom_util.py
index 8d0d54519e8e9d899d4bb7585b4736a1b009de2e..6c9be3032d2d53d6fd878aba265486ee10f2ef57 100644
--- a/client/common_lib/flashrom_util.py
+++ b/client/common_lib/flashrom_util.py
@@ -786,17 +786,11 @@ class FlashromUtility(object):
data)
return self.image_copy(section, section, new_image)
- def verify_sections(self, from_list, to_list, from_image, to_image):
+ def get_verification_image(self, from_image, pad_value=chr(0)):
"""
- Compares if sections in from_list and to_list are the same, skipping
- by self.skip_verify description.
-
- If from_list and to_list are both empty list ([]), compare whole image
+ Returns an image derived from from_image with "skip verification"
+ regions padded by pad_value.
"""
- # simplify arguments and local variables
- from_list = csv_to_list(from_list)
- to_list = csv_to_list(to_list)
- flashrom = self.flashrom
layout = self.layout
# decode skip_verify with layout, and then modify images
@@ -805,15 +799,31 @@ class FlashromUtility(object):
name = name.strip()
offset = int(offset.strip(), 0)
size = int(size.strip(), 0)
- assert name in layout, "(verify_sec) Unknown section name: " + name
+ assert name in layout, "(make_verify) Unknown section name: " + name
if self.is_debug:
print " ** skipping range: %s +%d [%d]" % (name, offset, size)
# XXX we use the layout's internal structure here...
offset = layout[name][0] + offset
- from_image = from_image[:offset] + (chr(0)*size) + \
+ from_image = from_image[:offset] + (pad_value * size) + \
from_image[(offset + size):]
- to_image = to_image[:offset] + (chr(0) * size) + \
- to_image[(offset + size):]
+ return from_image
+
+ def verify_sections(self, from_list, to_list, from_image, to_image):
+ """
+ Compares if sections in from_list and to_list are the same, skipping
+ by self.skip_verify description.
+
+ If from_list and to_list are both empty list ([]), compare whole image
+ """
+ # simplify arguments and local variables
+ from_list = csv_to_list(from_list)
+ to_list = csv_to_list(to_list)
+ flashrom = self.flashrom
+
+ # prepare verification image
+ if self.skip_verify:
+ from_image = self.get_verification_image(from_image)
+ to_image = self.get_verification_image(to_image)
# compare sections in image
if not (from_list or to_list):
« no previous file with comments | « no previous file | client/site_tests/hardware_Components/approved_components » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698