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

Side by Side Diff: pkg/front_end/test/fasta/bootstrap_test.dart

Issue 2719863003: Create Fasta bootstrap test. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/compiler_command_line.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:async' show
6 Future;
7
8 import 'dart:io' show
9 Directory,
10 Platform;
11
12 import 'dart:isolate' show
13 Isolate;
14
15 import 'package:async_helper/async_helper.dart' show
16 asyncEnd,
17 asyncStart;
18
19 import 'package:front_end/src/fasta/testing/kernel_chain.dart' show
20 computePatchedSdk;
21
22 import 'package:testing/testing.dart' show
23 StdioProcess;
24
25 Future main() async {
26 asyncStart();
27 Uri sourceCompiler = await Isolate.resolvePackageUri(
28 Uri.parse("package:front_end/src/fasta/bin/compile.dart"));
29 Uri packages = await Isolate.packageConfig;
30 try {
31 Directory tmp = await Directory.systemTemp.createTemp("fasta_bootstrap");
32 Uri compiledOnceCompiler = tmp.uri.resolve("fasta1.dill");
karlklose 2017/02/28 11:47:37 Why are these names ending in compiler?
ahe 2017/02/28 11:52:35 Because it means "compiler that was compiled once"
33 Uri compiledTwiceCompiler = tmp.uri.resolve("fasta2.dill");
34 try {
35 await runCompiler(sourceCompiler, sourceCompiler, compiledOnceCompiler);
36 await runCompiler(
37 compiledOnceCompiler, sourceCompiler, compiledTwiceCompiler);
38 } finally {
39 await tmp.delete(recursive: true);
40 }
41 } finally {
42 asyncEnd();
43 }
44 }
45
46 Future runCompiler(Uri compiler, Uri input, Uri output) async {
47 Uri patchedSdk = await computePatchedSdk();
48 Uri dartVm = Uri.base.resolve(Platform.resolvedExecutable);
49 StdioProcess result = await StdioProcess.run(
50 dartVm.toFilePath(),
51 <String>[
52 compiler.toFilePath(),
53 "--compile-sdk=${patchedSdk.toFilePath()}",
54 "--output=${output.toFilePath()}",
55 input.toFilePath(),
56 ]);
57 print(result.output);
58 if (result.exitCode != 1) {
59 // TODO(ahe): Due to known errors in the VM's patch files, this compiler
60 // should report an error. Also, it may not be able to compile everything
61 // yet.
62 throw "Compilation failed.";
63 }
64 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/compiler_command_line.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698