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

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

Issue 2953703002: Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service (Closed)
Patch Set: cl review updates: cleanup in kernel deserialization 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 List<int> outlineBytes; 101 Program outline;
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 (outlineBytes == null) { 142 if (outline == null) {
143 await ensurePlatformUris(); 143 await ensurePlatformUris();
144 outlineBytes = new File.fromUri(outlineUri).readAsBytesSync(); 144 outline =
145 loadProgramFromBytes(new File.fromUri(outlineUri).readAsBytesSync());
145 } 146 }
146 // Note: we rebuild the platform outline on every test because the compiler 147 return outline;
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);
151 } 148 }
152 149
153 static Future<FastaContext> create( 150 static Future<FastaContext> create(
154 Chain suite, Map<String, String> environment) async { 151 Chain suite, Map<String, String> environment) async {
155 Uri sdk = await computePatchedSdk(); 152 Uri sdk = await computePatchedSdk();
156 Uri vm = computeDartVm(sdk); 153 Uri vm = computeDartVm(sdk);
157 Uri packages = Uri.base.resolve(".packages"); 154 Uri packages = Uri.base.resolve(".packages");
158 TranslateUri uriTranslator = await TranslateUri 155 TranslateUri uriTranslator = await TranslateUri
159 .parse(PhysicalFileSystem.instance, sdk, packages: packages); 156 .parse(PhysicalFileSystem.instance, sdk, packages: packages);
160 bool strongMode = environment.containsKey(STRONG_MODE); 157 bool strongMode = environment.containsKey(STRONG_MODE);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 sourceTarget.read(description.uri); 249 sourceTarget.read(description.uri);
253 await dillTarget.buildOutlines(); 250 await dillTarget.buildOutlines();
254 ValidatingInstrumentation instrumentation; 251 ValidatingInstrumentation instrumentation;
255 if (strongMode) { 252 if (strongMode) {
256 instrumentation = new ValidatingInstrumentation(); 253 instrumentation = new ValidatingInstrumentation();
257 await instrumentation.loadExpectations(description.uri); 254 await instrumentation.loadExpectations(description.uri);
258 sourceTarget.loader.instrumentation = instrumentation; 255 sourceTarget.loader.instrumentation = instrumentation;
259 } 256 }
260 p = await sourceTarget.buildOutlines(); 257 p = await sourceTarget.buildOutlines();
261 if (fullCompile) { 258 if (fullCompile) {
262 p = await sourceTarget.buildProgram(trimDependencies: true); 259 p = await sourceTarget.buildProgram();
263 instrumentation?.finish(); 260 instrumentation?.finish();
264 if (instrumentation != null && instrumentation.hasProblems) { 261 if (instrumentation != null && instrumentation.hasProblems) {
265 if (updateComments) { 262 if (updateComments) {
266 await instrumentation.fixSource(description.uri, false); 263 await instrumentation.fixSource(description.uri, false);
267 } else { 264 } else {
268 return fail(null, instrumentation.problemsAsString); 265 return fail(null, instrumentation.problemsAsString);
269 } 266 }
270 } 267 }
271 } 268 }
272 } on InputError catch (e, s) { 269 } on InputError catch (e, s) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 313 }
317 } 314 }
318 315
319 void performGlobalTransformations(CoreTypes coreTypes, Program program, 316 void performGlobalTransformations(CoreTypes coreTypes, Program program,
320 {void logger(String msg)}) { 317 {void logger(String msg)}) {
321 if (enabled) { 318 if (enabled) {
322 super.performGlobalTransformations(coreTypes, program, logger: logger); 319 super.performGlobalTransformations(coreTypes, program, logger: logger);
323 } 320 }
324 } 321 }
325 } 322 }
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