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

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

Issue 2942863002: Compile and run Hello World! (Closed)
Patch Set: Cleanup Created 3 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Partial test that the closed world computed from [WorldImpact]s derived from
Siggi Cherem (dart-lang) 2017/06/15 18:28:55 fix doc
Johnni Winther 2017/06/16 09:25:31 Done.
6 // kernel is equivalent to the original computed from resolution.
7 library dart2js.kernel.run_from_dill_test;
8
9 import 'dart:async';
10 import 'dart:io';
11
12 import 'package:async_helper/async_helper.dart';
13 import 'package:expect/expect.dart';
14 import 'package:compiler/src/commandline_options.dart';
15 import 'package:compiler/src/dart2js.dart' as dart2js;
16 import 'package:compiler/src/filenames.dart';
17
18 import 'compiler_helper.dart';
19 import '../sourcemaps/stacktrace_test.dart';
20 import '../serialization/helper.dart';
21
22 const SOURCE = const {
23 'main.dart': '''
24 main() {
25 print('Hello World!');
26 }
27 '''
28 };
29
30 main(List<String> args) {
31 asyncTest(() async {
32 await mainInternal(args);
33 });
34 }
35
36 enum ResultKind { crashes, errors, warnings, success, failure }
37
38 Future<ResultKind> mainInternal(List<String> args,
39 {bool skipWarnings: false, bool skipErrors: false}) async {
40 Arguments arguments = new Arguments.from(args);
41 Uri entryPoint;
42 Map<String, String> memorySourceFiles;
43 if (arguments.uri != null) {
44 entryPoint = arguments.uri;
45 memorySourceFiles = const <String, String>{};
46 } else {
47 entryPoint = Uri.parse('memory:main.dart');
48 memorySourceFiles = SOURCE;
49 }
50
51 Uri dillFile =
52 await createTemp(entryPoint, memorySourceFiles, printSteps: true);
53 String output = uriPathToNative(dillFile.resolve('out.js').path);
54 List<String> dart2jsArgs = [
55 dillFile.toString(),
56 '-o$output',
57 Flags.loadFromDill,
58 Flags.disableTypeInference,
59 Flags.disableInlining,
60 Flags.enableAssertMessage
61 ];
62 print('Running: dart2js ${dart2jsArgs.join(' ')}');
63
64 await dart2js.internalMain(dart2jsArgs);
65
66 print('---- run from dill --------------------------------------------');
67 ProcessResult runResult = Process.runSync(d8executable,
68 ['sdk/lib/_internal/js_runtime/lib/preambles/d8.js', output]);
69 String out = '${runResult.stderr}\n${runResult.stdout}';
70 print('d8 output:');
71 print(out);
72 Expect.equals(0, runResult.exitCode);
73
74 return ResultKind.success;
75 }
OLDNEW
« pkg/compiler/lib/src/ssa/ssa.dart ('K') | « tests/compiler/dart2js/kernel/compiler_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698