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

Unified Diff: pkg/front_end/test/fasta/bootstrap_test.dart

Issue 2719863003: Create Fasta bootstrap test. (Closed)
Patch Set: Address comments and dartfmt. Created 3 years, 10 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/fasta/bootstrap_test.dart
diff --git a/pkg/front_end/test/fasta/bootstrap_test.dart b/pkg/front_end/test/fasta/bootstrap_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f9e285160947e6859d2a6de901780a9ef6058354
--- /dev/null
+++ b/pkg/front_end/test/fasta/bootstrap_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async' show Future;
+
+import 'dart:io' show Directory, Platform;
+
+import 'dart:isolate' show Isolate;
+
+import 'package:async_helper/async_helper.dart' show asyncEnd, asyncStart;
+
+import 'package:front_end/src/fasta/testing/kernel_chain.dart'
+ show computePatchedSdk;
+
+import 'package:testing/testing.dart' show StdioProcess;
+
+Future main() async {
+ asyncStart();
+ Uri sourceCompiler = await Isolate.resolvePackageUri(
+ Uri.parse("package:front_end/src/fasta/bin/compile.dart"));
+ Uri packages = await Isolate.packageConfig;
+ try {
+ Directory tmp = await Directory.systemTemp.createTemp("fasta_bootstrap");
+ Uri compiledOnceOutput = tmp.uri.resolve("fasta1.dill");
+ Uri compiledTwiceOutput = tmp.uri.resolve("fasta2.dill");
+ try {
+ await runCompiler(sourceCompiler, sourceCompiler, compiledOnceOutput);
+ await runCompiler(
+ compiledOnceOutput, sourceCompiler, compiledTwiceOutput);
+ } finally {
+ await tmp.delete(recursive: true);
+ }
+ } finally {
+ asyncEnd();
+ }
+}
+
+Future runCompiler(Uri compiler, Uri input, Uri output) async {
+ Uri patchedSdk = await computePatchedSdk();
+ Uri dartVm = Uri.base.resolve(Platform.resolvedExecutable);
+ StdioProcess result = await StdioProcess.run(dartVm.toFilePath(), <String>[
+ compiler.toFilePath(),
+ "--compile-sdk=${patchedSdk.toFilePath()}",
+ "--output=${output.toFilePath()}",
+ input.toFilePath(),
+ ]);
+ print(result.output);
+ if (result.exitCode != 1) {
+ // TODO(ahe): Due to known errors in the VM's patch files, this compiler
+ // should report an error. Also, it may not be able to compile everything
+ // yet.
+ throw "Compilation failed.";
+ }
+}
« 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