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

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

Issue 2013763002: Add names and support for preserialized data to serialization tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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_compilation_test; 5 library dart2js.serialization_compilation_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/compiler.dart'; 9 import 'package:compiler/src/compiler.dart';
10 import 'package:compiler/src/filenames.dart'; 10 import 'package:compiler/src/filenames.dart';
11 import '../memory_compiler.dart'; 11 import '../memory_compiler.dart';
12 import 'helper.dart'; 12 import 'helper.dart';
13 import 'test_data.dart'; 13 import 'test_data.dart';
14 import '../output_collector.dart'; 14 import '../output_collector.dart';
15 15
16 main(List<String> args) { 16 main(List<String> args) {
17 asyncTest(() async { 17 asyncTest(() async {
18 Arguments arguments = new Arguments.from(args); 18 Arguments arguments = new Arguments.from(args);
19 SerializedData serializedData = 19 SerializedData serializedData =
20 await serializeDartCore(arguments: arguments); 20 await serializeDartCore(arguments: arguments);
21 if (arguments.filename != null) { 21 if (arguments.filename != null) {
22 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename)); 22 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
23 await compile(serializedData, entryPoint, null); 23 await compile(
24 entryPoint,
25 resolutionInputs: serializedData.toUris(),
26 sourceFiles: serializedData.toMemorySourceFiles());
24 } else { 27 } else {
25 Uri entryPoint = Uri.parse('memory:main.dart'); 28 Uri entryPoint = Uri.parse('memory:main.dart');
26 await arguments.forEachTest(TESTS, (int index, Test test) async { 29 await arguments.forEachTest(serializedData, TESTS, compile);
27 await compile(serializedData, entryPoint, test,
28 index: index,
29 verbose: arguments.verbose);
30 });
31 } 30 }
32 }); 31 });
33 } 32 }
34 33
35 Future compile(SerializedData serializedData, Uri entryPoint, Test test, 34 Future compile(
36 {int index, bool verbose: false}) async { 35 Uri entryPoint,
37 String testDescription = 36 {Map<String, String> sourceFiles: const <String, String>{},
38 test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}'; 37 List<Uri> resolutionInputs,
38 int index,
39 Test test,
40 bool verbose: false}) async {
41 String testDescription = test != null ? test.name : '${entryPoint}';
42 String id = index != null ? '$index: ' : '';
39 print('------------------------------------------------------------------'); 43 print('------------------------------------------------------------------');
40 print('compile ${index != null ? '$index:' :''}${testDescription}'); 44 print('compile ${id}${testDescription}');
41 print('------------------------------------------------------------------'); 45 print('------------------------------------------------------------------');
42 OutputCollector outputCollector = new OutputCollector(); 46 OutputCollector outputCollector = new OutputCollector();
43 await runCompiler( 47 await runCompiler(
44 entryPoint: entryPoint, 48 entryPoint: entryPoint,
45 resolutionInputs: serializedData.toUris(), 49 memorySourceFiles: sourceFiles,
46 memorySourceFiles: serializedData.toMemorySourceFiles( 50 resolutionInputs: resolutionInputs,
47 test != null ? test.sourceFiles : null),
48 options: [], 51 options: [],
49 outputProvider: outputCollector); 52 outputProvider: outputCollector);
50 if (verbose) { 53 if (verbose) {
51 print(outputCollector.getOutput('', 'js')); 54 print(outputCollector.getOutput('', 'js'));
52 } 55 }
53 } 56 }
54 57
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization/analysis_test.dart ('k') | tests/compiler/dart2js/serialization/helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698