summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2013-12-20 18:43:21 -0800
committerChristopher Ferris <cferris@google.com>2014-02-06 20:12:21 -0800
commitf04935c85e0b466f0d30d2cd4c0fa2fff62e7d6d (patch)
tree8f1c6af75517892648f49adad9d4d5d44c20f49c /tests/stdio_test.cpp
parente163a3986aa7d1c67fe3274eb9204812be0a6245 (diff)
Make sure that the same tests are on all platforms.
In order to be able to generate a list of tests for cts, the same set of tests must exist across all platforms. This CL adds empty tests where a test was conditionally compiled out. This CL creates a single library libBionicTests that includes all of the tests found in bionic-unit-tests-static. Also fix a few missing include files in some test files. Tested by running and compiling the tests for every platform and verifying the same number of tests are on each platform. Change-Id: I9989d4bfebb0f9c409a0ce7e87169299eac605a2
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r--tests/stdio_test.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index bd3c548ac..027de3437 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -107,7 +107,7 @@ TEST(stdio, getdelim_invalid) {
// glibc sometimes doesn't set errno in this particular case.
#if defined(__BIONIC__)
ASSERT_EQ(EBADF, errno);
-#endif
+#endif // __BIONIC__
}
TEST(stdio, getline) {
@@ -176,7 +176,7 @@ TEST(stdio, getline_invalid) {
// glibc sometimes doesn't set errno in this particular case.
#if defined(__BIONIC__)
ASSERT_EQ(EBADF, errno);
-#endif
+#endif // __BIONIC__
}
TEST(stdio, printf_ssize_t) {
@@ -191,8 +191,8 @@ TEST(stdio, printf_ssize_t) {
snprintf(buf, sizeof(buf), "%zd", v);
}
-#if !defined(__GLIBC__)
TEST(stdio, snprintf_n_format_specifier_not_implemented) {
+#if defined(__BIONIC__)
char buf[32];
int i = 0;
// We deliberately don't implement %n, so it's treated like
@@ -200,8 +200,10 @@ TEST(stdio, snprintf_n_format_specifier_not_implemented) {
EXPECT_EQ(5, snprintf(buf, sizeof(buf), "a %n b", &i));
EXPECT_EQ(0, i);
EXPECT_STREQ("a n b", buf);
+#else // __BIONIC__
+ GTEST_LOG_(INFO) << "This test does nothing.\n";
+#endif // __BIONIC__
}
-#endif
TEST(stdio, snprintf_smoke) {
char buf[BUFSIZ];
@@ -283,9 +285,9 @@ TEST(stdio, snprintf_smoke) {
snprintf(buf, sizeof(buf), "a%d,%pz", 5, p);
#if defined(__BIONIC__)
EXPECT_STREQ("a5,0x0z", buf);
-#else
+#else // __BIONIC__
EXPECT_STREQ("a5,(nil)z", buf);
-#endif
+#endif // __BIONIC__
snprintf(buf, sizeof(buf), "a%lld,%d,%d,%dz", 0x1000000000LL, 6, 7, 8);
EXPECT_STREQ("a68719476736,6,7,8z", buf);