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

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

Issue 3009503002: Start trying to compile platform from unpatched sources. (Closed)
Patch Set: Add LibraryBuilder.isPatch. 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/test/fasta/compile_platform_test.dart
diff --git a/pkg/front_end/test/fasta/compile_platform_test.dart b/pkg/front_end/test/fasta/compile_platform_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3d94d7cfdc3cc788c98ec5ac5fb8eeb5d4c6093b
--- /dev/null
+++ b/pkg/front_end/test/fasta/compile_platform_test.dart
@@ -0,0 +1,61 @@
+// 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.md file.
+
+library fasta.test.compile_platform_test;
+
+import 'dart:io';
+
+import 'package:async_helper/async_helper.dart';
+
+import 'package:expect/expect.dart';
+
+import '../../tool/_fasta/compile_platform.dart' show compilePlatform;
+
+main(List<String> arguments) async {
+ await asyncTest(() async {
+ await withTemporyDirectory("compile_platform_test_", (Uri tmp) async {
+ String patchedSdk = Uri.base
+ .resolveUri(new Uri.file(Platform.resolvedExecutable))
+ .resolve("patched_sdk")
+ .toFilePath();
+ // This first invocation should succeed.
+ await compilePlatform(<String>[
+ "-v",
+ patchedSdk,
+ tmp.resolve("platform.dill").toFilePath(),
+ tmp.resolve("platform-outline.dill").toFilePath(),
+ ]);
+ print("Successfully compiled $patchedSdk.\n\n");
+
+ try {
+ // This invocation is expected to throw an exception for now. Patching
+ // isn't fully implemented yet.
+ //
+ // TODO(ahe): When this stops crashing, use Process to invoke the tool
+ // instead of importing its main entry point.
+ await compilePlatform(<String>[
+ "-v",
+ "sdk/",
+ tmp.resolve("platform.dill").toFilePath(),
+ tmp.resolve("platform-outline.dill").toFilePath(),
+ ]);
+ } on String catch (e) {
+ Expect.isTrue(
+ e.startsWith("A member with disambiguated name '_withType' "));
+ print("Failed as expected: $e");
+ return;
+ }
+ Expect.fail("Test didn't throw expected exception.");
+ });
+ });
+}
+
+withTemporyDirectory(String prefix, Future f(Uri tmp)) async {
+ Directory tmp = await Directory.systemTemp.createTemp(prefix);
+ try {
+ await f(tmp.uri);
+ } finally {
+ await tmp.delete(recursive: true);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698