aboutsummaryrefslogtreecommitdiff
path: root/chromiumos_image_diff.py
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@google.com>2019-04-26 11:30:14 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-28 01:00:33 -0700
commit1d1de43048ee7d945232d85df46e2c496552be7e (patch)
treeb51d056e99475b29275d2f98ce091719f9300200 /chromiumos_image_diff.py
parent3663e85d9af7420c7d2afc2e50f41287938bdf0c (diff)
downloadtoolchain-utils-1d1de43048ee7d945232d85df46e2c496552be7e.tar.gz
crosperf: Reboot dut even if checksums match.
We have seen problems where if machine has the image preinstalled but the machine has been ON for a long time, the reports can be bizzare. So lets reboot the machine before the experiments. BUG=chromium:957149 TEST=verified that machine reboots with image preinstalled. Change-Id: I32af330700f9b60801c365cb20ac54b304a82c3a Reviewed-on: https://chromium-review.googlesource.com/1585616 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'chromiumos_image_diff.py')
-rwxr-xr-xchromiumos_image_diff.py38
1 files changed, 22 insertions, 16 deletions
diff --git a/chromiumos_image_diff.py b/chromiumos_image_diff.py
index 82e4e17d..74906d32 100755
--- a/chromiumos_image_diff.py
+++ b/chromiumos_image_diff.py
@@ -1,4 +1,10 @@
#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+#
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
"""Diff 2 chromiumos images by comparing each elf file.
The script diffs every *ELF* files by dissembling every *executable*
@@ -66,8 +72,8 @@ class CrosImage(object):
self.image, self.rootfs, self.stateful))
## First of all creating an unmount image
self.CreateUnmountScript()
- command = image_chromeos.GetImageMountCommand(
- self.chromeos_root, self.image, self.rootfs, self.stateful)
+ command = image_chromeos.GetImageMountCommand(self.image, self.rootfs,
+ self.stateful)
rv = self._ce.RunCommand(command, print_to_console=True)
self.mounted = (rv == 0)
if not self.mounted:
@@ -85,8 +91,8 @@ class CrosImage(object):
f.close()
self._ce.RunCommand(
'chmod +x {}'.format(self.unmount_script), print_to_console=False)
- self.logger.LogOutput(
- 'Created an unmount script - "{0}"'.format(self.unmount_script))
+ self.logger.LogOutput('Created an unmount script - "{0}"'.format(
+ self.unmount_script))
def UnmountImage(self):
"""Unmount the image and delete mount point."""
@@ -115,8 +121,8 @@ class CrosImage(object):
Always true
"""
- self.logger.LogOutput(
- 'Finding all elf files in "{0}" ...'.format(self.rootfs))
+ self.logger.LogOutput('Finding all elf files in "{0}" ...'.format(
+ self.rootfs))
# Note '\;' must be prefixed by 'r'.
command = ('find "{0}" -type f -exec '
'bash -c \'file -b "{{}}" | grep -q "ELF"\''
@@ -125,8 +131,8 @@ class CrosImage(object):
self.logger.LogCmd(command)
_, 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)))
+ self.logger.LogOutput('Total {0} elf files found.'.format(
+ len(self.elf_files)))
return True
@@ -142,10 +148,10 @@ class ImageComparator(object):
def Cleanup(self):
if self.tempf1 and self.tempf2:
- command_executer.GetCommandExecuter().RunCommand(
- 'rm {0} {1}'.format(self.tempf1, self.tempf2))
- logger.GetLogger(
- 'Removed "{0}" and "{1}".'.format(self.tempf1, self.tempf2))
+ command_executer.GetCommandExecuter().RunCommand('rm {0} {1}'.format(
+ self.tempf1, self.tempf2))
+ logger.GetLogger('Removed "{0}" and "{1}".'.format(
+ self.tempf1, self.tempf2))
def CheckElfFileSetEquality(self):
"""Checking whether images have exactly number of elf files."""
@@ -185,8 +191,8 @@ class ImageComparator(object):
match_count = 0
i1 = self.images[0]
i2 = self.images[1]
- self.logger.LogOutput(
- 'Start comparing {0} elf file by file ...'.format(len(i1.elf_files)))
+ self.logger.LogOutput('Start comparing {0} elf file by file ...'.format(
+ len(i1.elf_files)))
## Note - i1.elf_files and i2.elf_files have exactly the same entries here.
## Create 2 temp files to be used for all disassembed files.
@@ -222,8 +228,8 @@ class ImageComparator(object):
tempf2=self.tempf2)
ret = cmde.RunCommand(command, print_to_console=False)
if ret != 0:
- self.logger.LogOutput(
- '*** Not match - "{0}" "{1}"'.format(full_path1, full_path2))
+ self.logger.LogOutput('*** Not match - "{0}" "{1}"'.format(
+ full_path1, full_path2))
mismatch_list.append(f1)
if self.diff_file:
command = ('echo "Diffs of disassemble of \"{f1}\" and \"{f2}\"" '