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

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

Issue 2751543006: structure gardening tool (Closed)
Patch Set: oops Created 3 years, 9 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/README.md ('k') | tools/gardening/bin/current_summary.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Compares the test log of a build step with previous builds. 5 /// Compares the test log of a build step with previous builds.
6 /// 6 ///
7 /// Use this to detect flakiness of failures, especially timeouts. 7 /// Use this to detect flakiness of failures, especially timeouts.
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:convert';
11 import 'dart:io'; 10 import 'dart:io';
12 11
13 import 'src/buildbot_structures.dart'; 12 import 'package:gardening/src/buildbot_structures.dart';
14 import 'src/util.dart'; 13 import 'package:gardening/src/util.dart';
15 14
16 main(List<String> args) async { 15 main(List<String> args) async {
17 if (args.length != 1) { 16 if (args.length != 1) {
18 print('Usage: compare_failures <log-uri>'); 17 print('Usage: compare_failures <log-uri>');
19 exit(1); 18 exit(1);
20 } 19 }
21 String url = args.first; 20 String url = args.first;
22 if (!url.endsWith('/text')) { 21 if (!url.endsWith('/text')) {
23 // Use the text version of the stdio log. 22 // Use the text version of the stdio log.
24 url += '/text'; 23 url += '/text';
(...skipping 15 matching lines...) Expand all
40 summaries.add(firstSummary); 39 summaries.add(firstSummary);
41 if (firstSummary.hasFailures) { 40 if (firstSummary.hasFailures) {
42 for (int i = 0; i < 10; i++) { 41 for (int i = 0; i < 10; i++) {
43 buildUri = buildUri.prev(); 42 buildUri = buildUri.prev();
44 summaries.add(await readBuildResult(client, buildUri)); 43 summaries.add(await readBuildResult(client, buildUri));
45 } 44 }
46 } 45 }
47 return summaries; 46 return summaries;
48 } 47 }
49 48
50 /// Reads the content of [uri] as text.
51 Future<String> readUriAsText(HttpClient client, Uri uri) async {
52 HttpClientRequest request = await client.getUrl(uri);
53 HttpClientResponse response = await request.close();
54 return UTF8.decode(await response.expand((l) => l).toList());
55 }
56
57 /// Parses the [buildUri] test log and creates a [BuildResult] for it. 49 /// Parses the [buildUri] test log and creates a [BuildResult] for it.
58 Future<BuildResult> readBuildResult( 50 Future<BuildResult> readBuildResult(
59 HttpClient client, BuildUri buildUri) async { 51 HttpClient client, BuildUri buildUri) async {
60 Uri uri = buildUri.toUri(); 52 Uri uri = buildUri.toUri();
61 log('Reading $uri'); 53 log('Reading $uri');
62 String text = await readUriAsText(client, uri); 54 String text = await readUriAsText(client, uri);
63 55
64 bool inFailure = false; 56 bool inFailure = false;
65 List<String> currentFailure; 57 List<String> currentFailure;
66 bool parsingTimingBlock = false; 58 bool parsingTimingBlock = false;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 String archName = name.substring(0, slashPos); 297 String archName = name.substring(0, slashPos);
306 String testName = name.substring(slashPos + 1); 298 String testName = name.substring(slashPos + 1);
307 timings.add(new Timing( 299 timings.add(new Timing(
308 uri, 300 uri,
309 time, 301 time,
310 new TestStep( 302 new TestStep(
311 stepName, new TestConfiguration(configName, archName, testName)))); 303 stepName, new TestConfiguration(configName, archName, testName))));
312 } 304 }
313 return timings; 305 return timings;
314 } 306 }
OLDNEW
« no previous file with comments | « tools/gardening/README.md ('k') | tools/gardening/bin/current_summary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698