diff options
author | cmtice <cmtice@google.com> | 2014-12-16 11:09:59 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-16 21:42:34 +0000 |
commit | e12e5b2688f00fdecd11290a738022becf4272dd (patch) | |
tree | ce24aac2b71207fada1ee27dfff0a29a1c97cab9 /crosperf | |
parent | a68062289c9b2592dffd79ec76b2b0dd121db12a (diff) | |
download | toolchain-utils-e12e5b2688f00fdecd11290a738022becf4272dd.tar.gz |
New script to tell if machines are 'identical' for crosperf.
This script calls the functions in machine_manager.py and
verifies that two or more machines are 'identical' for the purposes
of running crosperf. I have several times needed to do this type
of thing, so I decided to extract the functionality into its own
script.
BUG=None
TEST=Tested in my directory.
Change-Id: I2a410eefe7e1b46f6c5cad477640ea7974a614c7
Reviewed-on: https://chrome-internal-review.googlesource.com/188197
Reviewed-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Caroline Tice <cmtice@google.com>
Commit-Queue: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'crosperf')
-rw-r--r-- | crosperf/compare_machines.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/crosperf/compare_machines.py b/crosperf/compare_machines.py new file mode 100644 index 00000000..a6be0c6f --- /dev/null +++ b/crosperf/compare_machines.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +# Copyright 2014 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. + +import os.path +import sys +import argparse + +from machine_manager import CrosMachine + +def PrintUsage (msg): + print msg + print "Usage: " + print ("\n compare_machines.py --chromeos_root=/path/to/chroot/ " + "machine1 machine2 ...") + + +def Main (argv): + + parser = argparse.ArgumentParser() + parser.add_argument("--chromeos_root", default="/path/to/chromeos", + dest="chromeos_root", + help="ChromeOS root checkout directory") + parser.add_argument("remotes", nargs=argparse.REMAINDER) + + options = parser.parse_args(argv) + + false_arg = True + machine_list = options.remotes + if len(machine_list) < 2: + PrintUsage("ERROR: Must specify at least two machines.") + return 1 + elif not os.path.exists(options.chromeos_root): + PrintUsage("Error: chromeos_root does not exist %s" % + options.chromeos_root) + return 1 + + chroot = options.chromeos_root + cros_machines = [] + test_machine_checksum = None + for m in machine_list: + cm = CrosMachine(m, chroot, 'average') + cros_machines = cros_machines + [ cm ] + test_machine_checksum = cm.machine_checksum + + retval = 0 + for cm in cros_machines: + print "checksum for %s : %s" % (cm.name, cm.machine_checksum) + if cm.machine_checksum != test_machine_checksum: + retval = 1 + print "Machine checksums do not all match" + + if retval == 0: + print "Machines all match." + + return retval + + +if __name__ == '__main__': + retval = Main(sys.argv[1:]) + sys.exit(retval) + |