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

Unified Diff: client/common_lib/flashrom_util.py

Issue 3343003: Add components which is requried to generate a GBB during factory. (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: fix bugs 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/common_lib/gbb_util.py » ('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 076072c67f420de47022b330c9131aeeb2b0e5d6..2986c68305758b46e9d135ee1d94c83bb0a8479c 100644
--- a/client/common_lib/flashrom_util.py
+++ b/client/common_lib/flashrom_util.py
@@ -488,18 +488,25 @@ class flashrom_util(object):
A short cut to detect_chromeos_layout(TARGET_EC, size, image). """
return self.detect_chromeos_layout(self.TARGET_EC, size, image)
+ def read_whole_to_file(self, output_file):
+ '''
+ Reads whole flash ROM data to a file.
+ Returns True on success, otherwise False.
+ '''
+ cmd = '%s"%s" -r "%s"' % (self.cmd_prefix, self.tool_path,
+ output_file)
+ if self.verbose:
+ print 'flashrom_util.read_whole_to_file(): ', cmd
+ return utils.system(cmd, ignore_status=True) == 0
+
def read_whole(self):
'''
Reads whole flash ROM data.
Returns the data read from flash ROM, or empty string for other error.
'''
- tmpfn = self._get_temp_filename('rd_')
- cmd = '%s"%s" -r "%s"' % (self.cmd_prefix, self.tool_path, tmpfn)
- if self.verbose:
- print 'flashrom_util.read_whole(): ', cmd
result = ''
-
- if utils.system(cmd, ignore_status=True) == 0: # failure for non-zero
+ tmpfn = self._get_temp_filename('rd_')
+ if self.read_whole_to_file(tmpfn):
try:
result = open(tmpfn, 'rb').read()
except IOError:
@@ -895,9 +902,13 @@ class mock_utils(object):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
p.wait()
- if p.returncode and not ignore_status:
- raise TestError("failed to execute: %s\nError messages: %s" % (
- cmd, p.stderr.read()))
+ if p.returncode:
+ err_msg = p.stderr.read()
+ print p.stdout.read()
+ print err_msg
+ if not ignore_status:
+ raise TestError("failed to execute: %s\nError messages: %s" % (
+ cmd, err_msg))
return (p.returncode, p.stdout.read())
def system(self, cmd, ignore_status=False):
« no previous file with comments | « no previous file | client/common_lib/gbb_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698