| 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 /// 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:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| 11 import 'package:args/args.dart'; | 11 import 'package:args/args.dart'; |
| 12 import 'package:gardening/src/client.dart'; | 12 import 'package:gardening/src/bot.dart'; |
| 13 import 'package:gardening/src/compare_failures_impl.dart'; | 13 import 'package:gardening/src/compare_failures_impl.dart'; |
| 14 import 'package:gardening/src/util.dart'; | 14 import 'package:gardening/src/util.dart'; |
| 15 | 15 |
| 16 void help(ArgParser argParser) { | 16 void help(ArgParser argParser) { |
| 17 print('Given a <log-uri> finds all failing tests in that stdout. Then '); | 17 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.'); | 18 print('fetches earlier runs of the same bot and compares the results.'); |
| 19 print('This tool is particularly useful to detect flakes and their '); | 19 print('This tool is particularly useful to detect flakes and their '); |
| 20 print('frequency.'); | 20 print('frequency.'); |
| 21 print('Usage: compare_failures [options] '); | 21 print('Usage: compare_failures [options] '); |
| 22 print(' (<log-uri> [<log-uri> ...] | <build-group> [<build-group> ...])'); | 22 print(' (<log-uri> [<log-uri> ...] | <build-group> [<build-group> ...])'); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 processArgResults(argResults); | 34 processArgResults(argResults); |
| 35 | 35 |
| 36 var runCount = int.parse(argResults['run-count'], onError: (_) => null); | 36 var runCount = int.parse(argResults['run-count'], onError: (_) => null); |
| 37 | 37 |
| 38 if (argResults.rest.length < 1 || argResults['help'] || runCount == null) { | 38 if (argResults.rest.length < 1 || argResults['help'] || runCount == null) { |
| 39 help(argParser); | 39 help(argParser); |
| 40 if (argResults['help']) return; | 40 if (argResults['help']) return; |
| 41 exit(1); | 41 exit(1); |
| 42 } | 42 } |
| 43 | 43 |
| 44 BuildbotClient client = argResults['logdog'] | 44 Bot bot = new Bot(logdog: argResults['logdog']); |
| 45 ? new LogdogBuildbotClient() | 45 await mainInternal(bot, argResults.rest, runCount: runCount); |
| 46 : new HttpBuildbotClient(); | 46 bot.close(); |
| 47 await mainInternal(client, argResults.rest, runCount: runCount); | |
| 48 client.close(); | |
| 49 } | 47 } |
| OLD | NEW |