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

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

Issue 13636003: Fix a number of issues with determining the type of stdio (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 8 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 22 matching lines...) Expand all
33 void test(String shellScript, String dartScript, String type, bool devNull) { 33 void test(String shellScript, String dartScript, String type, bool devNull) {
34 Directory dir = new Directory("").createTempSync(); 34 Directory dir = new Directory("").createTempSync();
35 35
36 // The shell script will run the dart executable passed with a 36 // The shell script will run the dart executable passed with a
37 // number of different redirections of stdio. 37 // number of different redirections of stdio.
38 String pipeOutFile = "${dir.path}/pipe"; 38 String pipeOutFile = "${dir.path}/pipe";
39 if (devNull) pipeOutFile = "/dev/null"; 39 if (devNull) pipeOutFile = "/dev/null";
40 String redirectOutFile = "${dir.path}/redirect"; 40 String redirectOutFile = "${dir.path}/redirect";
41 String executable = new Options().executable; 41 String executable = new Options().executable;
42 List args = 42 List args =
43 [executable, dartScript, type, pipeOutFile, redirectOutFile]; 43 [executable,
44 dartScript,
45 type,
46 pipeOutFile,
47 redirectOutFile,
48 devNull ? "terminal" : "file"];
44 var future = Process.start(shellScript, args); 49 var future = Process.start(shellScript, args);
45 future.then((process) { 50 future.then((process) {
46 process.exitCode.then((exitCode) { 51 process.exitCode.then((exitCode) {
47 Expect.equals(0, exitCode); 52 Expect.equals(0, exitCode);
48 53
49 // Check the expected file contents. 54 // Check the expected file contents.
50 if (type == "0") { 55 if (type == "0") {
51 if (devNull) { 56 if (devNull) {
52 checkFileEmpty("${redirectOutFile}.stdout"); 57 checkFileEmpty("${redirectOutFile}.stdout");
53 } else { 58 } else {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 var os = Platform.operatingSystem; 103 var os = Platform.operatingSystem;
99 if (os == 'windows') return; 104 if (os == 'windows') return;
100 105
101 // Get the shell script for testing the Standalone Dart VM with 106 // Get the shell script for testing the Standalone Dart VM with
102 // piping and redirections of stdio. 107 // piping and redirections of stdio.
103 var shellScript = new File("tests/standalone/io/dart_std_io_pipe_test.sh"); 108 var shellScript = new File("tests/standalone/io/dart_std_io_pipe_test.sh");
104 if (!shellScript.existsSync()) { 109 if (!shellScript.existsSync()) {
105 shellScript = new File("../tests/standalone/io/dart_std_io_pipe_test.sh"); 110 shellScript = new File("../tests/standalone/io/dart_std_io_pipe_test.sh");
106 } 111 }
107 // Get the Dart script file which echoes stdin to stdout or stderr or both. 112 // Get the Dart script file which echoes stdin to stdout or stderr or both.
108 var scriptFile = new File("tests/standalone/io/process_std_io_script.dart"); 113 var scriptFile = new File("tests/standalone/io/dart_std_io_pipe_script.dart");
109 if (!scriptFile.existsSync()) { 114 if (!scriptFile.existsSync()) {
110 scriptFile = new File("../tests/standalone/io/process_std_io_script.dart"); 115 scriptFile =
116 new File("../tests/standalone/io/dart_std_io_pipe_script.dart");
111 } 117 }
112 118
113 // Run the shell script. 119 // Run the shell script.
114 test(shellScript.path, scriptFile.path, "0", false); 120 test(shellScript.path, scriptFile.path, "0", false);
115 test(shellScript.path, scriptFile.path, "0", true); 121 test(shellScript.path, scriptFile.path, "0", true);
116 test(shellScript.path, scriptFile.path, "1", false); 122 test(shellScript.path, scriptFile.path, "1", false);
117 test(shellScript.path, scriptFile.path, "1", true); 123 test(shellScript.path, scriptFile.path, "1", true);
118 test(shellScript.path, scriptFile.path, "2", false); 124 test(shellScript.path, scriptFile.path, "2", false);
119 test(shellScript.path, scriptFile.path, "2", true); 125 test(shellScript.path, scriptFile.path, "2", true);
120 } 126 }
OLDNEW
« no previous file with comments | « tests/standalone/io/dart_std_io_pipe_script.dart ('k') | tests/standalone/io/dart_std_io_pipe_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698