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

Unified Diff: tools/tests/factory_configuration/verify_mapping.py

Issue 14517004: Change Builder Names, MkIII (Closed) Base URL: http://skia.googlecode.com/svn/buildbot/
Patch Set: Created 7 years, 8 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
Index: tools/tests/factory_configuration/verify_mapping.py
===================================================================
--- tools/tests/factory_configuration/verify_mapping.py (revision 0)
+++ tools/tests/factory_configuration/verify_mapping.py (revision 0)
@@ -0,0 +1,53 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+""" Runs a series of tests on a mapping file. """
+
+
+import json
+import os
+import sys
+
+
+EXPECTED_DIR = os.path.join(os.path.dirname(__file__), 'expected')
+
+
+def VerifyMapping(old_name, new_name, slaves_cfg, mapping):
+ try:
+ assert os.path.isfile(os.path.join(EXPECTED_DIR, old_name))
+ if old_name.endswith('Trybot'):
+ assert new_name.endswith('Trybot')
+ else:
+ assert new_name in slaves_cfg
+
+ # Assert no duplicate values
+ match_count = 0
+ for val in mapping.itervalues():
+ if val == new_name:
+ match_count += 1
+ assert match_count == 1
+
+ # ADD YOUR ASSERTIONS HERE
+
+ except Exception:
+ print 'Failed assertion for (%s to %s)' % (old_name, new_name)
+ raise
+
+
+def main(argv):
+ if len(argv) != 2:
+ raise Exception('Invalid arguments given; you must provide a mapping file.')
+ with open(argv[1]) as f:
+ mapping = json.load(f)
+
+ slaves_cfg_file = os.path.join('master', 'slaves.cfg')
+ with open(slaves_cfg_file) as f:
+ slaves_cfg = f.read()
+
+ for old_name, new_name in mapping.iteritems():
+ VerifyMapping(old_name, new_name, slaves_cfg, mapping)
+
+
+if '__main__' == __name__:
+ sys.exit(main(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698