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 /// Tests code generation. | 5 /// Tests code generation. |
6 /// | 6 /// |
7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks | 7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks |
8 /// that the output is what we expected. | 8 /// that the output is what we expected. |
9 library dev_compiler.test.codegen_test; | 9 library dev_compiler.test.codegen_test; |
10 | 10 |
11 // TODO(rnystrom): This doesn't actually run any tests any more. It just | 11 // TODO(rnystrom): This doesn't actually run any tests any more. It just |
12 // compiles stuff. This should be changed to not use unittest and just be a | 12 // compiles stuff. This should be changed to not use unittest and just be a |
13 // regular program that outputs files. | 13 // regular program that outputs files. |
14 | 14 |
15 import 'dart:convert'; | |
15 import 'dart:io' show Directory, File, Platform; | 16 import 'dart:io' show Directory, File, Platform; |
16 import 'package:analyzer/analyzer.dart' | 17 import 'package:analyzer/analyzer.dart' |
17 show | 18 show |
18 ExportDirective, | 19 ExportDirective, |
19 ImportDirective, | 20 ImportDirective, |
20 StringLiteral, | 21 StringLiteral, |
21 UriBasedDirective, | 22 UriBasedDirective, |
22 parseDirectives; | 23 parseDirectives; |
23 import 'package:analyzer/src/command_line/arguments.dart' | 24 import 'package:analyzer/src/command_line/arguments.dart' |
24 show defineAnalysisArguments; | 25 show defineAnalysisArguments; |
25 import 'package:analyzer/src/dart/ast/ast.dart'; | 26 import 'package:analyzer/src/dart/ast/ast.dart'; |
26 import 'package:analyzer/src/generated/source.dart' show Source; | 27 import 'package:analyzer/src/generated/source.dart' show Source; |
27 import 'package:args/args.dart' show ArgParser, ArgResults; | 28 import 'package:args/args.dart' show ArgParser, ArgResults; |
28 import 'package:dev_compiler/src/analyzer/context.dart'; | 29 import 'package:dev_compiler/src/analyzer/context.dart'; |
29 import 'package:dev_compiler/src/compiler/compiler.dart' | 30 import 'package:dev_compiler/src/compiler/compiler.dart' |
30 show BuildUnit, CompilerOptions, JSModuleFile, ModuleCompiler; | 31 show BuildUnit, CompilerOptions, JSModuleFile, ModuleCompiler; |
31 import 'package:dev_compiler/src/compiler/module_builder.dart' | 32 import 'package:dev_compiler/src/compiler/module_builder.dart' |
32 show ModuleFormat, addModuleFormatOptions, parseModuleFormatOption; | 33 show ModuleFormat, addModuleFormatOptions, parseModuleFormatOption; |
33 import 'package:path/path.dart' as path; | 34 import 'package:path/path.dart' as path; |
34 import 'package:test/test.dart' show expect, isFalse, isTrue, test; | 35 import 'package:test/test.dart' show expect, isFalse, isTrue, test; |
36 import 'package:status_file/expectation.dart'; | |
37 import 'package:test_dart/path.dart' as test_dart; | |
38 import 'package:test_dart/test_suite.dart' show StandardTestSuite; | |
39 import 'package:test_dart/utils.dart'; | |
40 import 'package:test_dart/options.dart'; | |
35 | 41 |
36 import '../tool/build_sdk.dart' as build_sdk; | 42 import '../tool/build_sdk.dart' as build_sdk; |
37 import 'compile_error_tests.dart'; | |
38 import 'multitest.dart' show extractTestsFromMultitest, isMultiTest; | 43 import 'multitest.dart' show extractTestsFromMultitest, isMultiTest; |
39 import 'testing.dart' show repoDirectory, testDirectory; | 44 import 'testing.dart' show repoDirectory, testDirectory; |
40 | 45 |
41 final ArgParser argParser = new ArgParser() | 46 final ArgParser argParser = new ArgParser() |
42 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); | 47 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); |
43 | 48 |
44 /// The `test/codegen` directory. | 49 /// The `test/codegen` directory. |
45 final codegenDir = path.join(testDirectory, 'codegen'); | 50 final codegenDir = path.join(testDirectory, 'codegen'); |
46 | 51 |
47 /// The `test/codegen/expect` directory. | 52 /// The `test/codegen/expect` directory. |
(...skipping 27 matching lines...) Expand all Loading... | |
75 | 80 |
76 var summaryPaths = new Directory(path.join(codegenOutputDir, 'pkg')) | 81 var summaryPaths = new Directory(path.join(codegenOutputDir, 'pkg')) |
77 .listSync() | 82 .listSync() |
78 .map((e) => e.path) | 83 .map((e) => e.path) |
79 .where((p) => p.endsWith('.sum')) | 84 .where((p) => p.endsWith('.sum')) |
80 .toList(); | 85 .toList(); |
81 | 86 |
82 var sharedCompiler = new ModuleCompiler(new AnalyzerOptions.basic( | 87 var sharedCompiler = new ModuleCompiler(new AnalyzerOptions.basic( |
83 dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths)); | 88 dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths)); |
84 | 89 |
85 var testDirs = [ | 90 var testDirs = ['language', 'corelib', 'lib']; |
86 'language', | |
87 'corelib', | |
88 path.join('lib', 'async'), | |
89 path.join('lib', 'collection'), | |
90 path.join('lib', 'convert'), | |
91 path.join('lib', 'html'), | |
92 path.join('lib', 'math'), | |
93 path.join('lib', 'mirrors'), | |
94 path.join('lib', 'typed_data'), | |
95 ]; | |
96 | 91 |
97 // Copy all of the test files and expanded multitest files to | 92 // Copy all of the test files and expanded multitest files to |
98 // gen/codegen_tests. We'll compile from there. | 93 // gen/codegen_tests. We'll compile from there. |
94 TestUtils.setDartDirUri(Platform.script.resolve('../../..')); | |
99 var testFiles = _setUpTests(testDirs); | 95 var testFiles = _setUpTests(testDirs); |
96 _writeRuntimeStatus(testFiles); | |
97 return; //!!! | |
vsm
2017/07/31 21:02:20
Did you mean to leave that return here?
Jennifer Messerly
2017/07/31 21:24:55
Oops! after I got it passing with the compile erro
| |
100 | 98 |
101 // Our default compiler options. Individual tests can override these. | 99 // Our default compiler options. Individual tests can override these. |
102 var defaultOptions = ['--no-source-map', '--no-summarize']; | 100 var defaultOptions = ['--no-source-map', '--no-summarize']; |
103 var compileArgParser = new ArgParser(); | 101 var compileArgParser = new ArgParser(); |
104 defineAnalysisArguments(compileArgParser, ddc: true); | 102 defineAnalysisArguments(compileArgParser, ddc: true); |
105 AnalyzerOptions.addArguments(compileArgParser); | 103 AnalyzerOptions.addArguments(compileArgParser); |
106 CompilerOptions.addArguments(compileArgParser); | 104 CompilerOptions.addArguments(compileArgParser); |
107 addModuleFormatOptions(compileArgParser); | 105 addModuleFormatOptions(compileArgParser); |
108 | 106 |
109 var testFileOptionsMatcher = | 107 var testFileOptionsMatcher = |
110 new RegExp(r'// (compile options: |SharedOptions=)(.*)', multiLine: true); | 108 new RegExp(r'// (compile options: |SharedOptions=)(.*)', multiLine: true); |
111 | 109 |
112 // Ignore dart2js options that we don't support in DDC. | 110 // Ignore dart2js options that we don't support in DDC. |
113 var ignoreOptions = [ | 111 var ignoreOptions = [ |
114 '--enable-enum', | 112 '--enable-enum', |
115 '--experimental-trust-js-interop-type-annotations', | 113 '--experimental-trust-js-interop-type-annotations', |
116 '--trust-type-annotations', | 114 '--trust-type-annotations', |
117 '--supermixin' | 115 '--supermixin' |
118 ]; | 116 ]; |
119 | 117 |
120 // Compile each test file to JS and put the result in gen/codegen_output. | 118 // Compile each test file to JS and put the result in gen/codegen_output. |
121 for (var testFile in testFiles) { | 119 testFiles.forEach((testFile, expectations) { |
122 var relativePath = path.relative(testFile, from: codegenTestDir); | 120 var relativePath = path.relative(testFile, from: codegenTestDir); |
123 | 121 |
124 // Only compile the top-level files for generating coverage. | 122 // Only compile the top-level files for generating coverage. |
125 bool isTopLevelTest = path.dirname(relativePath) == "."; | 123 bool isTopLevelTest = path.dirname(relativePath) == "."; |
126 if (codeCoverage && !isTopLevelTest) continue; | 124 if (codeCoverage && !isTopLevelTest) return; |
127 | 125 |
128 var name = path.withoutExtension(relativePath); | 126 var name = path.withoutExtension(relativePath); |
129 test('dartdevc $name', () { | 127 test('dartdevc $name', () { |
130 // Check if we need to use special compile options. | 128 // Check if we need to use special compile options. |
131 var contents = new File(testFile).readAsStringSync(); | 129 var contents = new File(testFile).readAsStringSync(); |
132 var match = testFileOptionsMatcher.firstMatch(contents); | 130 var match = testFileOptionsMatcher.firstMatch(contents); |
133 | 131 |
134 var args = defaultOptions.toList(); | 132 var args = defaultOptions.toList(); |
135 if (match != null) { | 133 if (match != null) { |
136 var matchedArgs = match.group(2).split(' '); | 134 var matchedArgs = match.group(2).split(' '); |
(...skipping 25 matching lines...) Expand all Loading... | |
162 } catch (e, st) { | 160 } catch (e, st) { |
163 exception = e; | 161 exception = e; |
164 stackTrace = st; | 162 stackTrace = st; |
165 } | 163 } |
166 | 164 |
167 // This covers tests where the intent of the test is to validate that | 165 // This covers tests where the intent of the test is to validate that |
168 // some static error is produced. | 166 // some static error is produced. |
169 var intentionalCompileError = contents.contains(': compile-time error') || | 167 var intentionalCompileError = contents.contains(': compile-time error') || |
170 contents.contains('/*@compile-error='); | 168 contents.contains('/*@compile-error='); |
171 | 169 |
172 // This covers tests that should not produce a static error but that | 170 var crashing = expectations.contains(Expectation.crash); |
173 // currently do due to issues in our implementation. | |
174 var knownCompileError = compileErrorTests.contains(name); | |
175 | |
176 var crashing = _crashingTests.contains(name); | |
177 var inconsistent = _inconsistentTests.contains(name); | |
178 | |
179 if (module == null) { | 171 if (module == null) { |
180 expect(crashing, isTrue, | 172 expect(crashing, isTrue, |
181 reason: "test $name crashes during compilation.\n" | 173 reason: "test $name crashes during compilation.\n" |
182 "$exception\n$stackTrace"); | 174 "$exception\n$stackTrace"); |
183 return; | 175 return; |
184 } | 176 } |
185 | 177 |
186 // Write out JavaScript and/or compilation errors/warnings. | 178 // Write out JavaScript and/or compilation errors/warnings. |
187 _writeModule( | 179 _writeModule( |
188 path.join(codegenOutputDir, name), | 180 path.join(codegenOutputDir, name), |
189 isTopLevelTest ? path.join(codegenExpectDir, name) : null, | 181 isTopLevelTest ? path.join(codegenExpectDir, name) : null, |
190 moduleFormat, | 182 moduleFormat, |
191 module); | 183 module); |
192 | 184 |
193 expect(crashing, isFalse, reason: "test $name no longer crashes."); | 185 expect(crashing, isFalse, reason: "test $name no longer crashes."); |
194 | 186 |
195 if (inconsistent) { | 187 var knownCompileError = |
196 // An inconsistent test will only compile on some platforms (see | 188 expectations.contains(Expectation.compileTimeError); |
197 // comment below). It should not crash however. | 189 if (module.isValid) { |
198 } else if (module.isValid) { | |
199 // TODO(vsm): We don't seem to trip on non-strong errors? | |
200 // expect(expectedCompileTimeError, isFalse, | |
201 // reason: "test $name expected compilation errors, but compiled."); | |
202 expect(knownCompileError, isFalse, | 190 expect(knownCompileError, isFalse, |
203 reason: "test $name expected static errors, but compiled."); | 191 reason: "test $name expected static errors, but compiled."); |
204 } else { | 192 } else { |
205 var reason = intentionalCompileError ? "intended" : "unexpected"; | 193 var reason = intentionalCompileError ? "intended" : "unexpected"; |
206 expect(intentionalCompileError || knownCompileError, isTrue, | 194 expect(intentionalCompileError || knownCompileError, isTrue, |
207 reason: "test $name failed to compile due to $reason errors:" | 195 reason: "test $name failed to compile due to $reason errors:" |
208 "\n\n${module.errors.join('\n')}."); | 196 "\n\n${module.errors.join('\n')}."); |
209 } | 197 } |
210 }); | 198 }); |
211 } | 199 }); |
212 | 200 |
213 if (filePattern.hasMatch('sunflower')) { | 201 if (filePattern.hasMatch('sunflower')) { |
214 test('sunflower', () { | 202 test('sunflower', () { |
215 _buildSunflower(sharedCompiler, codegenOutputDir, codegenExpectDir); | 203 _buildSunflower(sharedCompiler, codegenOutputDir, codegenExpectDir); |
216 }); | 204 }); |
217 } | 205 } |
218 | 206 |
219 if (codeCoverage) { | 207 if (codeCoverage) { |
220 test('build_sdk code coverage', () { | 208 test('build_sdk code coverage', () { |
221 return build_sdk.main(['--dart-sdk', sdkDir, '-o', codegenOutputDir]); | 209 return build_sdk.main(['--dart-sdk', sdkDir, '-o', codegenOutputDir]); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 } | 257 } |
270 | 258 |
271 String _moduleForLibrary(Source source) { | 259 String _moduleForLibrary(Source source) { |
272 var scheme = source.uri.scheme; | 260 var scheme = source.uri.scheme; |
273 if (scheme == 'package') { | 261 if (scheme == 'package') { |
274 return source.uri.pathSegments.first; | 262 return source.uri.pathSegments.first; |
275 } | 263 } |
276 throw new Exception('Module not found for library "${source.fullName}"'); | 264 throw new Exception('Module not found for library "${source.fullName}"'); |
277 } | 265 } |
278 | 266 |
279 List<String> _setUpTests(List<String> testDirs) { | 267 void _writeRuntimeStatus(Map<String, Set<Expectation>> testFiles) { |
280 var testFiles = <String>[]; | 268 var runtimeStatus = <String, String>{}; |
269 testFiles.forEach((name, status) { | |
270 name = path.withoutExtension(path.relative(name, from: codegenTestDir)); | |
271 // Skip tests that we don't expect to compile. | |
272 if (status.contains(Expectation.compileTimeError) || | |
273 status.contains(Expectation.crash)) { | |
274 return; | |
275 } | |
276 // Normalize the expectations for the Karma language_test.js runner. | |
277 if (status.remove(Expectation.ok)) assert(status.isNotEmpty); | |
278 if (status.remove(Expectation.missingCompileTimeError) || | |
279 status.remove(Expectation.missingRuntimeError)) { | |
280 status.add(Expectation.pass); | |
281 } | |
281 | 282 |
283 // Skip passing tests. | |
284 // TODO(jmesserly): we could record these for extra sanity checks. | |
285 if (status.length == 1 && status.contains(Expectation.pass)) { | |
286 return; | |
287 } | |
288 | |
289 runtimeStatus[name] = status.map((s) => '$s').join(','); | |
290 }); | |
291 new File(path.join(codegenOutputDir, 'test_status.js')).writeAsStringSync(''' | |
292 define([], function() { | |
293 'use strict'; | |
294 return ${new JsonEncoder.withIndent(' ').convert(runtimeStatus)}; | |
295 }); | |
296 '''); | |
297 } | |
298 | |
299 Map<String, Set<Expectation>> _setUpTests(List<String> testDirs) { | |
300 var testFiles = <String, Set<Expectation>>{}; | |
282 for (var testDir in testDirs) { | 301 for (var testDir in testDirs) { |
283 // TODO(rnystrom): Simplify this when the Dart 2.0 test migration is | 302 // TODO(rnystrom): Simplify this when the Dart 2.0 test migration is |
284 // complete (#30183). | 303 // complete (#30183). |
285 // Look for the tests in the "_strong" and "_2" directories in the SDK's | 304 // Look for the tests in the "_strong" and "_2" directories in the SDK's |
286 // main "tests" directory. | 305 // main "tests" directory. |
287 var dirParts = path.split(testDir); | 306 var dirParts = path.split(testDir); |
288 | 307 |
289 for (var suffix in const ["_2", "_strong"]) { | 308 for (var suffix in const ["_2", "_strong"]) { |
290 var sdkTestDir = | 309 var sdkTestDir = path.join( |
291 path.join(dirParts[0] + suffix, path.joinAll(dirParts.skip(1))); | 310 'tests', dirParts[0] + suffix, path.joinAll(dirParts.skip(1))); |
292 var inputPath = | 311 var inputPath = path.join(testDirectory, '..', '..', '..', sdkTestDir); |
293 path.join(testDirectory, '..', '..', '..', 'tests', sdkTestDir); | |
294 | 312 |
295 if (!new Directory(inputPath).existsSync()) continue; | 313 if (!new Directory(inputPath).existsSync()) continue; |
296 | 314 |
315 var browsers = Platform.environment['DDC_BROWSERS']; | |
316 var runtime = browsers == 'Firefox' ? 'firefox' : 'chrome'; | |
317 var config = new OptionsParser() | |
318 .parse('-m release -c dartdevc --use-sdk --strong'.split(' ') | |
319 ..addAll(['-r', runtime, '--suite_dir', sdkTestDir])) | |
320 .single; | |
321 | |
322 var testSuite = new StandardTestSuite.forDirectory( | |
323 config, new test_dart.Path(sdkTestDir)); | |
324 var expectations = testSuite.readExpectations(); | |
325 | |
297 for (var file in _listFiles(inputPath, recursive: true)) { | 326 for (var file in _listFiles(inputPath, recursive: true)) { |
298 var relativePath = path.relative(file, from: inputPath); | 327 var relativePath = path.relative(file, from: inputPath); |
299 var outputPath = path.join(codegenTestDir, testDir, relativePath); | 328 var outputPath = path.join(codegenTestDir, testDir, relativePath); |
300 | 329 |
301 _ensureDirectory(path.dirname(outputPath)); | 330 _ensureDirectory(path.dirname(outputPath)); |
302 | 331 |
303 if (file.endsWith("_test.dart")) { | 332 if (file.endsWith("_test.dart")) { |
333 var statusPath = path.withoutExtension(relativePath); | |
304 | 334 |
305 void _writeTest(String outputPath, String contents) { | 335 void _writeTest(String outputPath, String contents) { |
306 if (contents.contains('package:unittest/')) { | 336 if (contents.contains('package:unittest/')) { |
307 // TODO(jmesserly): we could use directive parsing, but that | 337 // TODO(jmesserly): we could use directive parsing, but that |
308 // feels like overkill. | 338 // feels like overkill. |
309 // Alternatively, we could detect "unittest" use at runtime. | 339 // Alternatively, we could detect "unittest" use at runtime. |
310 // We really need a better solution for Karma+mocha+unittest | 340 // We really need a better solution for Karma+mocha+unittest |
311 // integration. | 341 // integration. |
312 contents += '\nfinal _usesUnittestPackage = true;\n'; | 342 contents += '\nfinal _usesUnittestPackage = true;\n'; |
313 } | 343 } |
314 new File(outputPath).writeAsStringSync(contents); | 344 new File(outputPath).writeAsStringSync(contents); |
315 } | 345 } |
316 | 346 |
317 var contents = new File(file).readAsStringSync(); | 347 var contents = new File(file).readAsStringSync(); |
318 if (isMultiTest(contents)) { | 348 if (isMultiTest(contents)) { |
319 // It's a multitest, so expand it and add all of the variants. | 349 // It's a multitest, so expand it and add all of the variants. |
320 var tests = <String, String>{}; | 350 var tests = <String, String>{}; |
321 var outcomes = <String, Set<String>>{}; | 351 extractTestsFromMultitest(file, contents, tests, {}); |
322 extractTestsFromMultitest(file, contents, tests, outcomes); | |
323 | 352 |
324 var fileName = path.basenameWithoutExtension(file); | 353 var fileName = path.basenameWithoutExtension(file); |
325 var outputDir = path.dirname(outputPath); | 354 var outputDir = path.dirname(outputPath); |
326 tests.forEach((name, contents) { | 355 tests.forEach((name, contents) { |
327 var multiFile = | 356 var multiFile = |
328 path.join(outputDir, '${fileName}_${name}_multi.dart'); | 357 path.join(outputDir, '${fileName}_${name}_multi.dart'); |
329 testFiles.add(multiFile); | 358 testFiles[multiFile] = |
359 expectations.expectations("$statusPath/$name"); | |
330 | 360 |
331 _writeTest(multiFile, contents); | 361 _writeTest(multiFile, contents); |
332 }); | 362 }); |
333 } else { | 363 } else { |
334 // It's a single test suite. | 364 // It's a single test suite. |
335 testFiles.add(outputPath); | 365 testFiles[outputPath] = expectations.expectations(statusPath); |
336 } | 366 } |
337 | 367 |
338 // Write the test file. | 368 // Write the test file. |
339 // | 369 // |
340 // We do this even for multitests because import_self_test | 370 // We do this even for multitests because import_self_test |
341 // is a multitest, yet imports its own unexpanded form (!). | 371 // is a multitest, yet imports its own unexpanded form (!). |
342 _writeTest(outputPath, contents); | 372 _writeTest(outputPath, contents); |
343 | 373 |
344 } else { | 374 } else { |
345 // Copy the non-test file over, in case it is used as an import. | 375 // Copy the non-test file over, in case it is used as an import. |
346 new File(file).copySync(outputPath); | 376 new File(file).copySync(outputPath); |
347 } | 377 } |
348 } | 378 } |
349 } | 379 } |
350 } | 380 } |
351 | 381 |
352 // Also include the other special files that live at the top level directory. | 382 // Also include the other special files that live at the top level directory. |
353 for (var file in _listFiles(codegenDir)) { | 383 for (var file in _listFiles(codegenDir)) { |
354 var relativePath = path.relative(file, from: codegenDir); | 384 var relativePath = path.relative(file, from: codegenDir); |
355 var outputPath = path.join(codegenTestDir, relativePath); | 385 var outputPath = path.join(codegenTestDir, relativePath); |
356 | 386 |
357 new File(file).copySync(outputPath); | 387 new File(file).copySync(outputPath); |
358 if (file.endsWith(".dart")) { | 388 if (file.endsWith(".dart")) { |
359 testFiles.add(outputPath); | 389 testFiles[outputPath] = new Set()..add(Expectation.pass); |
360 } | 390 } |
361 } | 391 } |
362 | 392 |
363 return testFiles; | 393 return testFiles; |
364 } | 394 } |
365 | 395 |
366 /// Recursively creates [dir] if it doesn't exist. | 396 /// Recursively creates [dir] if it doesn't exist. |
367 void _ensureDirectory(String dir) { | 397 void _ensureDirectory(String dir) { |
368 new Directory(dir).createSync(recursive: true); | 398 new Directory(dir).createSync(recursive: true); |
369 } | 399 } |
370 | 400 |
371 /// Lists all of the files within [dir] that match [filePattern]. | 401 /// Lists all of the files within [dir] that match [filePattern]. |
372 Iterable<String> _listFiles(String dir, {bool recursive: false}) { | 402 Iterable<String> _listFiles(String dir, {bool recursive: false}) { |
373 return new Directory(dir) | 403 return new Directory(dir) |
374 .listSync(recursive: recursive, followLinks: false) | 404 .listSync(recursive: recursive, followLinks: false) |
375 .where((entry) { | 405 .where((e) => e is File && filePattern.hasMatch(e.path)) |
376 if (entry is! File) return false; | 406 .map((f) => f.path); |
377 | |
378 var filePath = entry.path; | |
379 if (!filePattern.hasMatch(filePath)) return false; | |
380 | |
381 return true; | |
382 }).map((file) => file.path); | |
383 } | 407 } |
384 | 408 |
385 /// Parse directives from [contents] and find the complete set of transitive | 409 /// Parse directives from [contents] and find the complete set of transitive |
386 /// imports, reading files as needed. | 410 /// imports, reading files as needed. |
387 /// | 411 /// |
388 /// This will not include dart:* libraries, as those are implicitly available. | 412 /// This will not include dart:* libraries, as those are implicitly available. |
389 void _collectTransitiveImports(String contents, Set<String> libraries, | 413 void _collectTransitiveImports(String contents, Set<String> libraries, |
390 {String packageRoot, String from}) { | 414 {String packageRoot, String from}) { |
391 var uri = from; | 415 var uri = from; |
392 if (packageRoot != null && path.isWithin(packageRoot, from)) { | 416 if (packageRoot != null && path.isWithin(packageRoot, from)) { |
(...skipping 25 matching lines...) Expand all Loading... | |
418 StringLiteral uriLiteral = directive.uri; | 442 StringLiteral uriLiteral = directive.uri; |
419 String uriContent = uriLiteral.stringValue; | 443 String uriContent = uriLiteral.stringValue; |
420 if (uriContent != null) { | 444 if (uriContent != null) { |
421 uriContent = uriContent.trim(); | 445 uriContent = uriContent.trim(); |
422 directive.uriContent = uriContent; | 446 directive.uriContent = uriContent; |
423 } | 447 } |
424 return (directive as UriBasedDirectiveImpl).validate() == null | 448 return (directive as UriBasedDirectiveImpl).validate() == null |
425 ? uriContent | 449 ? uriContent |
426 : null; | 450 : null; |
427 } | 451 } |
428 | |
429 /// Tests that, due to bugs, are strong-mode clean only on some platforms. | |
430 final _inconsistentTests = new Set<String>.from([ | |
431 // This test is clean on windows, but not linux/mac due to newline encoding. | |
432 // See: https://github.com/dart-lang/sdk/issues/27224 | |
433 'language/multiline_newline_test_02_multi', | |
434 ].map((p) => p.replaceAll('/', path.separator))); | |
435 | |
436 final _crashingTests = new Set<String>.from([ | |
437 // TODO(vsm): Fix these - they import files from a different directory | |
438 // - this triggers an invalid library root build error. | |
439 'lib/html/custom/attribute_changed_callback_test', | |
440 'lib/html/custom/constructor_calls_created_synchronously_test', | |
441 'lib/html/custom/entered_left_view_test', | |
442 'lib/html/custom/js_custom_test', | |
443 'lib/html/custom/mirrors_test', | |
444 'lib/html/custom/regress_194523002_test', | |
445 ].map((p) => p.replaceAll('/', path.separator))); | |
OLD | NEW |