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

Side by Side Diff: tools/auto_bisect/configs/try.py

Issue 652543005: Add bisect-config-trying script and a few example configs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « tools/auto_bisect/configs/mac.bisect.page_cycler.cfg ('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
(Empty)
1 #!/usr/bin/env python
2
3 """Starts bisect try jobs on multiple platforms using known-good configs.
4
5 The purpose of this script is to serve as an integration test for the
6 auto-bisect project by starting try jobs for various config types and
7 various platforms.
8
9 The known-good configs are in this same directory as this script. They
10 are expected to all end in ".cfg" and start with the name of the platform
11 followed by a dot.
12
13 You can specify --full to try running each config on all applicable bots;
14 the default behavior is to try each config on only one bot.
15 """
16
17 import argparse
18 import logging
19 import os
20 import subprocess
21 import sys
22
23 SCRIPT_DIR = os.path.dirname(__file__)
24 BISECT_CONFIG = os.path.join(SCRIPT_DIR, os.path.pardir, 'bisect.cfg')
25 PERF_TEST_CONFIG = os.path.join(
26 SCRIPT_DIR, os.path.pardir, os.path.pardir, 'run-perf-test.cfg')
27 PLATFORM_BOT_MAP = {
28 'linux': ['linux_perf_bot'],
29 'mac': ['mac_perf_bisect', 'mac_10_9_perf_bisect'],
30 'win': ['win_perf_bisect', 'win_8_perf_bisect', 'win_xp_perf_bisect'],
31 'android': [
32 'android_nexus4_perf_bisect',
33 'android_nexus5_perf_bisect',
34 'android_nexus7_perf_bisect',
35 'android_nexus10_perf_bisect',
36 ],
37 }
38 SVN_URL = 'svn://svn.chromium.org/chrome-try/try-perf'
39 COMMIT_MESSAGE = 'Automatic commit.'
40
41
42 def main(argv):
43 parser = argparse.ArgumentParser(description=__doc__)
44 parser.add_argument('--full', action='store_true',
45 help='Run each config on all applicable bots.')
46 parser.add_argument('--filter', help='Filter config filenames to use.')
47 parser.add_argument('--verbose', '-v', action='store_true')
48 args = parser.parse_args(argv[1:])
49 _SetupLogging(args.verbose)
50 source_configs = _SourceConfigs(args.filter)
51 logging.debug('Source configs: %s', source_configs)
52 try:
53 _StartTryJobs(source_configs, args.full)
54 except subprocess.CalledProcessError as error:
55 print str(error)
56 print error.output
57
58
59 def _SetupLogging(verbose):
60 level = logging.INFO
61 if verbose:
62 level = logging.DEBUG
63 logging.basicConfig(level=level)
64
65
66 def _SourceConfigs(name_filter):
67 files = os.listdir(SCRIPT_DIR)
68 files = [os.path.join(SCRIPT_DIR, name) for name in files]
69 files = [name for name in files if name.endswith('.cfg')]
70 if name_filter:
71 files = [name for name in files if name_filter in name]
72 return files
73
74
75 def _StartTryJobs(source_configs, full_mode):
76 for source_config in source_configs:
77 dest_config = _DestConfig(source_config)
78 bot_names = _BotNames(source_config, full_mode)
79 for bot_name in bot_names:
80 logging.info('Trying %s on %s.', source_config, bot_name)
81 _StartTry(source_config, dest_config, bot_name)
82
83
84 def _DestConfig(source_config):
85 if 'bisect' in source_config:
86 return BISECT_CONFIG
87 assert 'perf_test' in source_config, source_config
88 return PERF_TEST_CONFIG
89
90
91 def _BotNames(source_config, full_mode):
92 platform = os.path.basename(source_config).split('.')[0]
93 assert platform in PLATFORM_BOT_MAP, platform
94 bot_names = PLATFORM_BOT_MAP[platform]
95 if full_mode:
96 return bot_names
97 return [bot_names[0]]
98
99
100 def _StartTry(source_config, dest_config, bot_name):
101
102 assert os.path.exists(source_config)
103 assert os.path.exists(dest_config)
104 assert _LastCommitMessage() != COMMIT_MESSAGE, repr(_LastCommitMessage())
105 _Run(['cp', source_config, dest_config])
106 _Run(['git', 'commit', '--all', '-m', COMMIT_MESSAGE])
107 _Run(['git', 'try', '--svn_repo', SVN_URL, '--bot', bot_name])
sullivan 2014/10/21 14:27:42 The output of this is returned by _Run and not sen
qyearsley 2014/10/21 19:06:26 Right -- it should definitely print to stdout here
108 assert _LastCommitMessage() == COMMIT_MESSAGE, repr(_LastCommitMessage())
109 _Run(['git', 'reset', '--hard', 'HEAD~1'])
sullivan 2014/10/21 14:27:42 I'm not very good with git--what would this do fro
Sergiy Byelozyorov 2014/10/21 19:04:37 It will only revert last commit, which are the cha
qyearsley 2014/10/21 19:06:26 Yep, that's the intention. The "git reset --hard H
110
111
112 def _LastCommitMessage():
113 return _Run(['git', 'log', '--format=%s', '-1']).strip()
114
115
116 def _Run(command):
117 logging.debug('Running %s', command)
118 # Note: check_output will raise a subprocess.CalledProcessError when
119 # the return-code is non-zero.
120 return subprocess.check_output(command)
121
122
123 if __name__ == '__main__':
124 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « tools/auto_bisect/configs/mac.bisect.page_cycler.cfg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698