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

Commit 49ef2c58 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove tests for sparse images with CRC from fuzzy_fastboot"

parents afac3fe0 94d05063
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -441,9 +441,6 @@ TEST_F(Conformance, SparseBlockSupport0) {
        ASSERT_TRUE(*sparse) << "Sparse file creation failed on: " << bs;
        EXPECT_EQ(fb->Download(*sparse), SUCCESS) << "Download sparse failed: " << sparse.Rep();
        EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
        EXPECT_EQ(fb->Download(*sparse, true), SUCCESS)
                << "Download sparse with crc failed: " << sparse.Rep();
        EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
    }
}

@@ -462,9 +459,6 @@ TEST_F(Conformance, SparseBlockSupport1) {
                << "Adding data failed to sparse file: " << sparse.Rep();
        EXPECT_EQ(fb->Download(*sparse), SUCCESS) << "Download sparse failed: " << sparse.Rep();
        EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
        EXPECT_EQ(fb->Download(*sparse, true), SUCCESS)
                << "Download sparse with crc failed: " << sparse.Rep();
        EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
    }
}

@@ -474,9 +468,6 @@ TEST_F(Conformance, SparseDownload0) {
    ASSERT_TRUE(*sparse) << "Sparse image creation failed";
    EXPECT_EQ(fb->Download(*sparse), SUCCESS) << "Download sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Download(*sparse, true), SUCCESS)
            << "Download sparse with crc failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
}

TEST_F(Conformance, SparseDownload1) {
@@ -487,9 +478,6 @@ TEST_F(Conformance, SparseDownload1) {
            << "Adding data failed to sparse file: " << sparse.Rep();
    EXPECT_EQ(fb->Download(*sparse), SUCCESS) << "Download sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Download(*sparse, true), SUCCESS)
            << "Download sparse with crc failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
}

TEST_F(Conformance, SparseDownload2) {
@@ -503,9 +491,6 @@ TEST_F(Conformance, SparseDownload2) {
            << "Adding data failed to sparse file: " << sparse.Rep();
    EXPECT_EQ(fb->Download(*sparse), SUCCESS) << "Download sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Download(*sparse, true), SUCCESS)
            << "Download sparse with crc failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
}

TEST_F(Conformance, SparseDownload3) {
@@ -537,9 +522,6 @@ TEST_F(Conformance, SparseDownload3) {
    }
    EXPECT_EQ(fb->Download(*sparse), SUCCESS) << "Download sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
    EXPECT_EQ(fb->Download(*sparse, true), SUCCESS)
            << "Download sparse with crc failed: " << sparse.Rep();
    EXPECT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed: " << sparse.Rep();
}

TEST_F(Conformance, SparseVersionCheck) {
@@ -559,24 +541,6 @@ TEST_F(Conformance, SparseVersionCheck) {
    }
}

TEST_F(Conformance, SparseCRCCheck) {
    SparseWrapper sparse(4096, 4096);
    ASSERT_TRUE(*sparse) << "Sparse image creation failed";
    std::vector<char> buf = RandomBuf(4096);
    ASSERT_EQ(sparse_file_add_data(*sparse, buf.data(), buf.size(), 0), 0)
            << "Adding data failed to sparse file: " << sparse.Rep();
    ASSERT_TRUE(SparseToBuf(*sparse, &buf, true)) << "Sparse buffer creation failed";
    // Flip a bit in the crc
    buf.back() = buf.back() ^ 0x01;
    ASSERT_EQ(DownloadCommand(buf.size()), SUCCESS) << "Device rejected download command";
    ASSERT_EQ(SendBuffer(buf), SUCCESS) << "Downloading payload failed";
    // It can either reject this download or reject it during flash
    if (HandleResponse() != DEVICE_FAIL) {
        EXPECT_EQ(fb->Flash("userdata"), DEVICE_FAIL)
                << "Flashing an invalid sparse version should fail " << sparse.Rep();
    }
}

TEST_F(UnlockPermissions, Download) {
    std::vector<char> buf{'a', 'o', 's', 'p'};
    EXPECT_EQ(fb->Download(buf), SUCCESS) << "Download 4-byte payload failed";