From d5ab0a5706713240031c419a943e0f317b858e1e Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Wed, 19 Jun 2019 12:03:57 -0700 Subject: Change pvalloc call to valloc in test. Found by kostyak, the call should have been valloc, not pvalloc. Test: Ran unit tests on taimen. Change-Id: I676b8f3f8051be6768e2ad87b579844560b4f619 --- tests/malloc_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/malloc_test.cpp') diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp index 983592f0a..f69e5988b 100644 --- a/tests/malloc_test.cpp +++ b/tests/malloc_test.cpp @@ -328,7 +328,7 @@ TEST(malloc, pvalloc_overflow) { TEST(malloc, valloc_std) { size_t pagesize = sysconf(_SC_PAGESIZE); - void* ptr = pvalloc(100); + void* ptr = valloc(100); ASSERT_TRUE(ptr != nullptr); ASSERT_TRUE((reinterpret_cast(ptr) & (pagesize-1)) == 0); free(ptr); -- cgit v1.2.3 From 804cebe1c628e405011db7a03bcd31f2bdf10b09 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Thu, 20 Jun 2019 08:50:23 -0700 Subject: 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. --- tests/malloc_test.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/malloc_test.cpp') 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(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(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__ -- cgit v1.2.3