OLD | NEW |
---|---|
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 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 print('Displays the current status of specific tests on the buildbot'); | 22 print('Displays the current status of specific tests on the buildbot'); |
23 print('Only prints output for failing tests.'); | 23 print('Only prints output for failing tests.'); |
24 print('The test-names may be fully qualified (such as in '); | 24 print('The test-names may be fully qualified (such as in '); |
25 print('"pkg/front_end/test/token_test") or just be a substring of the fully'); | 25 print('"pkg/front_end/test/token_test") or just be a substring of the fully'); |
26 print(' qualified name.'); | 26 print(' qualified name.'); |
27 print('Usage: current_summary [options] <test-name1> [<test-name2> ...]'); | 27 print('Usage: current_summary [options] <test-name1> [<test-name2> ...]'); |
28 print('where options are:'); | 28 print('where options are:'); |
29 print(argParser.usage); | 29 print(argParser.usage); |
30 } | 30 } |
31 | 31 |
32 /// Checks that [haystack] contains substring [needle], case insensitive. | |
33 /// Throws an exception if either parameter is `null`. | |
34 bool containsIgnoreCase(String haystack, String needle) { | |
35 if (haystack == null) { | |
36 throw "Unexpected null as the first paramter value of containsIgnoreCase"; | |
37 } | |
38 if (needle == null) { | |
39 throw "Unexpected null as the second parameter value of containsIgnoreCase"; | |
40 } | |
41 return haystack.toLowerCase().contains(needle.toLowerCase()); | |
42 } | |
43 | |
32 main(List<String> args) async { | 44 main(List<String> args) async { |
33 ArgParser argParser = createArgParser(); | 45 ArgParser argParser = createArgParser(); |
46 argParser.addOption('group', | |
47 help: "Restricts the build groups\n" | |
Johnni Winther
2017/08/02 13:39:07
Remove '\n' - I think `argParser.usage` inserts ne
Dmitry Stefantsov
2017/08/02 14:48:39
Just tested that. Unfortunately, it doesn't inser
| |
48 "to be searched for the results of the given test\n" | |
49 "to those containing the given substring, case insensitive."); | |
34 ArgResults argResults = argParser.parse(args); | 50 ArgResults argResults = argParser.parse(args); |
35 processArgResults(argResults); | 51 processArgResults(argResults); |
36 | 52 |
37 BuildbotClient client = argResults['logdog'] | 53 BuildbotClient client = argResults['logdog'] |
38 ? new LogdogBuildbotClient() | 54 ? new LogdogBuildbotClient() |
39 : new HttpBuildbotClient(); | 55 : new HttpBuildbotClient(); |
40 | 56 |
41 if (argResults.rest.length == 0 || argResults['help']) { | 57 if (argResults.rest.length == 0 || argResults['help']) { |
42 help(argParser); | 58 help(argParser); |
43 if (argResults['help']) return; | 59 if (argResults['help']) return; |
44 exit(1); | 60 exit(1); |
45 } | 61 } |
46 int maxStatusWidth = 0; | 62 int maxStatusWidth = 0; |
47 int maxConfigWidth = 0; | 63 int maxConfigWidth = 0; |
48 | 64 |
49 Map<String, Map<BuildUri, TestStatus>> resultMap = | 65 Map<String, Map<BuildUri, TestStatus>> resultMap = |
50 <String, Map<BuildUri, TestStatus>>{}; | 66 <String, Map<BuildUri, TestStatus>>{}; |
51 for (BuildGroup group in buildGroups) { | 67 for (BuildGroup group in buildGroups) { |
68 if (argResults['group'] != null && | |
69 !containsIgnoreCase(group.groupName, argResults['group'])) { | |
70 continue; | |
71 } | |
52 // TODO(johnniwinther): Support reading a partially completed shard from | 72 // TODO(johnniwinther): Support reading a partially completed shard from |
53 // http, i.e. always use build number `-1`. | 73 // http, i.e. always use build number `-1`. |
54 var resultFutures = | 74 var resultFutures = |
55 group.createUris(client.mostRecentBuildNumber).map((uri) { | 75 group.createUris(client.mostRecentBuildNumber).map((uri) { |
56 log('Fetching $uri'); | 76 log('Fetching $uri'); |
57 return client.readResult(uri); | 77 return client.readResult(uri); |
58 }).toList(); | 78 }).toList(); |
59 var results = await Future.wait(resultFutures); | 79 var results = await Future.wait(resultFutures); |
60 for (BuildResult buildResult in results) { | 80 for (BuildResult buildResult in results) { |
61 bool havePrintedUri = false; | 81 bool havePrintedUri = false; |
(...skipping 23 matching lines...) Expand all Loading... | |
85 resultMap.forEach((String testName, Map<BuildUri, TestStatus> statusMap) { | 105 resultMap.forEach((String testName, Map<BuildUri, TestStatus> statusMap) { |
86 print(testName); | 106 print(testName); |
87 statusMap.forEach((BuildUri buildUri, TestStatus status) { | 107 statusMap.forEach((BuildUri buildUri, TestStatus status) { |
88 print(' ${padRight(status.status, maxStatusWidth)}: ' | 108 print(' ${padRight(status.status, maxStatusWidth)}: ' |
89 '${padRight(status.config.configName, maxConfigWidth)} ' | 109 '${padRight(status.config.configName, maxConfigWidth)} ' |
90 '${buildUri.shortBuildName}'); | 110 '${buildUri.shortBuildName}'); |
91 }); | 111 }); |
92 }); | 112 }); |
93 client.close(); | 113 client.close(); |
94 } | 114 } |
OLD | NEW |