fastbootd: Fix partition size testing issues.

Partition sizes must be reported with an "0x" prefix for fuzzy_fastboot.
Also, with dynamic partitions, the size of a partition can be 0.

Bug: 78793464
Test: fuzzy_fastboot Conformance.PartitionInfo does not error on
      partition sizes when using fastbootd

Change-Id: I4148440bd9ed420878940829618cbf8cee85bf6a
This commit is contained in:
David Anderson 2018-09-04 16:22:41 -07:00
parent 6c30f6e3d2
commit 4758967bf9
2 changed files with 2 additions and 2 deletions

View File

@ -191,7 +191,7 @@ bool GetPartitionSize(FastbootDevice* device, const std::vector<std::string>& ar
return false;
}
uint64_t size = get_block_device_size(handle.fd());
*message = android::base::StringPrintf("%" PRIX64, size);
*message = android::base::StringPrintf("0x%" PRIX64, size);
return true;
}

View File

@ -310,7 +310,7 @@ TEST_F(Conformance, PartitionInfo) {
<< "getvar:all did not report any partition-size: through INFO responses";
std::set<std::string> allowed{"ext4", "f2fs", "raw"};
for (const auto p : parts) {
EXPECT_GT(std::get<1>(p), 0);
EXPECT_GE(std::get<1>(p), 0);
std::string part(std::get<0>(p));
std::set<std::string> allowed{"ext4", "f2fs", "raw"};
std::string resp;