Merge "vts_fs_test: Relax filesystem constraints for fixed partitions." into udc-dev am: 7f5512dcd0 am: 1ae6f6c94d

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/23597911

Change-Id: Id6f30d3d65b017d1f03086747ba56c347489de62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
David Anderson 2023-06-08 16:57:41 +00:00 committed by Automerger Merge Worker
commit 6a45809e62

View file

@ -55,6 +55,21 @@ TEST(fs, ErofsSupported) {
}
TEST(fs, PartitionTypes) {
// Requirements only apply to Android 13+, 5.10+ devices.
int vsr_level = GetVsrLevel();
if (vsr_level < __ANDROID_API_T__) {
GTEST_SKIP();
}
struct utsname uts;
ASSERT_EQ(uname(&uts), 0);
unsigned int major, minor;
ASSERT_EQ(sscanf(uts.release, "%u.%u", &major, &minor), 2);
if (major < 5 || (major == 5 && minor < 10)) {
GTEST_SKIP();
}
android::fs_mgr::Fstab fstab;
ASSERT_TRUE(android::fs_mgr::ReadFstabFromFile("/proc/mounts", &fstab));
@ -64,12 +79,7 @@ TEST(fs, PartitionTypes) {
ASSERT_TRUE(android::base::Readlink("/dev/block/by-name/super", &super_bdev));
ASSERT_TRUE(android::base::Readlink("/dev/block/by-name/userdata", &userdata_bdev));
int vsr_level = GetVsrLevel();
std::vector<std::string> must_be_f2fs;
if (vsr_level >= __ANDROID_API_T__) {
must_be_f2fs.emplace_back("/data");
}
std::vector<std::string> must_be_f2fs = {"/data"};
if (vsr_level >= __ANDROID_API_U__) {
must_be_f2fs.emplace_back("/metadata");
}
@ -98,17 +108,13 @@ TEST(fs, PartitionTypes) {
continue;
}
if (vsr_level < __ANDROID_API_T__) {
continue;
}
if (vsr_level == __ANDROID_API_T__ && parent_bdev != super_bdev) {
// Only check for dynamic partitions at this VSR level.
continue;
}
if (entry.flags & MS_RDONLY) {
std::vector<std::string> allowed = {"erofs", "ext4", "f2fs"};
if (parent_bdev != super_bdev) {
// Ignore non-AOSP partitions (eg anything outside of super).
continue;
}
std::vector<std::string> allowed = {"erofs", "ext4", "f2fs"};
EXPECT_NE(std::find(allowed.begin(), allowed.end(), entry.fs_type), allowed.end())
<< entry.mount_point;
} else {