summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-01-10 13:00:37 -0800
committerJosh Gao <jmgao@google.com>2017-01-11 13:00:15 -0800
commit2f06e1028037c63d517e45b4055f946aa79dc5ee (patch)
tree942ce32487639c93dad1a00d1528bb14c457308d /tests/stdio_test.cpp
parent010522229c2a984d3e553e244da67b449b9638d4 (diff)
Improve fmemopen tests.
Tag fmemopen_NULL as a known failure, and make it reliably fail by memsetting the buffer we read to. Bug: http://b/33251022 Test: bionic-unit-tests/bionic-unit-tests64 on bullhead Test: bionic-unit-tests-glibc --gtest_filter="*memopen*" Change-Id: I381783282359851c9de47146dafbb5a291960c2a
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r--tests/stdio_test.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 63da9e040..da70d2138 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -31,6 +31,7 @@
#include "BionicDeathTest.h"
#include "TemporaryFile.h"
+#include "utils.h"
#if defined(NOFORTIFY)
#define STDIO_TEST stdio_nofortify
@@ -47,6 +48,7 @@ static void AssertFileIs(FILE* fp, const char* expected, bool is_fmemopen = fals
rewind(fp);
char line[1024];
+ memset(line, 0xff, sizeof(line));
ASSERT_EQ(line, fgets(line, sizeof(line), fp));
ASSERT_STREQ(expected, line);
@@ -938,7 +940,7 @@ TEST(STDIO_TEST, fmemopen) {
fclose(fp);
}
-TEST(STDIO_TEST, fmemopen_NULL) {
+TEST(STDIO_TEST, KNOWN_FAILURE_ON_BIONIC(fmemopen_NULL)) {
FILE* fp = fmemopen(nullptr, 128, "r+");
ASSERT_NE(EOF, fputs("xyz\n", fp));