Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82a098ce authored by David Anderson's avatar David Anderson Committed by Gerrit Code Review
Browse files

Merge "fuzzy_fastboot: Use uint64_t for partition sizes."

parents 5ee058d7 6c30f6e3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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));
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -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);

+7 −7
Original line number Diff line number Diff line
@@ -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) {