bionic: tests: Remove PAGE_SIZE usage

Instead of the hardcoded PAGE_SIZE 4096 macro, use the
real system page-size as queried from the auxillary vector.

Bug: 277272383
Bug: 300367402
Test: atest -c bionic-unit-tests
Change-Id: I2f1ad1b431e36ef45e9f53f713ced6b06e0d4f70
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/tests/bionic_allocator_test.cpp b/tests/bionic_allocator_test.cpp
index fdcf868..d543d26 100644
--- a/tests/bionic_allocator_test.cpp
+++ b/tests/bionic_allocator_test.cpp
@@ -238,23 +238,27 @@
 TEST(bionic_allocator, test_memalign_large) {
   BionicAllocator allocator;
   void* ptr;
+  size_t alignment;
 
-  // a large object with alignment < PAGE_SIZE
-  ptr = allocator.memalign(0x100, 0x2000);
+  // a large object with alignment < kPageSize
+  alignment = kPageSize >> 1;
+  ptr = allocator.memalign(alignment, 0x2000);
   ASSERT_TRUE(ptr != nullptr);
-  ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % 0x100);
+  ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % alignment);
   allocator.free(ptr);
 
-  // a large object with alignment == PAGE_SIZE
-  ptr = allocator.memalign(0x1000, 0x2000);
+  // a large object with alignment == kPageSize
+  alignment = kPageSize;
+  ptr = allocator.memalign(alignment, 0x2000);
   ASSERT_TRUE(ptr != nullptr);
-  ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % 0x1000);
+  ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % alignment);
   allocator.free(ptr);
 
-  // A large object with alignment > PAGE_SIZE is only guaranteed to have page
+  // A large object with alignment > kPageSize is only guaranteed to have page
   // alignment.
-  ptr = allocator.memalign(0x2000, 0x4000);
+  alignment = kPageSize << 1;
+  ptr = allocator.memalign(alignment, 0x4000);
   ASSERT_TRUE(ptr != nullptr);
-  ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % 0x1000);
+  ASSERT_EQ(0U, reinterpret_cast<uintptr_t>(ptr) % kPageSize);
   allocator.free(ptr);
 }