summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-08-23 02:15:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-08-23 02:15:26 +0000
commit05ee196c0a6367b5f07e2f9de502457c3299ecc6 (patch)
tree9d14f9d3bdc3f91c163f3ee4fec8e9808b2d9fed /tests/stdio_test.cpp
parent53b40de57257a0de76b47878cb6de313e0cf4037 (diff)
parentf1a38386b77c7d67c96e9da4ba97770be3780455 (diff)
Merge "Test that /dev/stdin, /dev/stdout, and /dev/stderr are all present."
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r--tests/stdio_test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 844a9c099..d93c63f42 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -2506,3 +2506,14 @@ TEST(STDIO_TEST, fseek_overflow_32bit) {
fclose(fp);
}
+
+TEST(STDIO_TEST, dev_std_files) {
+ // POSIX only mentions /dev/stdout, but we should have all three (http://b/31824379).
+ char path[PATH_MAX];
+ ASSERT_GT(readlink("/dev/stdin", path, sizeof(path)), 0);
+ ASSERT_STREQ("/proc/self/fd/0", path);
+ ASSERT_GT(readlink("/dev/stdout", path, sizeof(path)), 0);
+ ASSERT_STREQ("/proc/self/fd/1", path);
+ ASSERT_GT(readlink("/dev/stderr", path, sizeof(path)), 0);
+ ASSERT_STREQ("/proc/self/fd/2", path);
+}