diff options
author | Luis Lozano <llozano@chromium.org> | 2015-12-10 10:47:01 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-12-15 01:21:49 +0000 |
commit | 036c9233742004aa773a374df381b1cf137484f5 (patch) | |
tree | b1566971ae12ed6ec13f086dd450eca741604f26 /chromiumos_image_diff.py | |
parent | e627fd61c2edba668eb2af8221892286b13f05a3 (diff) | |
download | toolchain-utils-036c9233742004aa773a374df381b1cf137484f5.tar.gz |
crosperf: RunCommand should return one type of object.
Cleaned up the interfaces for the RunCommand routines.
These were returning different types (int or tuple) depending on
the value of the return_ouput parameter.
Returning different unrelated types from a routine is bad practice.
Linter complains about this with several warnings like this:
"Attempting to unpack a non-sequence defined at line XY of
utils.command_executer"
BUG=chromium:566256
TEST=ran crosperf with a example experiment file
Ran run_tests.
Change-Id: Ibb83ab9322c87558077fc4937ef5c0686bbe5417
Reviewed-on: https://chrome-internal-review.googlesource.com/241459
Commit-Ready: Luis Lozano <llozano@chromium.org>
Tested-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Han Shen <shenhan@google.com>
Diffstat (limited to 'chromiumos_image_diff.py')
-rwxr-xr-x | chromiumos_image_diff.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/chromiumos_image_diff.py b/chromiumos_image_diff.py index 6b455829..7d9b5e34 100755 --- a/chromiumos_image_diff.py +++ b/chromiumos_image_diff.py @@ -63,8 +63,7 @@ class CrosImage(object): self.CreateUnmountScript() command = image_chromeos.GetImageMountCommand( self.chromeos_root, self.image, self.rootfs, self.stateful) - rv = self._ce.RunCommand( - command, return_output=False, print_to_console=True) + rv = self._ce.RunCommand(command, print_to_console=True) self.mounted = (rv == 0) if not self.mounted: self.logger.LogError('Failed to mount "{0}" onto "{1}" and "{2}".'.format( @@ -79,7 +78,7 @@ class CrosImage(object): f.write(command) f.close() self._ce.RunCommand('chmod +x {}'.format(self.unmount_script), - print_to_console=False, return_output=False) + print_to_console=False) self.logger.LogOutput('Created an unmount script - "{0}"'.format( self.unmount_script)) @@ -94,8 +93,7 @@ class CrosImage(object): self.logger.LogOutput(('Please unmount manually - \n' '\t bash "{0}"'.format(self.unmount_script))) else: - if self._ce.RunCommand( - command, return_output=False, print_to_console=True) == 0: + if self._ce.RunCommand(command, print_to_console=True) == 0: self._ce.RunCommand('rm {0}'.format(self.unmount_script)) self.mounted = False self.rootfs = None @@ -118,8 +116,7 @@ class CrosImage(object): 'bash -c \'file -b "{{}}" | grep -q "ELF"\'' r' \; ' r'-exec echo "{{}}" \;').format(self.rootfs) self.logger.LogCmd(command) - _, out, _ = self._ce.RunCommand( - command, return_output=True, print_to_console=False) + _, out, _ = self._ce.RunCommandWOutput(command, print_to_console=False) self.elf_files = out.splitlines() self.logger.LogOutput( 'Total {0} elf files found.'.format(len(self.elf_files))) @@ -212,8 +209,7 @@ class ImageComparator(object): f1=full_path1, f2=full_path2, rootfs1=i1.rootfs, rootfs2=i2.rootfs, tempf1=self.tempf1, tempf2=self.tempf2) - ret = cmde.RunCommand(command, return_output=False, - print_to_console=False) + ret = cmde.RunCommand(command, print_to_console=False) if ret != 0: self.logger.LogOutput('*** Not match - "{0}" "{1}"'.format( full_path1, full_path2)) @@ -225,7 +221,7 @@ class ImageComparator(object): '>> {diff_file}').format( f1=full_path1, f2=full_path2, diff_file=self.diff_file, tempf1=self.tempf1, tempf2=self.tempf2) - cmde.RunCommand(command, return_output=False, print_to_console=False) + cmde.RunCommand(command, print_to_console=False) else: match_count += 1 ## End of comparing every elf files. |