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>
diff --git a/chromiumos_image_diff.py b/chromiumos_image_diff.py
index 82e4e17..74906d3 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 @@
         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 @@
     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 @@
       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 @@
     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 @@
 
   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 @@
     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 @@
               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}\"" '