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

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

Issue 2797253006: Add find_timeouts and caching to tools/gardening (Closed)
Patch Set: Updated cf. comments Created 3 years, 8 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/bin/create_shard_groups.dart ('k') | tools/gardening/bin/find_timeouts.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 /// Collects the test results for all build bots in [buildGroups] for tests 5 /// Collects the test results for all build bots in [buildGroups] for tests
6 /// that mention one of the test names given as argument. 6 /// that mention one of the test names given as argument.
7 /// 7 ///
8 /// The results are currently pulled from the second to last build since the 8 /// The results are currently pulled from the second to last build since the
9 /// last build might not have completed yet. 9 /// last build might not have completed yet.
10 10
11 import 'dart:math'; 11 import 'dart:math';
12 import 'dart:io'; 12 import 'dart:io';
13 13
14 import 'package:args/args.dart';
14 import 'package:gardening/src/buildbot_data.dart'; 15 import 'package:gardening/src/buildbot_data.dart';
16 import 'package:gardening/src/buildbot_loading.dart';
15 import 'package:gardening/src/buildbot_structures.dart'; 17 import 'package:gardening/src/buildbot_structures.dart';
16 import 'package:gardening/src/util.dart'; 18 import 'package:gardening/src/util.dart';
17 19
18 main(List<String> args) async { 20 main(List<String> args) async {
19 if (args.length == 0) { 21 ArgParser argParser = createArgParser();
20 print('Usage: current_summary <test-name1> [<test-name2> ...]'); 22 ArgResults argResults = argParser.parse(args);
23 processArgResults(argResults);
24 if (argResults.rest.length == 0) {
25 print('Usage: current_summary [options] <test-name1> [<test-name2> ...]');
26 print('where options are:');
27 print(argParser.usage);
21 exit(1); 28 exit(1);
22 } 29 }
23 int maxStatusWidth = 0; 30 int maxStatusWidth = 0;
24 int maxConfigWidth = 0; 31 int maxConfigWidth = 0;
25 32
26 HttpClient client = new HttpClient(); 33 HttpClient client = new HttpClient();
27 Map<String, Map<BuildUri, TestStatus>> resultMap = 34 Map<String, Map<BuildUri, TestStatus>> resultMap =
28 <String, Map<BuildUri, TestStatus>>{}; 35 <String, Map<BuildUri, TestStatus>>{};
29 for (BuildGroup group in buildGroups) { 36 for (BuildGroup group in buildGroups) {
30 // TODO(johnniwinther): Support reading a partially completed shard, i.e. 37 // TODO(johnniwinther): Support reading a partially completed shard, i.e.
31 // use build number `-1`. 38 // use build number `-1`.
32 for (BuildUri buildUri in group.createUris(-2)) { 39 for (BuildUri buildUri in group.createUris(-2)) {
33 print('Reading $buildUri'); 40 print('Reading $buildUri');
34 String text = await readUriAsText(client, buildUri.toUri()); 41 BuildResult buildResult = await readBuildResult(client, buildUri);
35 for (String line in text.split('\n')) { 42 for (TestStatus testStatus in buildResult.results) {
36 if (line.startsWith('Done ')) { 43 String testName = testStatus.config.testName;
37 List<String> parts = split(line, ['Done ', ' ', ' ', ': ']); 44 for (String arg in argResults.rest) {
38 String testName = parts[3]; 45 if (testName.contains(arg) || arg.contains(testName)) {
39 String configName = parts[1]; 46 resultMap.putIfAbsent(testName, () => {})[buildUri] = testStatus;
40 String archName = parts[2]; 47 maxStatusWidth = max(maxStatusWidth, testStatus.status.length);
41 String status = parts[4]; 48 maxConfigWidth =
42 TestStatus testStatus = new TestStatus( 49 max(maxConfigWidth, testStatus.config.configName.length);
43 new TestConfiguration(configName, archName, testName), status);
44 for (String arg in args) {
45 if (testName.contains(arg) || arg.contains(testName)) {
46 resultMap.putIfAbsent(testName, () => {})[buildUri] = testStatus;
47 maxStatusWidth = max(maxStatusWidth, status.length);
48 maxConfigWidth = max(maxConfigWidth, configName.length);
49 }
50 } 50 }
51 } 51 }
52 } 52 }
53 } 53 }
54 } 54 }
55 print(''); 55 print('');
56 resultMap.forEach((String testName, Map<BuildUri, TestStatus> statusMap) { 56 resultMap.forEach((String testName, Map<BuildUri, TestStatus> statusMap) {
57 print(testName); 57 print(testName);
58 statusMap.forEach((BuildUri buildUri, TestStatus status) { 58 statusMap.forEach((BuildUri buildUri, TestStatus status) {
59 print(' ${padRight(status.status, maxStatusWidth)}: ' 59 print(' ${padRight(status.status, maxStatusWidth)}: '
60 '${padRight(status.config.configName, maxConfigWidth)} ' 60 '${padRight(status.config.configName, maxConfigWidth)} '
61 '${buildUri.shortBuildName}'); 61 '${buildUri.shortBuildName}');
62 }); 62 });
63 }); 63 });
64 client.close(); 64 client.close();
65 } 65 }
66
67 /// The result of a single test for a single test step.
68 class TestStatus {
69 final TestConfiguration config;
70 final String status;
71
72 TestStatus(this.config, this.status);
73
74 String toString() => '$config: $status';
75 }
OLDNEW
« no previous file with comments | « tools/gardening/bin/create_shard_groups.dart ('k') | tools/gardening/bin/find_timeouts.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698