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

Unified Diff: tests/standalone/io/dart_std_io_pipe_test.dart

Issue 12476021: Handle /dev/null on linux, as an closed device. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove debug print. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/dart_std_io_pipe_test.dart
diff --git a/tests/standalone/io/dart_std_io_pipe_test.dart b/tests/standalone/io/dart_std_io_pipe_test.dart
index 325e41b110d9c00704a8b7b72eb65ff42f02da19..daf5c098ee423d8a0795103cfe3d3e0d95a63cec 100644
--- a/tests/standalone/io/dart_std_io_pipe_test.dart
+++ b/tests/standalone/io/dart_std_io_pipe_test.dart
@@ -30,12 +30,13 @@ void checkFileContent(String fileName, String content) {
}
-void test(String shellScript, String dartScript, String type) {
+void test(String shellScript, String dartScript, String type, bool devNull) {
Directory dir = new Directory("").createTempSync();
// The shell script will run the dart executable passed with a
// number of different redirections of stdio.
String pipeOutFile = "${dir.path}/pipe";
+ if (devNull) pipeOutFile = "/dev/null";
String redirectOutFile = "${dir.path}/redirect";
String executable = new Options().executable;
List args =
@@ -47,21 +48,34 @@ void test(String shellScript, String dartScript, String type) {
// Check the expected file contents.
if (type == "0") {
- checkFileContent("${pipeOutFile}", "Hello\n");
+ if (devNull) {
+ checkFileEmpty("${redirectOutFile}.stdout");
+ } else {
+ checkFileContent("${pipeOutFile}", "Hello\n");
+ checkFileContent("${redirectOutFile}.stdout", "Hello\nHello\n");
+ }
checkFileEmpty("${redirectOutFile}.stderr");
- checkFileContent("${redirectOutFile}.stdout", "Hello\nHello\n");
}
if (type == "1") {
- checkFileContent("${pipeOutFile}", "Hello\n");
+ if (devNull) {
+ checkFileEmpty("${redirectOutFile}.stderr");
+ } else {
+ checkFileContent("${pipeOutFile}", "Hello\n");
+ checkFileContent("${redirectOutFile}.stderr", "Hello\nHello\n");
+ }
checkFileEmpty("${redirectOutFile}.stdout");
- checkFileContent("${redirectOutFile}.stderr", "Hello\nHello\n");
}
if (type == "2") {
- checkFileContent("${pipeOutFile}", "Hello\nHello\n");
- checkFileContent("${redirectOutFile}.stdout",
- "Hello\nHello\nHello\nHello\n");
- checkFileContent("${redirectOutFile}.stderr",
- "Hello\nHello\nHello\nHello\n");
+ if (devNull) {
+ checkFileEmpty("${redirectOutFile}.stdout");
+ checkFileEmpty("${redirectOutFile}.stderr");
+ } else {
+ checkFileContent("${pipeOutFile}", "Hello\nHello\n");
+ checkFileContent("${redirectOutFile}.stdout",
+ "Hello\nHello\nHello\nHello\n");
+ checkFileContent("${redirectOutFile}.stderr",
+ "Hello\nHello\nHello\nHello\n");
+ }
}
// Cleanup test directory.
@@ -97,7 +111,10 @@ main() {
}
// Run the shell script.
- test(shellScript.path, scriptFile.path, "0");
- test(shellScript.path, scriptFile.path, "1");
- test(shellScript.path, scriptFile.path, "2");
+ test(shellScript.path, scriptFile.path, "0", false);
+ test(shellScript.path, scriptFile.path, "0", true);
+ test(shellScript.path, scriptFile.path, "1", false);
+ test(shellScript.path, scriptFile.path, "1", true);
+ test(shellScript.path, scriptFile.path, "2", false);
+ test(shellScript.path, scriptFile.path, "2", true);
}
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698