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
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 63da9e0..da70d21 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 @@
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 @@
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));