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

Side by Side Diff: tools/gardening/bin/find_shard.dart

Issue 2915043002: Added find-shard to bot.dart. (Closed)
Patch Set: Created 3 years, 6 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/gardening/bin/bot.dart ('k') | tools/gardening/bin/find_timeouts.dart » ('j') | 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 dart
2 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file.
5
6 // Translates a buildbot shard name to the corresponding column group name
7 // on the buildbot site, such that it's easier to find the right column.
8 //
9 // Example: `bin/find_shard.dart precomp-linux-debug-x64-be`
10 // prints `vm-precomp(5): precomp-linux-debug-x64-be`.
11
12 import 'dart:io';
13 import 'package:args/args.dart';
14 part 'package:gardening/src/shard_data.dart';
15
16 ArgParser createArgParser() {
17 ArgParser argParser = new ArgParser(allowTrailingOptions: true);
18 argParser.addFlag('help', help: "Help");
19 return argParser;
20 }
21
22 bool INCLUDE_DEV =
23 const bool.fromEnvironment('INCLUDE_DEV', defaultValue: false);
24 bool INCLUDE_STABLE =
25 const bool.fromEnvironment('INCLUDE_STABLE', defaultValue: false);
26 bool INCLUDE_INTEGRATION =
27 const bool.fromEnvironment('INCLUDE_INTEGRATION', defaultValue: false);
28
29 void processArgResults(ArgResults argResults) {
30 if (argResults['include-all']) {
31 INCLUDE_DEV = INCLUDE_STABLE = INCLUDE_INTEGRATION = true;
32 } else {
33 if (argResults['include-dev']) INCLUDE_DEV = true;
34 if (argResults['include-stable']) INCLUDE_STABLE = true;
35 if (argResults['include-integration']) INCLUDE_INTEGRATION = true;
36 }
37 }
38
39 void help(ArgParser argParser) {
40 print('Given a shard name or a substring thereof, search all buildbot');
41 print('shard names and print matching ones, along with their group.');
42 print('E.g., searching "drt" will show that there are several matching');
43 print('shards, all in the group "chrome", which may be helpful when');
44 print('navigating the buildbot web page based on blame email etc.\n');
45 print('Usage: find_shard [options] <shard>');
46 print('where options are:');
47 print(argParser.usage);
48 }
49
50 bool shard_enabled(String shard) {
51 if (shard.endsWith('-dev')) return INCLUDE_DEV;
52 if (shard.endsWith('-stable')) return INCLUDE_STABLE;
53 if (shard.endsWith('-integration')) return INCLUDE_INTEGRATION;
54 return true;
55 }
56
57 main(List<String> args) async {
58 ArgParser argParser = createArgParser();
59 argParser.addFlag("include-dev",
60 abbr: "d",
61 defaultsTo: false,
62 negatable: false,
63 help: "Include shards named *-dev");
64 argParser.addFlag("include-stable",
65 abbr: "s",
66 defaultsTo: false,
67 negatable: false,
68 help: "Include shards named *-stable");
69 argParser.addFlag("include-integration",
70 abbr: "i",
71 defaultsTo: false,
72 negatable: false,
73 help: "Include shards named *-integration");
74 argParser.addFlag("include-all",
75 abbr: "a",
76 defaultsTo: false,
77 negatable: false,
78 help: "Include all shards");
79 ArgResults argResults = argParser.parse(args);
80 processArgResults(argResults);
81
82 if (argResults.rest.length != 1 || argResults['help']) {
83 help(argParser);
84 if (argResults['help']) return;
85 exit(1);
86 }
87
88 String arg = argResults.rest.first;
89 for (String group in shardGroups.keys) {
90 List<String> shardGroup = shardGroups[group];
91 for (int i = 0; i < shardGroup.length; i++) {
92 String shard = shardGroup[i];
93 if (shard_enabled(shard) && shard.contains(arg)) {
94 print("$group(${i+1}): $shard");
95 }
96 }
97 }
98 }
OLDNEW
« no previous file with comments | « tools/gardening/bin/bot.dart ('k') | tools/gardening/bin/find_timeouts.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698