| Index: tools/gardening/bin/current_summary.dart
|
| diff --git a/tools/gardening/bin/current_summary.dart b/tools/gardening/bin/current_summary.dart
|
| index 31052546b1a832f5561460a302bd1c4279ba921e..287c6fcaa66f3ae78e4f9168c202879d8950bbd5 100644
|
| --- a/tools/gardening/bin/current_summary.dart
|
| +++ b/tools/gardening/bin/current_summary.dart
|
| @@ -8,14 +8,13 @@
|
| /// The results are currently pulled from the second to last build since the
|
| /// last build might not have completed yet.
|
|
|
| -import 'dart:async';
|
| import 'dart:math' hide log;
|
| import 'dart:io';
|
|
|
| import 'package:args/args.dart';
|
| +import 'package:gardening/src/bot.dart';
|
| import 'package:gardening/src/buildbot_data.dart';
|
| import 'package:gardening/src/buildbot_structures.dart';
|
| -import 'package:gardening/src/client.dart';
|
| import 'package:gardening/src/util.dart';
|
|
|
| void help(ArgParser argParser) {
|
| @@ -50,9 +49,7 @@ main(List<String> args) async {
|
| ArgResults argResults = argParser.parse(args);
|
| processArgResults(argResults);
|
|
|
| - BuildbotClient client = argResults['logdog']
|
| - ? new LogdogBuildbotClient()
|
| - : new HttpBuildbotClient();
|
| + Bot bot = new Bot(logdog: argResults['logdog']);
|
|
|
| if (argResults.rest.length == 0 || argResults['help']) {
|
| help(argParser);
|
| @@ -64,34 +61,30 @@ main(List<String> args) async {
|
|
|
| Map<String, Map<BuildUri, TestStatus>> resultMap =
|
| <String, Map<BuildUri, TestStatus>>{};
|
| +
|
| + bool testsFound = false;
|
| + List<BuildGroup> notFoundGroups = <BuildGroup>[];
|
| for (BuildGroup group in buildGroups) {
|
| if (argResults['group'] != null &&
|
| !containsIgnoreCase(group.groupName, argResults['group'])) {
|
| + log('Skipping group $group');
|
| continue;
|
| }
|
| // TODO(johnniwinther): Support reading a partially completed shard from
|
| // http, i.e. always use build number `-1`.
|
| - var resultFutures =
|
| - group.createUris(client.mostRecentBuildNumber).map((uri) {
|
| - log('Fetching $uri');
|
| - return client.readResult(uri);
|
| - }).toList();
|
| - var results = await Future.wait(resultFutures);
|
| + List<BuildUri> uriList = group.createUris(bot.mostRecentBuildNumber);
|
| + if (uriList.isEmpty) continue;
|
| + print('Fetching ${uriList.first} + ${uriList.length - 1} more ...');
|
| + List<BuildResult> results = await bot.readResults(uriList);
|
| + bool testsFoundInGroup = false;
|
| for (BuildResult buildResult in results) {
|
| - bool havePrintedUri = false;
|
| + if (buildResult == null) continue;
|
| var buildUri = buildResult.buildUri;
|
| - if (argResults['verbose']) {
|
| - havePrintedUri = true;
|
| - print('Reading $buildUri');
|
| - }
|
| for (TestStatus testStatus in buildResult.results) {
|
| String testName = testStatus.config.testName;
|
| for (String arg in argResults.rest) {
|
| if (testName.contains(arg) || arg.contains(testName)) {
|
| - if (!havePrintedUri) {
|
| - havePrintedUri = true;
|
| - print("$buildUri:");
|
| - }
|
| + testsFoundInGroup = true;
|
| resultMap.putIfAbsent(testName, () => {})[buildUri] = testStatus;
|
| maxStatusWidth = max(maxStatusWidth, testStatus.status.length);
|
| maxConfigWidth =
|
| @@ -100,15 +93,42 @@ main(List<String> args) async {
|
| }
|
| }
|
| }
|
| + if (testsFoundInGroup) {
|
| + testsFound = true;
|
| + } else {
|
| + notFoundGroups.add(group);
|
| + }
|
| }
|
| print('');
|
| - resultMap.forEach((String testName, Map<BuildUri, TestStatus> statusMap) {
|
| - print(testName);
|
| - statusMap.forEach((BuildUri buildUri, TestStatus status) {
|
| - print(' ${padRight(status.status, maxStatusWidth)}: '
|
| - '${padRight(status.config.configName, maxConfigWidth)} '
|
| - '${buildUri.shortBuildName}');
|
| + if (testsFound) {
|
| + resultMap.forEach((String testName, Map<BuildUri, TestStatus> statusMap) {
|
| + print(testName);
|
| + statusMap.forEach((BuildUri buildUri, TestStatus status) {
|
| + print(' ${padRight(status.status, maxStatusWidth)}: '
|
| + '${padRight(status.config.configName, maxConfigWidth)} '
|
| + '${buildUri.shortBuildName}');
|
| + });
|
| });
|
| - });
|
| - client.close();
|
| + if (notFoundGroups.isNotEmpty) {
|
| + if (argResults.rest.length == 1) {
|
| + print("Test pattern '${argResults.rest.single}' not found "
|
| + "in these build bot groups:");
|
| + } else {
|
| + print("Test patterns '${argResults.rest.join("', '")}' not found "
|
| + "in these build bot groups:");
|
| + }
|
| + for (BuildGroup group in notFoundGroups) {
|
| + print(' $group');
|
| + }
|
| + }
|
| + } else {
|
| + if (argResults.rest.length == 1) {
|
| + print("Test pattern '${argResults.rest.single}' not found "
|
| + "in any build bot groups.");
|
| + } else {
|
| + print("Test patterns '${argResults.rest.join("', '")}' not found "
|
| + "in any build bot groups.");
|
| + }
|
| + }
|
| + bot.close();
|
| }
|
|
|