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

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

Issue 2912343002: Add BuildBotClient to abstract http/logdog access (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/current_summary.dart ('k') | tools/gardening/lib/src/buildbot_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/bin/find_timeouts.dart
diff --git a/tools/gardening/bin/find_timeouts.dart b/tools/gardening/bin/find_timeouts.dart
index e333955f75f1df6b6870312092b8bd372e6d0b11..b9cdeaaecd7fe6cd84d0fa68d543d9ad24ef3b71 100644
--- a/tools/gardening/bin/find_timeouts.dart
+++ b/tools/gardening/bin/find_timeouts.dart
@@ -11,13 +11,12 @@ import 'package:args/args.dart';
import 'package:gardening/src/buildbot_data.dart';
import 'package:gardening/src/buildbot_loading.dart';
import 'package:gardening/src/buildbot_structures.dart';
+import 'package:gardening/src/client.dart';
import 'package:gardening/src/logdog.dart' as logdog;
import 'package:gardening/src/util.dart';
main(List<String> args) async {
ArgParser argParser = createArgParser();
- argParser.addFlag('logdog',
- negatable: false, help: "Pull test results from logdog.");
argParser.addOption('start',
defaultsTo: '-2',
help: "Start pulling from the specified <build-number>.\n"
@@ -25,6 +24,11 @@ main(List<String> args) async {
"for instance -2 for the second-to-last build.'");
ArgResults argResults = argParser.parse(args);
processArgResults(argResults);
+
+ BuildbotClient client = argResults['logdog']
+ ? new LogdogBuildbotClient()
+ : new HttpBuildbotClient();
+
List<String> arguments = argResults.rest;
if (arguments.length > 1) {
print('Usage: find_timeouts.dart [options] [<count>]');
@@ -37,24 +41,20 @@ main(List<String> args) async {
if (arguments.length > 0) {
buildNumberCount = int.parse(arguments[0]);
}
- int buildNumberOffset = int.parse(argResults['start']);
-
- bool useLogDog = argResults['logdog'];
+ int buildNumberOffset;
+ if (argResults.wasParsed('start')) {
+ buildNumberOffset = int.parse(argResults['start']);
+ } else {
+ buildNumberOffset = client.mostRecentBuildNumber;
+ }
- HttpClient client = new HttpClient();
BuildGroup group =
buildGroups.firstWhere((g) => g.groupName == 'dart2js-windows');
Map<String, List<Timeout>> timeouts = <String, List<Timeout>>{};
for (BuildSubgroup subgroup in group.subgroups) {
- if (useLogDog) {
- await readLogDogResults(subgroup, timeouts,
- buildNumberOffset: buildNumberOffset,
- buildNumberCount: buildNumberCount);
- } else {
- await readBuildBotResults(client, subgroup, timeouts,
- buildNumberOffset: buildNumberOffset,
- buildNumberCount: buildNumberCount);
- }
+ await readBuildBotResults(client, subgroup, timeouts,
+ buildNumberOffset: buildNumberOffset,
+ buildNumberCount: buildNumberCount);
}
List<String> sorted = timeouts.keys.toList()
@@ -81,7 +81,8 @@ Future readLogDogResults(
for (String shardName in subgroupPaths.keys) {
String subgroupPath = subgroupPaths[shardName];
List<int> buildNumbers = <int>[];
- for (String line in logdog.ls(subgroupPath).split('\n')) {
+ String text = await logdog.ls(subgroupPath);
+ for (String line in text.split('\n')) {
line = line.trim();
if (line.isNotEmpty) {
buildNumbers.add(int.parse(line));
@@ -112,13 +113,13 @@ Future readLogDogResults(
}
}
-Future readBuildBotResults(HttpClient client, BuildSubgroup subgroup,
+Future readBuildBotResults(BuildbotClient client, BuildSubgroup subgroup,
Map<String, List<Timeout>> timeouts,
{int buildNumberOffset, int buildNumberCount}) async {
List<BuildUri> buildUris = subgroup.createUris(buildNumberOffset);
for (BuildUri buildUri in buildUris) {
for (int i = 0; i < buildNumberCount; i++) {
- BuildResult result = await readBuildResult(client, buildUri);
+ BuildResult result = await client.readResult(buildUri);
for (TestFailure timeout in result.timeouts) {
timeouts
.putIfAbsent(timeout.id.testName, () => <Timeout>[])
« no previous file with comments | « tools/gardening/bin/current_summary.dart ('k') | tools/gardening/lib/src/buildbot_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698