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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """ Runs a series of tests on a file which maps old builder names to new builder
6 names. """
7
8
9 import json
10 import os
11 import sys
12
13
14 EXPECTED_DIR = os.path.join(os.path.dirname(__file__), 'expected')
15
16
17 def VerifyMapping(old_name, new_name, slaves_cfg, mapping):
18 """ Run assertions to verify that the mapping from an old builder name to a
19 new builder name is valid. """
20 try:
21 # First, is the old name actually a builder name?
22 assert os.path.isfile(os.path.join(EXPECTED_DIR, old_name))
23
24 # Trybots should maintain the trybot suffix.
25 if old_name.endswith('Trybot'):
26 assert new_name.endswith('Trybot')
27 else:
28 # If the builder isn't a trybot, it should be explicitly listed in
29 # slaves.cfg.
30 assert new_name in slaves_cfg
31
32 # Assert that the new builder name isn't duplicated.
33 match_count = 0
34 for val in mapping.itervalues():
35 if val == new_name:
36 match_count += 1
37 assert match_count == 1
38
39 # ADD YOUR ASSERTIONS HERE
40
41 except Exception:
42 print 'Failed assertion for (%s to %s)' % (old_name, new_name)
43 raise
44
45
46 def main(argv):
47 if len(argv) != 2:
48 raise Exception('Invalid arguments given; you must provide a mapping file.')
49 with open(argv[1]) as f:
50 mapping = json.load(f)
51
52 slaves_cfg_file = os.path.join('master', 'slaves.cfg')
53 with open(slaves_cfg_file) as f:
54 slaves_cfg = f.read()
55
56 for old_name, new_name in mapping.iteritems():
57 VerifyMapping(old_name, new_name, slaves_cfg, mapping)
58
59
60 if '__main__' == __name__:
61 sys.exit(main(sys.argv))
OLDNEW
« master/skia_master_scripts/factory.py ('K') | « tools/tests/factory_configuration/rename_builders.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698