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

Side by Side Diff: tests/standalone/io/dart_std_io_pipe_test.dart

Issue 10380026: Add executable to Options interface to get the name of the executable used to execute the script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Test a dart sub-process handling stdio with different types of 5 // Test a dart sub-process handling stdio with different types of
6 // redirection. 6 // redirection.
7 // 7 //
8 // VMOptions= 8 // VMOptions=
9 // VMOptions=--short_socket_read 9 // VMOptions=--short_socket_read
10 // VMOptions=--short_socket_write 10 // VMOptions=--short_socket_write
(...skipping 20 matching lines...) Expand all
31 31
32 32
33 void test(String shellScript, String dartScript, String type) { 33 void test(String shellScript, String dartScript, String type) {
34 Directory dir = new Directory(""); 34 Directory dir = new Directory("");
35 dir.createTempSync(); 35 dir.createTempSync();
36 36
37 // The shell script will run the dart executable passed with a 37 // The shell script will run the dart executable passed with a
38 // number of different redirections of stdio. 38 // number of different redirections of stdio.
39 String pipeOutFile = "${dir.path}/pipe"; 39 String pipeOutFile = "${dir.path}/pipe";
40 String redirectOutFile = "${dir.path}/redirect"; 40 String redirectOutFile = "${dir.path}/redirect";
41 String executable = new Options().executable;
41 List args = 42 List args =
42 [getDartFileName(), dartScript, type, pipeOutFile, redirectOutFile]; 43 [executable, dartScript, type, pipeOutFile, redirectOutFile];
43 Process process = new Process.start(shellScript, args); 44 Process process = new Process.start(shellScript, args);
44 45
45 // Wait for the process to exit and then check result. 46 // Wait for the process to exit and then check result.
46 process.onExit = (exitCode) { 47 process.onExit = (exitCode) {
47 Expect.equals(0, exitCode); 48 Expect.equals(0, exitCode);
48 process.close(); 49 process.close();
49 50
50 // Check the expected file contents. 51 // Check the expected file contents.
51 if (type == "0") { 52 if (type == "0") {
52 checkFileContent("${pipeOutFile}", "Hello\n"); 53 checkFileContent("${pipeOutFile}", "Hello\n");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 var scriptFile = new File("tests/standalone/io/process_std_io_script.dart"); 93 var scriptFile = new File("tests/standalone/io/process_std_io_script.dart");
93 if (!scriptFile.existsSync()) { 94 if (!scriptFile.existsSync()) {
94 scriptFile = new File("../tests/standalone/io/process_std_io_script.dart"); 95 scriptFile = new File("../tests/standalone/io/process_std_io_script.dart");
95 } 96 }
96 97
97 // Run the shell script. 98 // Run the shell script.
98 test(shellScript.name, scriptFile.name, "0"); 99 test(shellScript.name, scriptFile.name, "0");
99 test(shellScript.name, scriptFile.name, "1"); 100 test(shellScript.name, scriptFile.name, "1");
100 test(shellScript.name, scriptFile.name, "2"); 101 test(shellScript.name, scriptFile.name, "2");
101 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698