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

Side by Side Diff: tests/compiler/dart2js/serialization/impact_test.dart

Issue 2004833003: Support multiple resolution inputs from command line. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix and check library separation Created 4 years, 6 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) 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.serialization_impact_test; 5 library dart2js.serialization_impact_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/commandline_options.dart'; 9 import 'package:compiler/src/commandline_options.dart';
10 import 'package:compiler/src/compiler.dart'; 10 import 'package:compiler/src/compiler.dart';
11 import 'package:compiler/src/filenames.dart'; 11 import 'package:compiler/src/filenames.dart';
12 import '../memory_compiler.dart'; 12 import '../memory_compiler.dart';
13 import 'helper.dart'; 13 import 'helper.dart';
14 import 'test_helper.dart'; 14 import 'test_helper.dart';
15 15
16 main(List<String> args) { 16 main(List<String> args) {
17 Arguments arguments = new Arguments.from(args); 17 Arguments arguments = new Arguments.from(args);
18 asyncTest(() async { 18 asyncTest(() async {
19 String serializedData = await serializeDartCore(arguments: arguments); 19 SerializedData serializedData =
20 await serializeDartCore(arguments: arguments);
20 if (arguments.filename != null) { 21 if (arguments.filename != null) {
21 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); 22 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
22 await check(serializedData, entryPoint); 23 await check(serializedData, entryPoint);
23 } else { 24 } else {
24 Uri entryPoint = Uri.parse('memory:main.dart'); 25 Uri entryPoint = Uri.parse('memory:main.dart');
25 await check(serializedData, entryPoint, 26 await check(serializedData, entryPoint,
26 sourceFiles: {'main.dart': 'main() {}'}, 27 sourceFiles: {'main.dart': 'main() {}'},
27 verbose: arguments.verbose); 28 verbose: arguments.verbose);
28 } 29 }
29 }); 30 });
30 } 31 }
31 32
32 Future check( 33 Future check(
33 String serializedData, 34 SerializedData serializedData,
34 Uri entryPoint, 35 Uri entryPoint,
35 {Map<String, String> sourceFiles: const <String, String>{}, 36 {Map<String, String> sourceFiles: const <String, String>{},
36 bool verbose: false}) async { 37 bool verbose: false}) async {
37 38
38 Compiler compilerNormal = compilerFor( 39 Compiler compilerNormal = compilerFor(
39 memorySourceFiles: sourceFiles, 40 memorySourceFiles: sourceFiles,
40 options: [Flags.analyzeAll]); 41 options: [Flags.analyzeAll]);
41 compilerNormal.resolution.retainCachesForTesting = true; 42 compilerNormal.resolution.retainCachesForTesting = true;
42 await compilerNormal.run(entryPoint); 43 await compilerNormal.run(entryPoint);
43 44
44 Compiler compilerDeserialized = compilerFor( 45 Compiler compilerDeserialized = compilerFor(
45 memorySourceFiles: sourceFiles, 46 memorySourceFiles: serializedData.toMemorySourceFiles(sourceFiles),
47 resolutionInputs: serializedData.toUris(),
46 options: [Flags.analyzeAll]); 48 options: [Flags.analyzeAll]);
47 compilerDeserialized.resolution.retainCachesForTesting = true; 49 compilerDeserialized.resolution.retainCachesForTesting = true;
48 compilerDeserialized.serialization.deserializeFromText(serializedData);
49 await compilerDeserialized.run(entryPoint); 50 await compilerDeserialized.run(entryPoint);
50 51
51 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose); 52 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose);
52 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698