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

Side by Side Diff: tools/tests/factory_configuration/factory_configuration_test.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Fix launch_slaves, remove more stuff Created 6 years, 2 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
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """ Verifies that the configuration for each BuildFactory matches its
8 expectation. """
9
10
11 from distutils import dir_util
12 import imp
13 import os
14 import shutil
15 import sys
16
17 my_path = os.path.abspath(os.path.dirname(__file__))
18 buildbot_path = os.path.join(my_path, os.pardir, os.pardir, os.pardir)
19 sys.path.append(os.path.join(buildbot_path, 'master'))
20 sys.path.append(os.path.join(buildbot_path, 'site_config'))
21 sys.path.append(os.path.join(buildbot_path, 'third_party', 'chromium_buildbot',
22 'scripts'))
23 sys.path.append(os.path.join(buildbot_path, 'third_party', 'chromium_buildbot',
24 'site_config'))
25 sys.path.append(os.path.join(buildbot_path, 'third_party', 'chromium_buildbot',
26 'third_party', 'buildbot_8_4p1'))
27 sys.path.append(os.path.join(buildbot_path, 'third_party', 'chromium_buildbot',
28 'third_party', 'jinja2'))
29 sys.path.append(os.path.join(buildbot_path, 'third_party', 'chromium_buildbot',
30 'third_party', 'twisted_8_1'))
31
32
33 import config
34 import config_private
35
36
37 def RunTest(die_on_validation_failure=True):
38 # Create a dummy password file if necessary.
39 for password_file in ('.skia_buildbots_password', '.code_review_password',
40 '.status_password'):
41 password_path = os.path.join(buildbot_path, 'master', password_file)
42 if not os.path.isfile(password_path):
43 with open(password_path, 'w') as f:
44 f.write('dummy_password')
45
46 # Run the factory config test for each master.
47 for build_master_class in config.Master.valid_masters:
48 build_master_name = build_master_class.__name__
49 print build_master_name
50 os.environ['TESTING_MASTER'] = build_master_name
51
52 c = {}
53 c['schedulers'] = []
54 c['builders'] = []
55
56 # Make sure that the configuration errors out if validation fails.
57 config_private.die_on_validation_failure = die_on_validation_failure
58
59 # Pretend that the master is the production master, so that the tested
60 # configuration is identical to that of the production master.
61 build_master_class.is_production_host = True
62
63 # Move to the .../buildbot/master directory, which is what the build master
64 # expects the CWD to be.
65 os.chdir(os.path.join(buildbot_path, 'master'))
66
67 # Run the configuration. The setup in master.cfg runs when the module is
68 # imported, so this import is roughly equivalent to a function call. We have
69 # to use the imp module because master.cfg is not a .py file.
70 imp.load_source('master_cfg', 'master.cfg')
71
72
73 def main():
74 # While running our test, ignore these environment variables.
75 # They will remain set in the user's environment, once this program exits.
76 os.environ[config_private.SKIPSTEPS_ENVIRONMENT_VARIABLE] = ''
77 os.environ[config_private.DONTSKIPSTEPS_ENVIRONMENT_VARIABLE] = ''
78
79 if '--rebaseline' in sys.argv:
80 print 'Generating new actuals.'
81 if os.path.exists(os.path.join(my_path, 'actual')):
82 shutil.rmtree(os.path.join(my_path, 'actual'))
83 os.makedirs(os.path.join(my_path, 'actual'))
84 RunTest(die_on_validation_failure=False)
85 print 'Copying actual to expected.'
86 dir_util.copy_tree(os.path.join(my_path, 'actual'),
87 os.path.join(my_path, 'expected'))
88 else:
89 print 'Validating factory configuration:'
90 RunTest()
91
92 if '__main__' == __name__:
93 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698