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

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

Issue 2989453002: Add support for compiling Dart via the FE in dart2js. (Closed)
Patch Set: update status Created 3 years, 4 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 // Test that we can compile from dill and run the generated code with d8. 5 // Test that we can compile from dill and run the generated code with d8.
6 library dart2js.kernel.run_from_dill_test; 6 library dart2js.kernel.run_from_dill_test;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 entryPoint = Uri.parse('memory:main.dart'); 60 entryPoint = Uri.parse('memory:main.dart');
61 memorySourceFiles = SOURCE; 61 memorySourceFiles = SOURCE;
62 } 62 }
63 63
64 Uri dillFile = 64 Uri dillFile =
65 await generateDill(entryPoint, memorySourceFiles, printSteps: true); 65 await generateDill(entryPoint, memorySourceFiles, printSteps: true);
66 String output = uriPathToNative(dillFile.resolve('out.js').path); 66 String output = uriPathToNative(dillFile.resolve('out.js').path);
67 List<String> dart2jsArgs = [ 67 List<String> dart2jsArgs = [
68 dillFile.toString(), 68 dillFile.toString(),
69 '-o$output', 69 '-o$output',
70 Flags.loadFromDill, 70 Flags.useKernel,
71 Flags.disableTypeInference, 71 Flags.disableTypeInference,
72 Flags.disableInlining, 72 Flags.disableInlining,
73 Flags.enableAssertMessage 73 Flags.enableAssertMessage
74 ]; 74 ];
75 print('Running: dart2js ${dart2jsArgs.join(' ')}'); 75 print('Running: dart2js ${dart2jsArgs.join(' ')}');
76 76
77 await dart2js.internalMain(dart2jsArgs); 77 await dart2js.internalMain(dart2jsArgs);
78 78
79 print('---- run from dill --------------------------------------------'); 79 print('---- run from dill --------------------------------------------');
80 ProcessResult runResult = Process.runSync(d8executable, 80 ProcessResult runResult = Process.runSync(d8executable,
81 ['sdk/lib/_internal/js_runtime/lib/preambles/d8.js', output]); 81 ['sdk/lib/_internal/js_runtime/lib/preambles/d8.js', output]);
82 String out = '${runResult.stderr}\n${runResult.stdout}'; 82 String out = '${runResult.stderr}\n${runResult.stdout}';
83 print('d8 output:'); 83 print('d8 output:');
84 print(out); 84 print(out);
85 Expect.equals(0, runResult.exitCode); 85 Expect.equals(0, runResult.exitCode);
86 Expect.equals(OUTPUT, runResult.stdout.replaceAll('\r\n', '\n')); 86 Expect.equals(OUTPUT, runResult.stdout.replaceAll('\r\n', '\n'));
87 87
88 return ResultKind.success; 88 return ResultKind.success;
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698