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

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

Issue 2999043003: Use package:testing for tools/gardening (Closed)
Patch Set: Created 3 years, 4 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
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:io'; 10 import 'dart:io';
10 11
11 import 'package:args/args.dart'; 12 import 'package:args/args.dart';
12 import 'package:gardening/src/bot.dart'; 13 import 'package:gardening/src/bot.dart';
13 import 'package:gardening/src/compare_failures_impl.dart'; 14 import 'package:gardening/src/compare_failures_impl.dart';
14 import 'package:gardening/src/util.dart'; 15 import 'package:gardening/src/util.dart';
15 16
16 void help(ArgParser argParser) { 17 void help(ArgParser argParser) {
17 print('Given a <log-uri> finds all failing tests in that stdout. Then '); 18 print('Given a <log-uri> finds all failing tests in that stdout. Then ');
18 print('fetches earlier runs of the same bot and compares the results.'); 19 print('fetches earlier runs of the same bot and compares the results.');
19 print('This tool is particularly useful to detect flakes and their '); 20 print('This tool is particularly useful to detect flakes and their ');
20 print('frequency.'); 21 print('frequency.');
21 print('Usage: compare_failures [options] '); 22 print('Usage: compare_failures [options] ');
22 print(' (<log-uri> [<log-uri> ...] | <build-group> [<build-group> ...])'); 23 print(' (<log-uri> [<log-uri> ...] | <build-group> [<build-group> ...])');
23 print('where <log-uri> is the uri the stdio output of a failing test step '); 24 print('where <log-uri> is the uri the stdio output of a failing test step ');
24 print('and <build-group> is the name of a buildbot group, for instance '); 25 print('and <build-group> is the name of a buildbot group, for instance ');
25 print('`vm-kernel`, and options are:'); 26 print('`vm-kernel`, and options are:');
26 print(argParser.usage); 27 print(argParser.usage);
27 } 28 }
28 29
29 main(List<String> args) async { 30 Future main(List<String> args) async {
30 ArgParser argParser = createArgParser(); 31 ArgParser argParser = createArgParser();
31 argParser.addOption("run-count", 32 argParser.addOption("run-count",
32 defaultsTo: "10", help: "How many previous runs should be fetched"); 33 defaultsTo: "10", help: "How many previous runs should be fetched");
33 ArgResults argResults = argParser.parse(args); 34 ArgResults argResults = argParser.parse(args);
34 processArgResults(argResults); 35 processArgResults(argResults);
35 36
36 var runCount = int.parse(argResults['run-count'], onError: (_) => null); 37 var runCount = int.parse(argResults['run-count'], onError: (_) => null);
37 38
38 if (argResults.rest.length < 1 || argResults['help'] || runCount == null) { 39 if (argResults.rest.length < 1 || argResults['help'] || runCount == null) {
39 help(argParser); 40 help(argParser);
40 if (argResults['help']) return; 41 if (argResults['help']) return;
41 exit(1); 42 exit(1);
42 } 43 }
43 44
44 Bot bot = new Bot(logdog: argResults['logdog']); 45 Bot bot = new Bot(logdog: argResults['logdog']);
45 await mainInternal(bot, argResults.rest, runCount: runCount); 46 await mainInternal(bot, argResults.rest, runCount: runCount);
46 bot.close(); 47 bot.close();
47 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698