| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library dart2js.analyze_test.test; | 5 library dart2js.analyze_test.test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:compiler/src/apiimpl.dart' show | 10 import 'package:compiler/src/apiimpl.dart' show CompilerImpl; |
| 11 CompilerImpl; | |
| 12 import 'package:compiler/src/commandline_options.dart'; | 11 import 'package:compiler/src/commandline_options.dart'; |
| 13 import 'package:compiler/src/diagnostics/messages.dart' show | 12 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; |
| 14 MessageKind; | 13 import 'package:compiler/src/filenames.dart' show nativeToUriPath; |
| 15 import 'package:compiler/src/filenames.dart' show | |
| 16 nativeToUriPath; | |
| 17 | 14 |
| 18 import 'analyze_helper.dart'; | 15 import 'analyze_helper.dart'; |
| 19 import 'memory_compiler.dart'; | 16 import 'memory_compiler.dart'; |
| 20 | 17 |
| 21 /** | 18 /** |
| 22 * Map of white-listed warnings and errors. | 19 * Map of white-listed warnings and errors. |
| 23 * | 20 * |
| 24 * Use an identifiable suffix of the file uri as key. Use a fixed substring of | 21 * Use an identifiable suffix of the file uri as key. Use a fixed substring of |
| 25 * the error/warning message in the list of white-listings for each file. | 22 * the error/warning message in the list of white-listings for each file. |
| 26 */ | 23 */ |
| 27 // TODO(johnniwinther): Support canonical URIs as keys. | 24 // TODO(johnniwinther): Support canonical URIs as keys. |
| 28 const Map<String, List/*<String|MessageKind>*/> WHITE_LIST = const { | 25 const Map<String, List/*<String|MessageKind>*/ > WHITE_LIST = const { |
| 29 "/test/lib/src/util/": const [ | 26 "/test/lib/src/util/": const [ |
| 30 "Library 'package:async/async.dart' doesn't export a " | 27 "Library 'package:async/async.dart' doesn't export a " |
| 31 "'ForkableStream' declaration.", | 28 "'ForkableStream' declaration.", |
| 32 ], | 29 ], |
| 33 "/utils.dart": const [ | 30 "/utils.dart": const [ |
| 34 "Duplicated library name 'utils'.", | 31 "Duplicated library name 'utils'.", |
| 35 ], | 32 ], |
| 36 }; | 33 }; |
| 37 | 34 |
| 38 const List<String> SKIP_LIST = const <String>[ | 35 const List<String> SKIP_LIST = const <String>[ |
| 39 // Helper files: | 36 // Helper files: |
| 40 "/data/", | 37 "/data/", |
| 41 "quarantined/http_launch_data/", | 38 "quarantined/http_launch_data/", |
| 42 "mirrors_helper.dart", | 39 "mirrors_helper.dart", |
| 43 "path%20with%20spaces/", | 40 "path%20with%20spaces/", |
| 44 // Broken tests: | 41 // Broken tests: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 75 options.add(argument == '-v' ? Flags.verbose : argument); | 72 options.add(argument == '-v' ? Flags.verbose : argument); |
| 76 } else if (first) { | 73 } else if (first) { |
| 77 File file = new File(argument); | 74 File file = new File(argument); |
| 78 if (file.existsSync()) { | 75 if (file.existsSync()) { |
| 79 // Read test files from [file]. | 76 // Read test files from [file]. |
| 80 for (String line in file.readAsLinesSync()) { | 77 for (String line in file.readAsLinesSync()) { |
| 81 line = line.trim(); | 78 line = line.trim(); |
| 82 if (line.startsWith('Analyzing uri: ')) { | 79 if (line.startsWith('Analyzing uri: ')) { |
| 83 int filenameOffset = line.indexOf('tests/compiler/dart2js/'); | 80 int filenameOffset = line.indexOf('tests/compiler/dart2js/'); |
| 84 if (filenameOffset != -1) { | 81 if (filenameOffset != -1) { |
| 85 uriList.add(Uri.base.resolve( | 82 uriList.add(Uri.base |
| 86 nativeToUriPath(line.substring(filenameOffset)))); | 83 .resolve(nativeToUriPath(line.substring(filenameOffset)))); |
| 87 } | 84 } |
| 88 } | 85 } |
| 89 } | 86 } |
| 90 } else { | 87 } else { |
| 91 // Use argument as filter on test files. | 88 // Use argument as filter on test files. |
| 92 filter = argument; | 89 filter = argument; |
| 93 } | 90 } |
| 94 } else { | 91 } else { |
| 95 throw new ArgumentError("Extra argument $argument in $arguments."); | 92 throw new ArgumentError("Extra argument $argument in $arguments."); |
| 96 } | 93 } |
| 97 first = false; | 94 first = false; |
| 98 } | 95 } |
| 99 | 96 |
| 100 asyncTest(() async { | 97 asyncTest(() async { |
| 101 if (uriList.isEmpty) { | 98 if (uriList.isEmpty) { |
| 102 uriList = computeInputUris(filter: filter); | 99 uriList = computeInputUris(filter: filter); |
| 103 } | 100 } |
| 104 await analyze( | 101 await analyze(uriList, WHITE_LIST, |
| 105 uriList, | 102 mode: AnalysisMode.URI, options: options); |
| 106 WHITE_LIST, | |
| 107 mode: AnalysisMode.URI, | |
| 108 options: options); | |
| 109 }); | 103 }); |
| 110 } | 104 } |
| OLD | NEW |