From e55e3dcd3f59008f1e3a770b5265be88b332f22c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 6 Jun 2023 16:45:05 -0700 Subject: [PATCH] vts_fs_test: Relax filesystem constraints for fixed partitions. Adjust this test to align with VSR. First, skip the test if kernel is < 5.10 or < Android 13. Second, allow non-dynamic partitions to be vfat. Bug: 286038059 Test: vts_fs_test on CF (cherry picked from https://android-review.googlesource.com/q/commit:084c94e43eb2916c84c72de524c6e8c3d5ec2d4f) Merged-In: I5bd874f68296f7155d8c4366ebc13fe3d59c3ee6 Change-Id: I5bd874f68296f7155d8c4366ebc13fe3d59c3ee6 --- fs_mgr/tests/vts_fs_test.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/fs_mgr/tests/vts_fs_test.cpp b/fs_mgr/tests/vts_fs_test.cpp index bb2ceb9b5..4d771fa04 100644 --- a/fs_mgr/tests/vts_fs_test.cpp +++ b/fs_mgr/tests/vts_fs_test.cpp @@ -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 must_be_f2fs; - if (vsr_level >= __ANDROID_API_T__) { - must_be_f2fs.emplace_back("/data"); - } + std::vector 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 allowed = {"erofs", "ext4", "f2fs"}; + if (parent_bdev != super_bdev) { + // Ignore non-AOSP partitions (eg anything outside of super). + continue; + } + std::vector allowed = {"erofs", "ext4", "f2fs"}; EXPECT_NE(std::find(allowed.begin(), allowed.end(), entry.fs_type), allowed.end()) << entry.mount_point; } else {