summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2022-02-11 05:09:22 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-02-11 05:09:22 +0000
commit6172f23404d19bba0af6bc2e54cf4f6aa8cb92aa (patch)
tree58adbe06f1a1d414cd33d02671ba45ccd02df8b9
parentb5d23a7e052fc771cbde36dc34d4d0f2a3f7af53 (diff)
parent48104202b4fe12c26611f823185424f07c773495 (diff)
downloadgsid-6172f23404d19bba0af6bc2e54cf4f6aa8cb92aa.tar.gz
Merge "gsid: Add VTS tests for new /metadata and /data requirements." am: 48104202b4
Original change: https://android-review.googlesource.com/c/platform/system/gsid/+/1966144 Change-Id: I1d5bbc6612648db7fc24e9dea7d25dee499b6fa9
-rw-r--r--tests/boot_tests.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/boot_tests.cpp b/tests/boot_tests.cpp
index a00e798..d002c89 100644
--- a/tests/boot_tests.cpp
+++ b/tests/boot_tests.cpp
@@ -14,6 +14,14 @@
// limitations under the License.
//
+#include <linux/fs.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <sys/types.h>
+#include <sys/vfs.h>
+#include <unistd.h>
+
+#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <android/hardware/weaver/1.0/IWeaver.h>
#include <ext4_utils/ext4_utils.h>
@@ -40,6 +48,10 @@ TEST(MetadataPartition, FirstStageMount) {
}
}
+static int GetVsrLevel() {
+ return android::base::GetIntProperty("ro.vendor.api_level", -1);
+}
+
TEST(MetadataPartition, MinimumSize) {
Fstab fstab;
ASSERT_TRUE(ReadDefaultFstab(&fstab));
@@ -51,7 +63,11 @@ TEST(MetadataPartition, MinimumSize) {
ASSERT_GE(fd, 0);
uint64_t size = get_block_device_size(fd);
- EXPECT_GE(size, 16777216);
+ if (GetVsrLevel() >= __ANDROID_API_T__) {
+ ASSERT_GE(size, 67108864);
+ } else {
+ ASSERT_GE(size, 16777216);
+ }
}
TEST(Weaver, MinimumSlots) {
@@ -71,3 +87,30 @@ TEST(Weaver, MinimumSlots) {
ASSERT_EQ(hw_status, WeaverStatus::OK);
EXPECT_GE(hw_config.slots, 16);
}
+
+TEST(MetadataPartition, FsType) {
+ if (GetVsrLevel() < __ANDROID_API_T__) {
+ GTEST_SKIP();
+ }
+
+ Fstab fstab;
+ ASSERT_TRUE(ReadDefaultFstab(&fstab));
+
+ std::vector<std::string> mount_points = {"/data", "/metadata"};
+ for (const auto& mount_point : mount_points) {
+ auto path = mount_point + "/gsi";
+
+ // These paths should not be symlinks.
+ struct stat s;
+ ASSERT_GE(lstat(path.c_str(), &s), 0) << path;
+ ASSERT_FALSE(S_ISLNK(s.st_mode));
+
+ struct statfs64 fs;
+ ASSERT_GE(statfs64(path.c_str(), &fs), 0) << path;
+ ASSERT_EQ(fs.f_type, F2FS_SUPER_MAGIC);
+
+ auto entry = GetEntryForMountPoint(&fstab, mount_point);
+ ASSERT_NE(entry, nullptr);
+ ASSERT_EQ(entry->fs_type, "f2fs");
+ }
+}