Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart

Issue 3007443002: Use memory source files in compile_from_dill* (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Helper to test compilation equivalence between source and .dill based 5 // Helper to test compilation equivalence between source and .dill based
6 // compilation. 6 // compilation.
Siggi Cherem (dart-lang) 2017/08/23 20:51:08 seems like we have misnomer now - both are from so
Johnni Winther 2017/08/30 08:53:19 Will do.
7 library dart2js.kernel.compile_from_dill_test_helper; 7 library dart2js.kernel.compile_from_dill_test_helper;
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
11 import 'package:compiler/compiler_new.dart'; 11 import 'package:compiler/compiler_new.dart';
12 import 'package:compiler/src/commandline_options.dart'; 12 import 'package:compiler/src/commandline_options.dart';
13 import 'package:compiler/src/common.dart'; 13 import 'package:compiler/src/common.dart';
14 import 'package:compiler/src/compiler.dart'; 14 import 'package:compiler/src/compiler.dart';
15 import 'package:compiler/src/elements/elements.dart'; 15 import 'package:compiler/src/elements/elements.dart';
16 import 'package:compiler/src/elements/types.dart'; 16 import 'package:compiler/src/elements/types.dart';
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 {bool skipWarnings: false, 257 {bool skipWarnings: false,
258 bool skipErrors: false, 258 bool skipErrors: false,
259 bool verbose: false, 259 bool verbose: false,
260 List<String> options: const <String>[], 260 List<String> options: const <String>[],
261 bool expectAstEquivalence: false, 261 bool expectAstEquivalence: false,
262 bool expectIdenticalOutput: true}) async { 262 bool expectIdenticalOutput: true}) async {
263 enableDebugMode(); 263 enableDebugMode();
264 EnumCreator.matchKernelRepresentationForTesting = true; 264 EnumCreator.matchKernelRepresentationForTesting = true;
265 Elements.usePatchedDart2jsSdkSorting = true; 265 Elements.usePatchedDart2jsSdkSorting = true;
266 266
267 entryPoint =
268 await createTemp(entryPoint, memorySourceFiles, printSteps: true);
269
270 print('---- compile from ast ----------------------------------------------'); 267 print('---- compile from ast ----------------------------------------------');
271 DiagnosticCollector collector = new DiagnosticCollector(); 268 DiagnosticCollector collector = new DiagnosticCollector();
272 OutputCollector collector1 = new OutputCollector(); 269 OutputCollector collector1 = new OutputCollector();
273 Compiler compiler1 = compilerFor( 270 Compiler compiler1 = compilerFor(
274 entryPoint: entryPoint, 271 entryPoint: entryPoint,
272 memorySourceFiles: memorySourceFiles,
275 diagnosticHandler: collector, 273 diagnosticHandler: collector,
276 outputProvider: collector1, 274 outputProvider: collector1,
277 options: <String>[]..addAll(commonOptions)..addAll(options)); 275 options: <String>[]..addAll(commonOptions)..addAll(options));
278 ElementResolutionWorldBuilder.useInstantiationMap = true; 276 ElementResolutionWorldBuilder.useInstantiationMap = true;
279 compiler1.resolution.retainCachesForTesting = true; 277 compiler1.resolution.retainCachesForTesting = true;
280 await compiler1.run(entryPoint); 278 await compiler1.run(entryPoint);
281 if (collector.crashes.isNotEmpty) { 279 if (collector.crashes.isNotEmpty) {
282 print('Skipping due to crashes.'); 280 print('Skipping due to crashes.');
283 return ResultKind.crashes; 281 return ResultKind.crashes;
284 } 282 }
285 if (collector.errors.isNotEmpty && skipErrors) { 283 if (collector.errors.isNotEmpty && skipErrors) {
286 print('Skipping due to errors.'); 284 print('Skipping due to errors.');
287 return ResultKind.errors; 285 return ResultKind.errors;
288 } 286 }
289 if (collector.warnings.isNotEmpty && skipWarnings) { 287 if (collector.warnings.isNotEmpty && skipWarnings) {
290 print('Skipping due to warnings.'); 288 print('Skipping due to warnings.');
291 return ResultKind.warnings; 289 return ResultKind.warnings;
292 } 290 }
293 Expect.isFalse(compiler1.compilationFailed); 291 Expect.isFalse(compiler1.compilationFailed);
294 ClosedWorld closedWorld1 = 292 ClosedWorld closedWorld1 =
295 compiler1.resolutionWorldBuilder.closedWorldForTesting; 293 compiler1.resolutionWorldBuilder.closedWorldForTesting;
296 294
297 OutputCollector collector2 = new OutputCollector(); 295 OutputCollector collector2 = new OutputCollector();
298 Compiler compiler2 = await compileWithDill( 296 Compiler compiler2 = await compileWithDill(
299 entryPoint: entryPoint, 297 entryPoint: entryPoint,
298 memorySourceFiles: memorySourceFiles,
300 options: <String>[]..addAll(commonOptions)..addAll(options), 299 options: <String>[]..addAll(commonOptions)..addAll(options),
301 printSteps: true, 300 printSteps: true,
302 compilerOutput: collector2); 301 compilerOutput: collector2);
303 302
304 KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy; 303 KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
305 KernelToElementMap elementMap = frontendStrategy.elementMap; 304 KernelToElementMap elementMap = frontendStrategy.elementMap;
306 305
307 Expect.isFalse(compiler2.compilationFailed); 306 Expect.isFalse(compiler2.compilationFailed);
308 307
309 KernelEquivalence equivalence1 = new KernelEquivalence(elementMap); 308 KernelEquivalence equivalence1 = new KernelEquivalence(elementMap);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType]; 373 Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType];
375 checkSets(map1.keys, map2.keys, 'output', equality); 374 checkSets(map1.keys, map2.keys, 'output', equality);
376 map1.forEach((String name, BufferedOutputSink output1) { 375 map1.forEach((String name, BufferedOutputSink output1) {
377 BufferedOutputSink output2 = map2[name]; 376 BufferedOutputSink output2 = map2[name];
378 Expect.stringEquals(output1.text, output2.text); 377 Expect.stringEquals(output1.text, output2.text);
379 }); 378 });
380 }); 379 });
381 } 380 }
382 return ResultKind.success; 381 return ResultKind.success;
383 } 382 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | tests/compiler/dart2js/kernel/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698