OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:convert' show JSON; | 5 import 'dart:convert' show JSON; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import "package:status_file/expectation.dart"; | 8 import "package:status_file/expectation.dart"; |
9 | 9 |
10 import 'command.dart'; | 10 import 'command.dart'; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 | 332 |
333 String _extractRuntime(String configuration) { | 333 String _extractRuntime(String configuration) { |
334 // Extract runtime from a configuration, for example, | 334 // Extract runtime from a configuration, for example, |
335 // 'none-vm-checked release_ia32'. | 335 // 'none-vm-checked release_ia32'. |
336 List<String> runtime = configuration.split(' ')[0].split('-'); | 336 List<String> runtime = configuration.split(' ')[0].split('-'); |
337 return '${runtime[0]}-${runtime[1]}'; | 337 return '${runtime[0]}-${runtime[1]}'; |
338 } | 338 } |
339 | 339 |
340 void _printFailureSummary() { | 340 void _printFailureSummary() { |
341 var groupedStatuses = new Map<String, List<String>>(); | 341 var groupedStatuses = <String, List<String>>{}; |
342 statusToConfigs.forEach((String status, List<String> configs) { | 342 statusToConfigs.forEach((status, configs) { |
343 var runtimeToConfiguration = new Map<String, List<String>>(); | 343 var runtimeToConfiguration = <String, List<String>>{}; |
344 for (String config in configs) { | 344 for (var config in configs) { |
345 String runtime = _extractRuntime(config); | 345 var runtime = _extractRuntime(config); |
346 var runtimeConfigs = | 346 runtimeToConfiguration |
347 runtimeToConfiguration.putIfAbsent(runtime, () => <String>[]); | 347 .putIfAbsent(runtime, () => <String>[]) |
348 runtimeConfigs.add(config); | 348 .add(config); |
349 } | 349 } |
350 runtimeToConfiguration | 350 |
351 .forEach((String runtime, List<String> runtimeConfigs) { | 351 runtimeToConfiguration.forEach((runtime, runtimeConfigs) { |
352 runtimeConfigs.sort((a, b) => a.compareTo(b)); | 352 runtimeConfigs.sort((a, b) => a.compareTo(b)); |
353 List<String> statuses = groupedStatuses.putIfAbsent( | 353 var statuses = groupedStatuses.putIfAbsent( |
354 '$runtime: $runtimeConfigs', () => <String>[]); | 354 '$runtime: $runtimeConfigs', () => <String>[]); |
355 statuses.add(status); | 355 statuses.add(status); |
356 }); | 356 }); |
357 }); | 357 }); |
358 | 358 |
| 359 if (groupedStatuses.isEmpty) return; |
| 360 |
359 print('\n\nNecessary status file updates:'); | 361 print('\n\nNecessary status file updates:'); |
360 groupedStatuses.forEach((String config, List<String> statuses) { | 362 groupedStatuses.forEach((String config, List<String> statuses) { |
361 print(''); | 363 print(''); |
362 print('$config:'); | 364 print('$config:'); |
363 statuses.sort((a, b) => a.compareTo(b)); | 365 statuses.sort((a, b) => a.compareTo(b)); |
364 for (String status in statuses) { | 366 for (var status in statuses) { |
365 print(' $status'); | 367 print(' $status'); |
366 } | 368 } |
367 }); | 369 }); |
368 } | 370 } |
369 } | 371 } |
370 | 372 |
371 class SkippedCompilationsPrinter extends EventListener { | 373 class SkippedCompilationsPrinter extends EventListener { |
372 int _skippedCompilations = 0; | 374 int _skippedCompilations = 0; |
373 | 375 |
374 void done(TestCase test) { | 376 void done(TestCase test) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } | 671 } |
670 | 672 |
671 String _buildSummaryEnd(int failedTests) { | 673 String _buildSummaryEnd(int failedTests) { |
672 if (failedTests == 0) { | 674 if (failedTests == 0) { |
673 return '\n===\n=== All tests succeeded\n===\n'; | 675 return '\n===\n=== All tests succeeded\n===\n'; |
674 } else { | 676 } else { |
675 var pluralSuffix = failedTests != 1 ? 's' : ''; | 677 var pluralSuffix = failedTests != 1 ? 's' : ''; |
676 return '\n===\n=== ${failedTests} test$pluralSuffix failed\n===\n'; | 678 return '\n===\n=== ${failedTests} test$pluralSuffix failed\n===\n'; |
677 } | 679 } |
678 } | 680 } |
OLD | NEW |