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

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

Issue 2908403002: Add a 'bot.dart' executable to the gardening tools. (Closed)
Patch Set: Address comments. 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/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/bin/status_summary.dart
diff --git a/tools/gardening/bin/status_summary.dart b/tools/gardening/bin/status_summary.dart
index a30b49ca71d0d85fa5abf4c89b5c69bf827cf20b..8663469472126c32f135875f42959ea5aea5388e 100644
--- a/tools/gardening/bin/status_summary.dart
+++ b/tools/gardening/bin/status_summary.dart
@@ -12,20 +12,31 @@ import 'dart:io';
import 'package:args/args.dart';
import 'package:gardening/src/util.dart';
+void help(ArgParser argParser) {
+ print('Prints all status-file entries for the given tests.');
+ print('The test-names must be a substring (or full match) of the lines in ');
+ print('the status file. They can not be fully qualified');
+ print('Usage: status_summary [options] <test-name1> [<test-name2> ...]');
+ print('where options are:');
+ print(argParser.usage);
+}
+
main(List<String> args) async {
ArgParser argParser = createArgParser();
ArgResults argResults = argParser.parse(args);
processArgResults(argResults);
- if (argResults.rest.length == 0) {
- print('Usage: status_summary [options] <test-name1> [<test-name2> ...]');
- print('where options are:');
- print(argParser.usage);
+ if (argResults.rest.length == 0 || argResults['help']) {
+ help(argParser);
+ if (argResults['help']) return;
exit(1);
}
int maxStatusWidth = 0;
int maxConfigWidth = 0;
- List<Uri> statusFiles = await findStatusFiles('tests');
+ Directory testDirectory = findTestDirectory('tests');
+ List<Uri> statusFiles = await findStatusFiles(testDirectory);
+ Directory pkgDirectory = findTestDirectory('pkg');
+ statusFiles.addAll(await findStatusFiles(pkgDirectory));
Map<String, List<StatusFile>> statusMap = <String, List<StatusFile>>{};
for (Uri uri in statusFiles) {
Map<String, StatusFile> currentMap = <String, StatusFile>{};
@@ -79,11 +90,20 @@ main(List<String> args) async {
});
}
+/// Finds the test directory.
+///
+/// First looks at a test-directory that is relative to the current
+Directory findTestDirectory(String directoryName) {
+ var directory = new Directory(directoryName);
+ if (directory.existsSync()) return directory;
+ return new Directory.fromUri(
+ Platform.script.resolve("../../../$directoryName"));
+}
+
/// Returns the [Uri]s for all `.status` files in [path] and subdirectories.
-Future<List<Uri>> findStatusFiles(String path) async {
+Future<List<Uri>> findStatusFiles(Directory testDirectory) async {
List<Uri> statusFiles = <Uri>[];
- await for (FileSystemEntity entity
- in new Directory(path).list(recursive: true)) {
+ await for (FileSystemEntity entity in testDirectory.list(recursive: true)) {
if (entity.path.endsWith('.status')) {
statusFiles.add(entity.uri);
}
« no previous file with comments | « tools/gardening/bin/current_summary.dart ('k') | tools/gardening/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698