16k: bionic: Fix tests for x86_64 16kb page size simulation
On x86_64 based 16kb page size targets, the page size in userspace
(provided by getpagesize()) would be simulated to 16kb but the
underlying filesystem block size would remain unchanged, i.e., 4kb.
Bug: 315509500
Test: lunch aosp_cf_x86_64_phone_pgagnostic-trunk_staging-userdebug
atest sys_vfs
atest sys_statvfs
Change-Id: I64ba8a55fa91a98e7d2de890059991693abdc002
diff --git a/tests/sys_statvfs_test.cpp b/tests/sys_statvfs_test.cpp
index 5dd7b93..25256ff 100644
--- a/tests/sys_statvfs_test.cpp
+++ b/tests/sys_statvfs_test.cpp
@@ -25,7 +25,15 @@
#include <string>
template <typename StatVfsT> void Check(StatVfsT& sb) {
+#if defined(__x86_64__)
+ // On x86_64 based 16kb page size targets, the page size in userspace is simulated to 16kb but
+ // the underlying filesystem block size would remain unchanged, i.e., 4kb.
+ // For more info:
+ // https://source.android.com/docs/core/architecture/16kb-page-size/getting-started-cf-x86-64-pgagnostic
+ EXPECT_EQ(4096, static_cast<int>(sb.f_bsize));
+#else
EXPECT_EQ(getpagesize(), static_cast<int>(sb.f_bsize));
+#endif
EXPECT_EQ(0U, sb.f_bfree);
EXPECT_EQ(0U, sb.f_ffree);
EXPECT_EQ(255U, sb.f_namemax);