Loading fs_mgr/libsnapshot/Android.bp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -415,6 +415,9 @@ cc_test { test_options: { test_options: { min_shipping_api_level: 30, min_shipping_api_level: 30, }, }, data: [ "tools/testdata/cow_v2", ], auto_gen_config: true, auto_gen_config: true, require_root: false, require_root: false, host_supported: true, host_supported: true, Loading fs_mgr/libsnapshot/libsnapshot_cow/test_v2.cpp +31 −0 Original line number Original line Diff line number Diff line Loading @@ -1504,6 +1504,37 @@ TEST_F(CowTest, InvalidMergeOrderTest) { ASSERT_FALSE(reader.VerifyMergeOps()); ASSERT_FALSE(reader.VerifyMergeOps()); } } unique_fd OpenTestFile(const std::string& file, int flags) { std::string path = "tools/testdata/" + file; unique_fd fd(open(path.c_str(), flags)); if (fd >= 0) { return fd; } path = android::base::GetExecutableDirectory() + "/" + path; return unique_fd{open(path.c_str(), flags)}; } TEST_F(CowTest, CompatibilityTest) { std::string filename = "cow_v2"; auto fd = OpenTestFile(filename, O_RDONLY); if (fd.get() == -1) { LOG(ERROR) << filename << " not found"; GTEST_SKIP(); } CowReader reader; reader.Parse(fd); const auto& header = reader.GetHeader(); ASSERT_EQ(header.prefix.magic, kCowMagicNumber); ASSERT_EQ(header.prefix.major_version, kCowVersionMajor); ASSERT_EQ(header.prefix.minor_version, kCowVersionMinor); CowFooter footer; ASSERT_TRUE(reader.GetFooter(&footer)); } } // namespace snapshot } // namespace snapshot } // namespace android } // namespace android Loading Loading
fs_mgr/libsnapshot/Android.bp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -415,6 +415,9 @@ cc_test { test_options: { test_options: { min_shipping_api_level: 30, min_shipping_api_level: 30, }, }, data: [ "tools/testdata/cow_v2", ], auto_gen_config: true, auto_gen_config: true, require_root: false, require_root: false, host_supported: true, host_supported: true, Loading
fs_mgr/libsnapshot/libsnapshot_cow/test_v2.cpp +31 −0 Original line number Original line Diff line number Diff line Loading @@ -1504,6 +1504,37 @@ TEST_F(CowTest, InvalidMergeOrderTest) { ASSERT_FALSE(reader.VerifyMergeOps()); ASSERT_FALSE(reader.VerifyMergeOps()); } } unique_fd OpenTestFile(const std::string& file, int flags) { std::string path = "tools/testdata/" + file; unique_fd fd(open(path.c_str(), flags)); if (fd >= 0) { return fd; } path = android::base::GetExecutableDirectory() + "/" + path; return unique_fd{open(path.c_str(), flags)}; } TEST_F(CowTest, CompatibilityTest) { std::string filename = "cow_v2"; auto fd = OpenTestFile(filename, O_RDONLY); if (fd.get() == -1) { LOG(ERROR) << filename << " not found"; GTEST_SKIP(); } CowReader reader; reader.Parse(fd); const auto& header = reader.GetHeader(); ASSERT_EQ(header.prefix.magic, kCowMagicNumber); ASSERT_EQ(header.prefix.major_version, kCowVersionMajor); ASSERT_EQ(header.prefix.minor_version, kCowVersionMinor); CowFooter footer; ASSERT_TRUE(reader.GetFooter(&footer)); } } // namespace snapshot } // namespace snapshot } // namespace android } // namespace android Loading