summaryrefslogtreecommitdiff
path: root/tests/malloc_test.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-06-20 08:50:23 -0700
committerChristopher Ferris <cferris@google.com>2019-06-20 08:57:07 -0700
commit804cebe1c628e405011db7a03bcd31f2bdf10b09 (patch)
treeb5d3ce6a5cb3a463d0ff14e31ac21488cf57f5f4 /tests/malloc_test.cpp
parent8fef03f6091e80d9da83ffa31e31ad2015fd97c6 (diff)
Run pvalloc/valloc tests in unsupported envs.
In order for cts to enumerate tests, even tests that are not supported need to run and be skipped. Make this true for pvalloc/valloc tests. Change-Id: I863a179ee6810824a7117f44cc9aa3f86d01eb5b Test: Ran tests in 32 bit and 64 bit and verified tests are skipped in Test: 64 bit and run properly in 32 bit.
Diffstat (limited to 'tests/malloc_test.cpp')
-rw-r--r--tests/malloc_test.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index f69e5988b..edcc179ed 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -312,32 +312,48 @@ TEST(malloc, realloc_overflow) {
#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
extern "C" void* pvalloc(size_t);
extern "C" void* valloc(size_t);
+#endif
TEST(malloc, pvalloc_std) {
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
size_t pagesize = sysconf(_SC_PAGESIZE);
void* ptr = pvalloc(100);
ASSERT_TRUE(ptr != nullptr);
ASSERT_TRUE((reinterpret_cast<uintptr_t>(ptr) & (pagesize-1)) == 0);
ASSERT_LE(pagesize, malloc_usable_size(ptr));
free(ptr);
+#else
+ GTEST_SKIP() << "pvalloc not supported.";
+#endif
}
TEST(malloc, pvalloc_overflow) {
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
ASSERT_EQ(nullptr, pvalloc(SIZE_MAX));
+#else
+ GTEST_SKIP() << "pvalloc not supported.";
+#endif
}
TEST(malloc, valloc_std) {
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
size_t pagesize = sysconf(_SC_PAGESIZE);
void* ptr = valloc(100);
ASSERT_TRUE(ptr != nullptr);
ASSERT_TRUE((reinterpret_cast<uintptr_t>(ptr) & (pagesize-1)) == 0);
free(ptr);
+#else
+ GTEST_SKIP() << "valloc not supported.";
+#endif
}
TEST(malloc, valloc_overflow) {
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
ASSERT_EQ(nullptr, valloc(SIZE_MAX));
-}
+#else
+ GTEST_SKIP() << "valloc not supported.";
#endif
+}
TEST(malloc, malloc_info) {
#ifdef __BIONIC__