Loading fs_mgr/libsnapshot/snapshot.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -3216,6 +3216,8 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife vabc_disable_reason = "recovery"; } else if (!cow_format_support) { vabc_disable_reason = "cow format not supported"; } else if (!KernelSupportsCompressedSnapshots()) { vabc_disable_reason = "kernel missing userspace block device support"; } if (!vabc_disable_reason.empty()) { Loading fs_mgr/libsnapshot/snapshot_test.cpp +34 −1 Original line number Diff line number Diff line Loading @@ -124,6 +124,10 @@ class SnapshotTest : public ::testing::Test { SKIP_IF_NON_VIRTUAL_AB(); SetupProperties(); if (!DeviceSupportsMode()) { GTEST_SKIP() << "Mode not supported on this device"; } InitializeState(); CleanupTestArtifacts(); FormatFakeSuper(); Loading Loading @@ -159,9 +163,15 @@ class SnapshotTest : public ::testing::Test { IPropertyFetcher::OverrideForTesting(std::move(fetcher)); if (GetLegacyCompressionEnabledProperty() || CanUseUserspaceSnapshots()) { // If we're asked to test the device's actual configuration, then it // may be misconfigured, so check for kernel support as libsnapshot does. if (FLAGS_force_mode.empty()) { snapuserd_required_ = KernelSupportsCompressedSnapshots(); } else { snapuserd_required_ = true; } } } void TearDown() override { RETURN_IF_NON_VIRTUAL_AB(); Loading @@ -176,6 +186,16 @@ class SnapshotTest : public ::testing::Test { LOG(INFO) << "Teardown complete for test: " << test_name_; } bool DeviceSupportsMode() { if (FLAGS_force_mode.empty()) { return true; } if (snapuserd_required_ && !KernelSupportsCompressedSnapshots()) { return false; } return true; } void InitializeState() { ASSERT_TRUE(sm->EnsureImageManager()); image_manager_ = sm->image_manager(); Loading @@ -193,6 +213,11 @@ class SnapshotTest : public ::testing::Test { // get an accurate list to remove. lock_ = nullptr; // If there is no image manager, the test was skipped. if (!image_manager_) { return; } std::vector<std::string> snapshots = {"test-snapshot", "test_partition_a", "test_partition_b"}; for (const auto& snapshot : snapshots) { Loading Loading @@ -946,6 +971,11 @@ class SnapshotUpdateTest : public SnapshotTest { SKIP_IF_NON_VIRTUAL_AB(); SnapshotTest::SetUp(); if (!image_manager_) { // Test was skipped. return; } Cleanup(); // Cleanup() changes slot suffix, so initialize it again. Loading Loading @@ -2680,6 +2710,9 @@ class ImageManagerTest : public SnapshotTest { CleanUp(); } void CleanUp() { if (!image_manager_) { return; } EXPECT_TRUE(!image_manager_->BackingImageExists(kImageName) || image_manager_->DeleteBackingImage(kImageName)); } Loading fs_mgr/libsnapshot/utility.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <fs_mgr/roots.h> #include <liblp/property_fetcher.h> using android::dm::DeviceMapper; using android::dm::kSectorSize; using android::fiemap::FiemapStatus; using android::fs_mgr::EnsurePathMounted; Loading Loading @@ -251,7 +252,10 @@ bool CanUseUserspaceSnapshots() { LOG(INFO) << "Userspace snapshots disabled for testing"; return false; } if (!KernelSupportsCompressedSnapshots()) { LOG(ERROR) << "Userspace snapshots requested, but no kernel support is available."; return false; } return true; } Loading @@ -278,5 +282,10 @@ bool IsDmSnapshotTestingEnabled() { return fetcher->GetBoolProperty("snapuserd.test.dm.snapshots", false); } bool KernelSupportsCompressedSnapshots() { auto& dm = DeviceMapper::Instance(); return dm.GetTargetByName("user", nullptr); } } // namespace snapshot } // namespace android fs_mgr/libsnapshot/utility.h +2 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,8 @@ std::ostream& operator<<(std::ostream& os, const Now&); void AppendExtent(google::protobuf::RepeatedPtrField<chromeos_update_engine::Extent>* extents, uint64_t start_block, uint64_t num_blocks); bool KernelSupportsCompressedSnapshots(); bool GetLegacyCompressionEnabledProperty(); bool GetUserspaceSnapshotsEnabledProperty(); bool GetIouringEnabledProperty(); Loading Loading
fs_mgr/libsnapshot/snapshot.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -3216,6 +3216,8 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife vabc_disable_reason = "recovery"; } else if (!cow_format_support) { vabc_disable_reason = "cow format not supported"; } else if (!KernelSupportsCompressedSnapshots()) { vabc_disable_reason = "kernel missing userspace block device support"; } if (!vabc_disable_reason.empty()) { Loading
fs_mgr/libsnapshot/snapshot_test.cpp +34 −1 Original line number Diff line number Diff line Loading @@ -124,6 +124,10 @@ class SnapshotTest : public ::testing::Test { SKIP_IF_NON_VIRTUAL_AB(); SetupProperties(); if (!DeviceSupportsMode()) { GTEST_SKIP() << "Mode not supported on this device"; } InitializeState(); CleanupTestArtifacts(); FormatFakeSuper(); Loading Loading @@ -159,9 +163,15 @@ class SnapshotTest : public ::testing::Test { IPropertyFetcher::OverrideForTesting(std::move(fetcher)); if (GetLegacyCompressionEnabledProperty() || CanUseUserspaceSnapshots()) { // If we're asked to test the device's actual configuration, then it // may be misconfigured, so check for kernel support as libsnapshot does. if (FLAGS_force_mode.empty()) { snapuserd_required_ = KernelSupportsCompressedSnapshots(); } else { snapuserd_required_ = true; } } } void TearDown() override { RETURN_IF_NON_VIRTUAL_AB(); Loading @@ -176,6 +186,16 @@ class SnapshotTest : public ::testing::Test { LOG(INFO) << "Teardown complete for test: " << test_name_; } bool DeviceSupportsMode() { if (FLAGS_force_mode.empty()) { return true; } if (snapuserd_required_ && !KernelSupportsCompressedSnapshots()) { return false; } return true; } void InitializeState() { ASSERT_TRUE(sm->EnsureImageManager()); image_manager_ = sm->image_manager(); Loading @@ -193,6 +213,11 @@ class SnapshotTest : public ::testing::Test { // get an accurate list to remove. lock_ = nullptr; // If there is no image manager, the test was skipped. if (!image_manager_) { return; } std::vector<std::string> snapshots = {"test-snapshot", "test_partition_a", "test_partition_b"}; for (const auto& snapshot : snapshots) { Loading Loading @@ -946,6 +971,11 @@ class SnapshotUpdateTest : public SnapshotTest { SKIP_IF_NON_VIRTUAL_AB(); SnapshotTest::SetUp(); if (!image_manager_) { // Test was skipped. return; } Cleanup(); // Cleanup() changes slot suffix, so initialize it again. Loading Loading @@ -2680,6 +2710,9 @@ class ImageManagerTest : public SnapshotTest { CleanUp(); } void CleanUp() { if (!image_manager_) { return; } EXPECT_TRUE(!image_manager_->BackingImageExists(kImageName) || image_manager_->DeleteBackingImage(kImageName)); } Loading
fs_mgr/libsnapshot/utility.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <fs_mgr/roots.h> #include <liblp/property_fetcher.h> using android::dm::DeviceMapper; using android::dm::kSectorSize; using android::fiemap::FiemapStatus; using android::fs_mgr::EnsurePathMounted; Loading Loading @@ -251,7 +252,10 @@ bool CanUseUserspaceSnapshots() { LOG(INFO) << "Userspace snapshots disabled for testing"; return false; } if (!KernelSupportsCompressedSnapshots()) { LOG(ERROR) << "Userspace snapshots requested, but no kernel support is available."; return false; } return true; } Loading @@ -278,5 +282,10 @@ bool IsDmSnapshotTestingEnabled() { return fetcher->GetBoolProperty("snapuserd.test.dm.snapshots", false); } bool KernelSupportsCompressedSnapshots() { auto& dm = DeviceMapper::Instance(); return dm.GetTargetByName("user", nullptr); } } // namespace snapshot } // namespace android
fs_mgr/libsnapshot/utility.h +2 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,8 @@ std::ostream& operator<<(std::ostream& os, const Now&); void AppendExtent(google::protobuf::RepeatedPtrField<chromeos_update_engine::Extent>* extents, uint64_t start_block, uint64_t num_blocks); bool KernelSupportsCompressedSnapshots(); bool GetLegacyCompressionEnabledProperty(); bool GetUserspaceSnapshotsEnabledProperty(); bool GetIouringEnabledProperty(); Loading