summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2013-11-15 15:16:01 -0800
committerChristopher Ferris <cferris@google.com>2013-11-15 16:09:44 -0800
commitcbd85b9cc1c5dd0bb1a5691143cd5adcbecdba77 (patch)
tree6a68536f1a1a5c37803b04199fe536d7ce876891 /tests/stdio_test.cpp
parentf246c589d66e5dc0e3cddc3c37261fb0e3fc67e9 (diff)
Modify tests for another glibc difference.
It turns out that when passing a closed file to getdelim or getline, the functions in glibc will properly return a failure, but errno might not be set. Skip the errno check except on bionic. Change-Id: I8d625f15303d4c2d42e8d28491ea8a368aea4d32
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r--tests/stdio_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 11bd17f84..2002928fe 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -103,7 +103,10 @@ TEST(stdio, getdelim_invalid) {
fclose(fp);
errno = 0;
ASSERT_EQ(getdelim(&buffer, &buffer_length, ' ', fp), -1);
+ // glibc sometimes doesn't set errno in this particular case.
+#if defined(__BIONIC__)
ASSERT_EQ(EBADF, errno);
+#endif
}
TEST(stdio, getline) {
@@ -168,7 +171,10 @@ TEST(stdio, getline_invalid) {
fclose(fp);
errno = 0;
ASSERT_EQ(getline(&buffer, &buffer_length, fp), -1);
+ // glibc sometimes doesn't set errno in this particular case.
+#if defined(__BIONIC__)
ASSERT_EQ(EBADF, errno);
+#endif
}
TEST(stdio, printf_ssize_t) {