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

Side by Side Diff: test/slaves_cfg_test.py

Issue 12300004: Build scripts refactor to support multislave (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: rebase Created 7 years, 9 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
« no previous file with comments | « slave/run_slave.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Ensure that all slaves.cfg files are well formatted and without duplicity. 6 """Ensure that all slaves.cfg files are well formatted and without duplicity.
7 """ 7 """
8 8
9 import os 9 import os
10 import sys 10 import sys
11 11
12 BASE_PATH = os.path.dirname(os.path.abspath(__file__)) 12 BASE_PATH = os.path.dirname(os.path.abspath(__file__))
13 sys.path.insert(0, os.path.join(BASE_PATH, '..', 'scripts')) 13 sys.path.insert(0, os.path.join(BASE_PATH, '..', 'scripts'))
14 14
15 from common import chromium_utils 15 from common import chromium_utils
16 16
17 # List of slaves that are allowed to be used more than once. 17 # List of slaves that are allowed to be used more than once.
18 WHITELIST = ['build1-m6'] 18 WHITELIST = ['build1-m6']
19 19
20 def main(): 20 def main():
21 status = 0 21 status = 0
22 slaves = {} 22 slaves = {}
23 for master in chromium_utils.ListMasters(cue='slaves.cfg'): 23 for slave in chromium_utils.GetAllSlaves():
24 masterbase = os.path.basename(master) 24 mastername = slave['mastername']
25 master_slaves = {} 25 slavename = chromium_utils.EntryToSlaveName(slave)
26 execfile(os.path.join(master, 'slaves.cfg'), master_slaves) 26 if slavename and slave.get('hostname') not in WHITELIST:
27 for slave in master_slaves.get('slaves', []): 27 slaves.setdefault(slavename, []).append(mastername)
28 hostname = slave.get('hostname', None) 28 for slavename, masters in slaves.iteritems():
29 if hostname and hostname not in WHITELIST: 29 if len(masters) > 1:
30 masters = slaves.get(hostname, []) 30 print '%s duplicated in masters: %s' % (slavename, ' '.join(masters))
31 masters.append(masterbase) 31 status = 1
32 slaves[hostname] = masters
33 if len(masters) > 1:
34 print '%s duplicated in masters: %s' % (hostname, ' '.join(masters))
35 status = 1
36 return status 32 return status
37 33
38 if __name__ == '__main__': 34 if __name__ == '__main__':
39 sys.exit(main()) 35 sys.exit(main())
OLDNEW
« no previous file with comments | « slave/run_slave.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698