Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit db6719f

Browse files
Vilas BhatGerrit Code Review
authored andcommitted
Merge "16k: bionic: Fix tests for x86_64 16kb page size simulation" into main
2 parents de2c33f + 4c87f0d commit db6719f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/sys_statvfs_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525
#include <string>
2626

2727
template <typename StatVfsT> void Check(StatVfsT& sb) {
28+
#if defined(__x86_64__)
29+
// On x86_64 based 16kb page size targets, the page size in userspace is simulated to 16kb but
30+
// the underlying filesystem block size would remain unchanged, i.e., 4kb.
31+
// For more info:
32+
// https://source.android.com/docs/core/architecture/16kb-page-size/getting-started-cf-x86-64-pgagnostic
33+
EXPECT_EQ(4096, static_cast<int>(sb.f_bsize));
34+
#else
2835
EXPECT_EQ(getpagesize(), static_cast<int>(sb.f_bsize));
36+
#endif
2937
EXPECT_EQ(0U, sb.f_bfree);
3038
EXPECT_EQ(0U, sb.f_ffree);
3139
EXPECT_EQ(255U, sb.f_namemax);

tests/sys_vfs_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@
2727
#include "utils.h"
2828

2929
template <typename StatFsT> void Check(StatFsT& sb) {
30+
#if defined(__x86_64__)
31+
// On x86_64 based 16kb page size targets, the page size in userspace is simulated to 16kb but
32+
// the underlying filesystem block size would remain unchanged, i.e., 4kb.
33+
// For more info:
34+
// https://source.android.com/docs/core/architecture/16kb-page-size/getting-started-cf-x86-64-pgagnostic
35+
EXPECT_EQ(4096, static_cast<int>(sb.f_bsize));
36+
#else
3037
EXPECT_EQ(getpagesize(), static_cast<int>(sb.f_bsize));
38+
#endif
3139
EXPECT_EQ(0U, sb.f_bfree);
3240
EXPECT_EQ(0U, sb.f_ffree);
3341
EXPECT_EQ(255, static_cast<int>(sb.f_namelen));

0 commit comments

Comments
 (0)