Skip to content

Commit

Permalink
libsnapshot_test: hardcode alignment.
Browse files Browse the repository at this point in the history
SnapshotUpdateTest uses a relatively small super partition, which
requires a small alignment and 0 alignment offset to work. For the
purpose of this test, hardcode the alignment and offset.
This test isn't about testing liblp or libdm.

Fixes: 154355449
Fixes: 157437632
Bug: 158718136
Bug: 157633441
Bug: 154646936

Test: atest on devices with alignment of data partition >= 512KiB

Change-Id: I1d0474f028cc824bd4197d0228350395239b3b81
(cherry picked from commit 31739669e91c7a3afc5bee23e43bc45fb4154667)
Merged-In: I1d0474f028cc824bd4197d0228350395239b3b81

Former-commit-id: 755eb6b6069efb3edbbaa335899d34369ddea83a
  • Loading branch information
Yifan Hong committed Jun 15, 2020
1 parent e09f8ea commit cf53c54
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions fs_mgr/libsnapshot/test_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,19 @@ android::base::unique_fd TestPartitionOpener::Open(const std::string& partition_

bool TestPartitionOpener::GetInfo(const std::string& partition_name,
android::fs_mgr::BlockDeviceInfo* info) const {
if (partition_name == "super") {
return PartitionOpener::GetInfo(fake_super_path_, info);
if (partition_name != "super") {
return PartitionOpener::GetInfo(partition_name, info);
}

if (PartitionOpener::GetInfo(fake_super_path_, info)) {
// SnapshotUpdateTest uses a relatively small super partition, which requires a small
// alignment and 0 offset to work. For the purpose of this test, hardcode the alignment
// and offset. This test isn't about testing liblp or libdm.
info->alignment_offset = 0;
info->alignment = std::min<uint32_t>(info->alignment, static_cast<uint32_t>(128_KiB));
return true;
}
return PartitionOpener::GetInfo(partition_name, info);
return false;
}

std::string TestPartitionOpener::GetDeviceString(const std::string& partition_name) const {
Expand Down

0 comments on commit cf53c54

Please sign in to comment.