summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-08-22 15:38:07 -0700
committerElliott Hughes <enh@google.com>2018-08-22 15:38:07 -0700
commitf1a38386b77c7d67c96e9da4ba97770be3780455 (patch)
treeca252fd88408959f6c735674b35c9bad54043cef /tests/stdio_test.cpp
parent5c18e6a153291951fea6ae9c9a074246c7bad373 (diff)
Test that /dev/stdin, /dev/stdout, and /dev/stderr are all present.
Bug: http://b/31824379 Test: ran tests Change-Id: I16034106eb61b9f32c9afef512c75f0b73c179b5
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);
+}