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

Unified Diff: pkg/front_end/test/fasta/testing/suite.dart

Issue 2881603003: Generate outline without transformations in patched_sdk, use it for unit tests (Closed)
Patch Set: Created 3 years, 7 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/fasta.dart ('k') | tools/patch_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/fasta/testing/suite.dart
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index f08f6cded4ebb3aca14f163ddcfd4558a486eded..05d7c6499c83e9a892666b344913fa5087772cd4 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -82,11 +82,14 @@ class FastaContext extends ChainContext {
final TranslateUri uriTranslator;
final List<Step> steps;
final Uri vm;
+ Uri sdk;
+ Uri platformUri;
+ Uri outlineUri;
final ExpectationSet expectationSet =
new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS));
- Future<Program> platform;
+ Future<Program> outline;
FastaContext(
this.vm,
@@ -114,10 +117,18 @@ class FastaContext extends ChainContext {
}
}
- Future<Program> loadPlatform() {
- return platform ??= new Future<Program>(() async {
- Uri sdk = await computePatchedSdk();
- return loadProgramFromBinary(sdk.resolve('platform.dill').toFilePath());
+ Future ensurePlatformUris() async {
+ if (sdk == null) {
+ sdk = await computePatchedSdk();
+ platformUri = sdk.resolve('platform.dill');
+ outlineUri = sdk.resolve('outline.dill');
+ }
+ }
+
+ Future<Program> loadPlatformOutline() {
+ return outline ??= new Future<Program>(() async {
+ await ensurePlatformUris();
+ return loadProgramFromBinary(platformUri.toFilePath());
Paul Berry 2017/05/11 21:49:14 Shoud this be outlineUri?
Siggi Cherem (dart-lang) 2017/05/11 22:06:58 Yes! Good catch. I also noticed this soon after I
});
}
@@ -160,8 +171,10 @@ class Run extends Step<Uri, int, FastaContext> {
File generated = new File.fromUri(uri);
StdioProcess process;
try {
- process = await StdioProcess
- .run(context.vm.toFilePath(), [generated.path, "Hello, World!"]);
+ await context.ensurePlatformUris();
+ var platformDill = context.platformUri.toFilePath();
+ var args = ['--platform=$platformDill', generated.path, "Hello, World!"];
Paul Berry 2017/05/11 21:49:14 Should this be platformUri (rather than platformDi
Siggi Cherem (dart-lang) 2017/05/11 22:06:58 the VM currently only accepts a path and fails whe
+ process = await StdioProcess.run(context.vm.toFilePath(), args);
print(process.output);
} finally {
generated.parent.delete(recursive: true);
@@ -190,10 +203,10 @@ class Outline extends Step<TestDescription, Program, FastaContext> {
Future<Result<Program>> run(
TestDescription description, FastaContext context) async {
- Program platform = await context.loadPlatform();
+ Program platformOutline = await context.loadPlatformOutline();
Ticker ticker = new Ticker();
DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator);
- dillTarget.loader.appendLibraries(platform);
+ dillTarget.loader.appendLibraries(platformOutline);
KernelTarget sourceTarget = astKind == AstKind.Analyzer
? new AnalyzerTarget(dillTarget, context.uriTranslator, strongMode)
: new KernelTarget(PhysicalFileSystem.instance, dillTarget,
« no previous file with comments | « pkg/front_end/lib/src/fasta/fasta.dart ('k') | tools/patch_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698