Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 class Run extends Step<Uri, int, FastaContext> { | 169 class Run extends Step<Uri, int, FastaContext> { |
| 170 const Run(); | 170 const Run(); |
| 171 | 171 |
| 172 String get name => "run"; | 172 String get name => "run"; |
| 173 | 173 |
| 174 bool get isAsync => true; | 174 bool get isAsync => true; |
| 175 | 175 |
| 176 bool get isRuntime => true; | 176 bool get isRuntime => true; |
| 177 | 177 |
| 178 Future<Result<int>> run(Uri uri, FastaContext context) async { | 178 Future<Result<int>> run(Uri uri, FastaContext context) async { |
| 179 if (context.platformUri == null) { | |
| 180 return new Result<int>.fail( | |
| 181 1, "Executed `Run` step before initializing the context."); | |
|
Siggi Cherem (dart-lang)
2017/05/31 21:15:43
not sure if you prefer to indicate these checks as
ahe
2017/06/01 10:45:43
Sounds like a crash to me.
| |
| 182 } | |
| 179 File generated = new File.fromUri(uri); | 183 File generated = new File.fromUri(uri); |
| 180 StdioProcess process; | 184 StdioProcess process; |
| 181 try { | 185 try { |
| 182 await context.ensurePlatformUris(); | |
| 183 var platformDill = context.platformUri.toFilePath(); | 186 var platformDill = context.platformUri.toFilePath(); |
| 184 var args = ['--platform=$platformDill', generated.path, "Hello, World!"]; | 187 var args = ['--platform=$platformDill', generated.path, "Hello, World!"]; |
| 185 process = await StdioProcess.run(context.vm.toFilePath(), args); | 188 process = await StdioProcess.run(context.vm.toFilePath(), args); |
| 186 print(process.output); | 189 print(process.output); |
| 187 } finally { | 190 } finally { |
| 188 generated.parent.delete(recursive: true); | 191 generated.parent.delete(recursive: true); |
| 189 } | 192 } |
| 190 return process.toResult(); | 193 return process.toResult(); |
| 191 } | 194 } |
| 192 } | 195 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 return fail(null, instrumentation.problemsAsString); | 254 return fail(null, instrumentation.problemsAsString); |
| 252 } | 255 } |
| 253 } | 256 } |
| 254 } | 257 } |
| 255 } on InputError catch (e, s) { | 258 } on InputError catch (e, s) { |
| 256 return fail(null, e.error, s); | 259 return fail(null, e.error, s); |
| 257 } | 260 } |
| 258 return pass(p); | 261 return pass(p); |
| 259 } | 262 } |
| 260 } | 263 } |
| OLD | NEW |