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

Unified Diff: tools/gardening/bin/find_shard.dart

Issue 2915043002: Added find-shard to bot.dart. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/bin/find_shard.dart
diff --git a/tools/gardening/bin/find_shard.dart b/tools/gardening/bin/find_shard.dart
new file mode 100755
index 0000000000000000000000000000000000000000..90a223e34d27127536dfa64b56ebf801c4918de3
--- /dev/null
+++ b/tools/gardening/bin/find_shard.dart
@@ -0,0 +1,98 @@
+#!/usr/bin/env dart
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Translates a buildbot shard name to the corresponding column group name
+// on the buildbot site, such that it's easier to find the right column.
+//
+// Example: `bin/find_shard.dart precomp-linux-debug-x64-be`
+// prints `vm-precomp(5): precomp-linux-debug-x64-be`.
+
+import 'dart:io';
+import 'package:args/args.dart';
+part 'package:gardening/src/shard_data.dart';
+
+ArgParser createArgParser() {
+ ArgParser argParser = new ArgParser(allowTrailingOptions: true);
+ argParser.addFlag('help', help: "Help");
+ return argParser;
+}
+
+bool INCLUDE_DEV =
+ const bool.fromEnvironment('INCLUDE_DEV', defaultValue: false);
+bool INCLUDE_STABLE =
+ const bool.fromEnvironment('INCLUDE_STABLE', defaultValue: false);
+bool INCLUDE_INTEGRATION =
+ const bool.fromEnvironment('INCLUDE_INTEGRATION', defaultValue: false);
+
+void processArgResults(ArgResults argResults) {
+ if (argResults['include-all']) {
+ INCLUDE_DEV = INCLUDE_STABLE = INCLUDE_INTEGRATION = true;
+ } else {
+ if (argResults['include-dev']) INCLUDE_DEV = true;
+ if (argResults['include-stable']) INCLUDE_STABLE = true;
+ if (argResults['include-integration']) INCLUDE_INTEGRATION = true;
+ }
+}
+
+void help(ArgParser argParser) {
+ print('Given a shard name or a substring thereof, search all buildbot');
+ print('shard names and print matching ones, along with their group.');
+ print('E.g., searching "drt" will show that there are several matching');
+ print('shards, all in the group "chrome", which may be helpful when');
+ print('navigating the buildbot web page based on blame email etc.\n');
+ print('Usage: find_shard [options] <shard>');
+ print('where options are:');
+ print(argParser.usage);
+}
+
+bool shard_enabled(String shard) {
+ if (shard.endsWith('-dev')) return INCLUDE_DEV;
+ if (shard.endsWith('-stable')) return INCLUDE_STABLE;
+ if (shard.endsWith('-integration')) return INCLUDE_INTEGRATION;
+ return true;
+}
+
+main(List<String> args) async {
+ ArgParser argParser = createArgParser();
+ argParser.addFlag("include-dev",
+ abbr: "d",
+ defaultsTo: false,
+ negatable: false,
+ help: "Include shards named *-dev");
+ argParser.addFlag("include-stable",
+ abbr: "s",
+ defaultsTo: false,
+ negatable: false,
+ help: "Include shards named *-stable");
+ argParser.addFlag("include-integration",
+ abbr: "i",
+ defaultsTo: false,
+ negatable: false,
+ help: "Include shards named *-integration");
+ argParser.addFlag("include-all",
+ abbr: "a",
+ defaultsTo: false,
+ negatable: false,
+ help: "Include all shards");
+ ArgResults argResults = argParser.parse(args);
+ processArgResults(argResults);
+
+ if (argResults.rest.length != 1 || argResults['help']) {
+ help(argParser);
+ if (argResults['help']) return;
+ exit(1);
+ }
+
+ String arg = argResults.rest.first;
+ for (String group in shardGroups.keys) {
+ List<String> shardGroup = shardGroups[group];
+ for (int i = 0; i < shardGroup.length; i++) {
+ String shard = shardGroup[i];
+ if (shard_enabled(shard) && shard.contains(arg)) {
+ print("$group(${i+1}): $shard");
+ }
+ }
+ }
+}
« 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