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

Side by Side Diff: pkg/front_end/test/fasta/testing/suite.dart

Issue 2979463002: Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service." (Closed)
Patch Set: Created 3 years, 5 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
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library fasta.testing.suite; 5 library fasta.testing.suite;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File; 9 import 'dart:io' show File;
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 class FastaContext extends ChainContext { 93 class FastaContext extends ChainContext {
94 final TranslateUri uriTranslator; 94 final TranslateUri uriTranslator;
95 final List<Step> steps; 95 final List<Step> steps;
96 final Uri vm; 96 final Uri vm;
97 final Map<Program, KernelTarget> programToTarget = <Program, KernelTarget>{}; 97 final Map<Program, KernelTarget> programToTarget = <Program, KernelTarget>{};
98 Uri sdk; 98 Uri sdk;
99 Uri platformUri; 99 Uri platformUri;
100 Uri outlineUri; 100 Uri outlineUri;
101 Program outline; 101 List<int> outlineBytes;
102 102
103 final ExpectationSet expectationSet = 103 final ExpectationSet expectationSet =
104 new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS)); 104 new ExpectationSet.fromJsonList(JSON.decode(EXPECTATIONS));
105 105
106 FastaContext( 106 FastaContext(
107 this.vm, 107 this.vm,
108 bool strongMode, 108 bool strongMode,
109 bool updateExpectations, 109 bool updateExpectations,
110 bool updateComments, 110 bool updateComments,
111 bool skipVm, 111 bool skipVm,
(...skipping 20 matching lines...) Expand all
132 132
133 Future ensurePlatformUris() async { 133 Future ensurePlatformUris() async {
134 if (sdk == null) { 134 if (sdk == null) {
135 sdk = await computePatchedSdk(); 135 sdk = await computePatchedSdk();
136 platformUri = sdk.resolve('platform.dill'); 136 platformUri = sdk.resolve('platform.dill');
137 outlineUri = sdk.resolve('outline.dill'); 137 outlineUri = sdk.resolve('outline.dill');
138 } 138 }
139 } 139 }
140 140
141 Future<Program> loadPlatformOutline() async { 141 Future<Program> loadPlatformOutline() async {
142 if (outline == null) { 142 if (outlineBytes == null) {
143 await ensurePlatformUris(); 143 await ensurePlatformUris();
144 outline = 144 outlineBytes = new File.fromUri(outlineUri).readAsBytesSync();
145 loadProgramFromBytes(new File.fromUri(outlineUri).readAsBytesSync());
146 } 145 }
147 return outline; 146 // Note: we rebuild the platform outline on every test because the compiler
147 // currently mutates the in-memory representation of the program without
148 // cloning it.
149 // TODO(sigmund): investigate alternatives to this approach.
150 return loadProgramFromBytes(outlineBytes);
148 } 151 }
149 152
150 static Future<FastaContext> create( 153 static Future<FastaContext> create(
151 Chain suite, Map<String, String> environment) async { 154 Chain suite, Map<String, String> environment) async {
152 Uri sdk = await computePatchedSdk(); 155 Uri sdk = await computePatchedSdk();
153 Uri vm = computeDartVm(sdk); 156 Uri vm = computeDartVm(sdk);
154 Uri packages = Uri.base.resolve(".packages"); 157 Uri packages = Uri.base.resolve(".packages");
155 TranslateUri uriTranslator = await TranslateUri 158 TranslateUri uriTranslator = await TranslateUri
156 .parse(PhysicalFileSystem.instance, sdk, packages: packages); 159 .parse(PhysicalFileSystem.instance, sdk, packages: packages);
157 bool strongMode = environment.containsKey(STRONG_MODE); 160 bool strongMode = environment.containsKey(STRONG_MODE);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 sourceTarget.read(description.uri); 252 sourceTarget.read(description.uri);
250 await dillTarget.buildOutlines(); 253 await dillTarget.buildOutlines();
251 ValidatingInstrumentation instrumentation; 254 ValidatingInstrumentation instrumentation;
252 if (strongMode) { 255 if (strongMode) {
253 instrumentation = new ValidatingInstrumentation(); 256 instrumentation = new ValidatingInstrumentation();
254 await instrumentation.loadExpectations(description.uri); 257 await instrumentation.loadExpectations(description.uri);
255 sourceTarget.loader.instrumentation = instrumentation; 258 sourceTarget.loader.instrumentation = instrumentation;
256 } 259 }
257 p = await sourceTarget.buildOutlines(); 260 p = await sourceTarget.buildOutlines();
258 if (fullCompile) { 261 if (fullCompile) {
259 p = await sourceTarget.buildProgram(); 262 p = await sourceTarget.buildProgram(trimDependencies: true);
260 instrumentation?.finish(); 263 instrumentation?.finish();
261 if (instrumentation != null && instrumentation.hasProblems) { 264 if (instrumentation != null && instrumentation.hasProblems) {
262 if (updateComments) { 265 if (updateComments) {
263 await instrumentation.fixSource(description.uri, false); 266 await instrumentation.fixSource(description.uri, false);
264 } else { 267 } else {
265 return fail(null, instrumentation.problemsAsString); 268 return fail(null, instrumentation.problemsAsString);
266 } 269 }
267 } 270 }
268 } 271 }
269 } on InputError catch (e, s) { 272 } on InputError catch (e, s) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 316 }
314 } 317 }
315 318
316 void performGlobalTransformations(CoreTypes coreTypes, Program program, 319 void performGlobalTransformations(CoreTypes coreTypes, Program program,
317 {void logger(String msg)}) { 320 {void logger(String msg)}) {
318 if (enabled) { 321 if (enabled) {
319 super.performGlobalTransformations(coreTypes, program, logger: logger); 322 super.performGlobalTransformations(coreTypes, program, logger: logger);
320 } 323 }
321 } 324 }
322 } 325 }
OLDNEW
« no previous file with comments | « pkg/front_end/test/fasta/shaker_test.dart ('k') | pkg/front_end/test/incremental_kernel_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698