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 ["Duplicated library name 'utils'.",], |
34 "Duplicated library name 'utils'.", | |
35 ], | |
36 }; | 31 }; |
37 | 32 |
38 const List<String> SKIP_LIST = const <String>[ | 33 const List<String> SKIP_LIST = const <String>[ |
39 // Helper files: | 34 // Helper files: |
40 "/data/", | 35 "/data/", |
41 "quarantined/http_launch_data/", | 36 "quarantined/http_launch_data/", |
42 "mirrors_helper.dart", | 37 "mirrors_helper.dart", |
43 "path%20with%20spaces/", | 38 "path%20with%20spaces/", |
44 // Broken tests: | 39 // Broken tests: |
45 "quarantined/http_test.dart", | 40 "quarantined/http_test.dart", |
(...skipping 29 matching lines...) Expand all Loading... |
75 options.add(argument == '-v' ? Flags.verbose : argument); | 70 options.add(argument == '-v' ? Flags.verbose : argument); |
76 } else if (first) { | 71 } else if (first) { |
77 File file = new File(argument); | 72 File file = new File(argument); |
78 if (file.existsSync()) { | 73 if (file.existsSync()) { |
79 // Read test files from [file]. | 74 // Read test files from [file]. |
80 for (String line in file.readAsLinesSync()) { | 75 for (String line in file.readAsLinesSync()) { |
81 line = line.trim(); | 76 line = line.trim(); |
82 if (line.startsWith('Analyzing uri: ')) { | 77 if (line.startsWith('Analyzing uri: ')) { |
83 int filenameOffset = line.indexOf('tests/compiler/dart2js/'); | 78 int filenameOffset = line.indexOf('tests/compiler/dart2js/'); |
84 if (filenameOffset != -1) { | 79 if (filenameOffset != -1) { |
85 uriList.add(Uri.base.resolve( | 80 uriList.add(Uri.base |
86 nativeToUriPath(line.substring(filenameOffset)))); | 81 .resolve(nativeToUriPath(line.substring(filenameOffset)))); |
87 } | 82 } |
88 } | 83 } |
89 } | 84 } |
90 } else { | 85 } else { |
91 // Use argument as filter on test files. | 86 // Use argument as filter on test files. |
92 filter = argument; | 87 filter = argument; |
93 } | 88 } |
94 } else { | 89 } else { |
95 throw new ArgumentError("Extra argument $argument in $arguments."); | 90 throw new ArgumentError("Extra argument $argument in $arguments."); |
96 } | 91 } |
97 first = false; | 92 first = false; |
98 } | 93 } |
99 | 94 |
100 asyncTest(() async { | 95 asyncTest(() async { |
101 if (uriList.isEmpty) { | 96 if (uriList.isEmpty) { |
102 uriList = computeInputUris(filter: filter); | 97 uriList = computeInputUris(filter: filter); |
103 } | 98 } |
104 await analyze( | 99 await analyze(uriList, WHITE_LIST, |
105 uriList, | 100 mode: AnalysisMode.URI, options: options); |
106 WHITE_LIST, | |
107 mode: AnalysisMode.URI, | |
108 options: options); | |
109 }); | 101 }); |
110 } | 102 } |
OLD | NEW |