fuzzy_fastboot: Use uint64_t for partition sizes.

Bug: N/A
Test: fuzzy_fastboot Conformance.PartitionInfo passes
Change-Id: I27182585a1522d22dd3ddfe83ce22e06dd7fc762
This commit is contained in:
David Anderson 2018-09-04 15:57:39 -07:00
parent 03de645aac
commit 6c30f6e3d2
3 changed files with 10 additions and 10 deletions

View File

@ -126,7 +126,7 @@ RetCode FastBootDriver::FlashPartition(const std::string& part, sparse_file* s)
return RawCommand(Commands::FLASH + part);
}
RetCode FastBootDriver::Partitions(std::vector<std::tuple<std::string, uint32_t>>* parts) {
RetCode FastBootDriver::Partitions(std::vector<std::tuple<std::string, uint64_t>>* parts) {
std::vector<std::string> all;
RetCode ret;
if ((ret = GetVarAll(&all))) {
@ -140,7 +140,7 @@ RetCode FastBootDriver::Partitions(std::vector<std::tuple<std::string, uint32_t>
if (std::regex_match(s, sm, reg)) {
std::string m1(sm[1]);
std::string m2(sm[2]);
uint32_t tmp = strtol(m2.c_str(), 0, 16);
uint64_t tmp = strtoll(m2.c_str(), 0, 16);
parts->push_back(std::make_tuple(m1, tmp));
}
}

View File

@ -99,7 +99,7 @@ class FastBootDriver {
RetCode FlashPartition(const std::string& part, int fd, uint32_t sz);
RetCode FlashPartition(const std::string& part, sparse_file* s);
RetCode Partitions(std::vector<std::tuple<std::string, uint32_t>>* parts);
RetCode Partitions(std::vector<std::tuple<std::string, uint64_t>>* parts);
RetCode Require(const std::string& var, const std::vector<std::string>& allowed, bool* reqmet,
bool invert = false);

View File

@ -304,7 +304,7 @@ TEST_F(Conformance, UnlockAbility) {
}
TEST_F(Conformance, PartitionInfo) {
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed";
EXPECT_GT(parts.size(), 0)
<< "getvar:all did not report any partition-size: through INFO responses";
@ -340,7 +340,7 @@ TEST_F(Conformance, Slots) {
// Can't run out of alphabet letters...
ASSERT_LE(num_slots, 26) << "What?! You can't have more than 26 slots";
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed";
std::map<std::string, std::set<char>> part_slots;
@ -587,14 +587,14 @@ TEST_F(UnlockPermissions, DownloadFlash) {
std::vector<char> buf{'a', 'o', 's', 'p'};
EXPECT_EQ(fb->Download(buf), SUCCESS) << "Download failed in unlocked mode";
;
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed in unlocked mode";
}
TEST_F(LockPermissions, DownloadFlash) {
std::vector<char> buf{'a', 'o', 's', 'p'};
EXPECT_EQ(fb->Download(buf), SUCCESS) << "Download failed in locked mode";
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed in locked mode";
std::string resp;
for (const auto tup : parts) {
@ -607,7 +607,7 @@ TEST_F(LockPermissions, DownloadFlash) {
}
TEST_F(LockPermissions, Erase) {
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed";
std::string resp;
for (const auto tup : parts) {
@ -619,7 +619,7 @@ TEST_F(LockPermissions, Erase) {
}
TEST_F(LockPermissions, SetActive) {
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
EXPECT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed";
std::string resp;
@ -916,7 +916,7 @@ INSTANTIATE_TEST_CASE_P(XMLGetVar, ExtensionsGetVarConformance,
TEST_P(AnyPartition, ReportedGetVarAll) {
// As long as the partition is reported in INFO, it would be tested by generic Conformance
std::vector<std::tuple<std::string, uint32_t>> parts;
std::vector<std::tuple<std::string, uint64_t>> parts;
ASSERT_EQ(fb->Partitions(&parts), SUCCESS) << "getvar:all failed";
const std::string name = GetParam().first;
if (GetParam().second.slots) {