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

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

Issue 2989263002: [Gardening Tool] Allow filtering groups by names in current_summary.dart (Closed)
Patch Set: Created 3 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/bin/current_summary.dart
diff --git a/tools/gardening/bin/current_summary.dart b/tools/gardening/bin/current_summary.dart
index a92c38a2f92333051942eb623ae99a1f604c7e4e..31052546b1a832f5561460a302bd1c4279ba921e 100644
--- a/tools/gardening/bin/current_summary.dart
+++ b/tools/gardening/bin/current_summary.dart
@@ -29,8 +29,24 @@ void help(ArgParser argParser) {
print(argParser.usage);
}
+/// Checks that [haystack] contains substring [needle], case insensitive.
+/// Throws an exception if either parameter is `null`.
+bool containsIgnoreCase(String haystack, String needle) {
+ if (haystack == null) {
+ throw "Unexpected null as the first paramter value of containsIgnoreCase";
+ }
+ if (needle == null) {
+ throw "Unexpected null as the second parameter value of containsIgnoreCase";
+ }
+ return haystack.toLowerCase().contains(needle.toLowerCase());
+}
+
main(List<String> args) async {
ArgParser argParser = createArgParser();
+ argParser.addOption('group',
+ help: "Restricts the build groups\n"
Johnni Winther 2017/08/02 13:39:07 Remove '\n' - I think `argParser.usage` inserts ne
Dmitry Stefantsov 2017/08/02 14:48:39 Just tested that. Unfortunately, it doesn't inser
+ "to be searched for the results of the given test\n"
+ "to those containing the given substring, case insensitive.");
ArgResults argResults = argParser.parse(args);
processArgResults(argResults);
@@ -49,6 +65,10 @@ main(List<String> args) async {
Map<String, Map<BuildUri, TestStatus>> resultMap =
<String, Map<BuildUri, TestStatus>>{};
for (BuildGroup group in buildGroups) {
+ if (argResults['group'] != null &&
+ !containsIgnoreCase(group.groupName, argResults['group'])) {
+ continue;
+ }
// TODO(johnniwinther): Support reading a partially completed shard from
// http, i.e. always use build number `-1`.
var resultFutures =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698