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

Side by Side Diff: tools/gardening/bin/status_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/shard2group.dart ('k') | tools/gardening/lib/src/buildbot_data.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 configurations for all status files in the 'tests' folder that 5 /// Collects the configurations for all status files in the 'tests' folder that
6 /// mention one of the test names given as argument. 6 /// mention one of the test names given as argument.
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:math' hide log; 9 import 'dart:math' hide log;
10 import 'dart:io'; 10 import 'dart:io';
11 11
12 import 'package:args/args.dart';
12 import 'package:gardening/src/util.dart'; 13 import 'package:gardening/src/util.dart';
13 14
14 main(List<String> args) async { 15 main(List<String> args) async {
15 if (args.length == 0) { 16 ArgParser argParser = createArgParser();
16 print('Usage: status_summary <test-name1> [<test-name2> ...]'); 17 ArgResults argResults = argParser.parse(args);
18 processArgResults(argResults);
19 if (argResults.rest.length == 0) {
20 print('Usage: status_summary [options] <test-name1> [<test-name2> ...]');
21 print('where options are:');
22 print(argParser.usage);
17 exit(1); 23 exit(1);
18 } 24 }
19 int maxStatusWidth = 0; 25 int maxStatusWidth = 0;
20 int maxConfigWidth = 0; 26 int maxConfigWidth = 0;
21 27
22 List<Uri> statusFiles = await findStatusFiles('tests'); 28 List<Uri> statusFiles = await findStatusFiles('tests');
23 Map<String, List<StatusFile>> statusMap = <String, List<StatusFile>>{}; 29 Map<String, List<StatusFile>> statusMap = <String, List<StatusFile>>{};
24 for (Uri uri in statusFiles) { 30 for (Uri uri in statusFiles) {
25 Map<String, StatusFile> currentMap = <String, StatusFile>{}; 31 Map<String, StatusFile> currentMap = <String, StatusFile>{};
26 log('Scanning $uri'); 32 log('Scanning $uri');
27 String currentConfig = ''; 33 String currentConfig = '';
28 for (String line in new File.fromUri(uri).readAsLinesSync()) { 34 for (String line in new File.fromUri(uri).readAsLinesSync()) {
29 if (line.startsWith('[')) { 35 if (line.startsWith('[')) {
30 currentConfig = line; 36 currentConfig = line;
31 } else { 37 } else {
32 int colonIndex = line.indexOf(':'); 38 int colonIndex = line.indexOf(':');
33 if (colonIndex != -1) { 39 if (colonIndex != -1) {
34 String testName = line.substring(0, colonIndex).trim(); 40 String testName = line.substring(0, colonIndex).trim();
35 int hashIndex = line.indexOf('#', colonIndex + 1); 41 int hashIndex = line.indexOf('#', colonIndex + 1);
36 String status; 42 String status;
37 String comment; 43 String comment;
38 if (hashIndex != -1) { 44 if (hashIndex != -1) {
39 status = line.substring(colonIndex + 1, hashIndex).trim(); 45 status = line.substring(colonIndex + 1, hashIndex).trim();
40 comment = line.substring(hashIndex + 1).trim(); 46 comment = line.substring(hashIndex + 1).trim();
41 } else { 47 } else {
42 status = line.substring(colonIndex + 1).trim(); 48 status = line.substring(colonIndex + 1).trim();
43 comment = ''; 49 comment = '';
44 } 50 }
45 51
46 for (String arg in args) { 52 for (String arg in argResults.rest) {
47 if (testName.contains(arg) || arg.contains(testName)) { 53 if (testName.contains(arg) || arg.contains(testName)) {
48 StatusFile statusFile = 54 StatusFile statusFile =
49 currentMap.putIfAbsent(testName, () => new StatusFile(uri)); 55 currentMap.putIfAbsent(testName, () => new StatusFile(uri));
50 statusFile.entries 56 statusFile.entries
51 .add(new StatusEntry(currentConfig, status, comment)); 57 .add(new StatusEntry(currentConfig, status, comment));
52 58
53 maxStatusWidth = max(maxStatusWidth, status.length); 59 maxStatusWidth = max(maxStatusWidth, status.length);
54 maxConfigWidth = max(maxConfigWidth, currentConfig.length); 60 maxConfigWidth = max(maxConfigWidth, currentConfig.length);
55 } 61 }
56 } 62 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 /// The status of the entry, e.g. `Pass, Slow`. 108 /// The status of the entry, e.g. `Pass, Slow`.
103 final String status; 109 final String status;
104 110
105 /// The comment after the status, if any. 111 /// The comment after the status, if any.
106 final String comment; 112 final String comment;
107 113
108 StatusEntry(this.config, this.status, this.comment); 114 StatusEntry(this.config, this.status, this.comment);
109 115
110 String toString() => '$status $config $comment'; 116 String toString() => '$status $config $comment';
111 } 117 }
OLDNEW
« no previous file with comments | « tools/gardening/bin/shard2group.dart ('k') | tools/gardening/lib/src/buildbot_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698