From f1a38386b77c7d67c96e9da4ba97770be3780455 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 22 Aug 2018 15:38:07 -0700 Subject: Test that /dev/stdin, /dev/stdout, and /dev/stderr are all present. Bug: http://b/31824379 Test: ran tests Change-Id: I16034106eb61b9f32c9afef512c75f0b73c179b5 --- tests/stdio_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/stdio_test.cpp') 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); +} -- cgit v1.2.3