bionic tests: use GTEST_SKIP.
Also be a bit more to the point in our messages, focusing on "why" not
"what".
Test: ran tests
Change-Id: I297806c7a102bd52602dcd2fcf7a2cd34aba3a11
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index bc6a37b..0226a2d 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -89,7 +89,7 @@
}
TEST(malloc, memalign_multiple) {
- SKIP_WITH_HWASAN; // hwasan requires power of 2 alignment.
+ SKIP_WITH_HWASAN << "hwasan requires power of 2 alignment";
// Memalign test where the alignment is any value.
for (size_t i = 0; i <= 12; i++) {
for (size_t alignment = 1 << i; alignment < (1U << (i+1)); alignment++) {
@@ -526,24 +526,24 @@
TEST(malloc, mallopt_decay) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan does not implement mallopt
+ SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
errno = 0;
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1));
ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0));
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
TEST(malloc, mallopt_purge) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan does not implement mallopt
+ SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
errno = 0;
ASSERT_EQ(1, mallopt(M_PURGE, 0));
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -561,7 +561,7 @@
ASSERT_TRUE(reallocarray(nullptr, b, a) == nullptr);
ASSERT_EQ(ENOMEM, errno);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with reallocarray.\n";
+ GTEST_SKIP() << "reallocarray not available";
#endif
}
@@ -571,13 +571,13 @@
ASSERT_TRUE(p != nullptr);
ASSERT_GE(malloc_usable_size(p), 64U);
#else
- GTEST_LOG_(INFO) << "This test requires a C library with reallocarray.\n";
+ GTEST_SKIP() << "reallocarray not available";
#endif
}
TEST(malloc, mallinfo) {
#if defined(__BIONIC__)
- SKIP_WITH_HWASAN; // hwasan does not implement mallinfo
+ SKIP_WITH_HWASAN << "hwasan does not implement mallinfo";
static size_t sizes[] = {
8, 32, 128, 4096, 32768, 131072, 1024000, 10240000, 20480000, 300000000
};
@@ -616,7 +616,7 @@
<< kMaxAllocs << " allocations.";
}
#else
- GTEST_LOG_(INFO) << "Host glibc does not pass this test, skipping.\n";
+ GTEST_SKIP() << "glibc is broken";
#endif
}
@@ -627,7 +627,7 @@
EXPECT_EQ(false, android_mallopt(unrecognized_option, nullptr, 0));
EXPECT_EQ(ENOTSUP, errno);
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}
@@ -673,6 +673,6 @@
EXPECT_EQ(ENOTSUP, errno);
}
#else
- GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n";
+ GTEST_SKIP() << "bionic-only test";
#endif
}