fuzzy_fastboot: Add malformed download command test
Add a malformed download command test. And add a sparse file test with very large block size Bug: 215236564 Test: bootloader fastboot Change-Id: I1072ba189ac15b2e1eb8f13ffd754f93c967e2d5
This commit is contained in:
parent
f6017f8508
commit
7e87807d16
1 changed files with 23 additions and 0 deletions
|
@ -874,6 +874,12 @@ TEST_F(Fuzz, DownloadInvalid8) {
|
|||
<< "Device did not respond with FAIL for malformed download command '" << cmd << "'";
|
||||
}
|
||||
|
||||
TEST_F(Fuzz, DownloadInvalid9) {
|
||||
std::string cmd("download:2PPPPPPPPPPPPPPPPPPPPPPPPPPPPPP");
|
||||
EXPECT_EQ(fb->RawCommand(cmd), DEVICE_FAIL)
|
||||
<< "Device did not respond with FAIL for malformed download command '" << cmd << "'";
|
||||
}
|
||||
|
||||
TEST_F(Fuzz, GetVarAllSpam) {
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double> elapsed;
|
||||
|
@ -996,6 +1002,23 @@ TEST_F(Fuzz, SparseZeroBlkSize) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(Fuzz, SparseVeryLargeBlkSize) {
|
||||
// handcrafted sparse file with block size of ~4GB and divisible 4
|
||||
const std::vector<char> buf = {
|
||||
'\x3a', '\xff', '\x26', '\xed', '\x01', '\x00', '\x00', '\x00',
|
||||
'\x1c', '\x00', '\x0c', '\x00', '\xF0', '\xFF', '\xFF', '\xFF',
|
||||
'\x01', '\x00', '\x00', '\x00', '\x01', '\x00', '\x00', '\x00',
|
||||
'\x00', '\x00', '\x00', '\x00', '\xc3', '\xca', '\x00', '\x00',
|
||||
'\x01', '\x00', '\x00', '\x00', '\x0c', '\x00', '\x00', '\x00',
|
||||
'\x11', '\x22', '\x33', '\x44'
|
||||
};
|
||||
|
||||
ASSERT_EQ(DownloadCommand(buf.size()), SUCCESS) << "Device rejected download command";
|
||||
ASSERT_EQ(SendBuffer(buf), SUCCESS) << "Downloading payload failed";
|
||||
ASSERT_EQ(HandleResponse(), SUCCESS) << "Not receive okay";
|
||||
ASSERT_EQ(fb->Flash("userdata"), SUCCESS) << "Flashing sparse failed";
|
||||
}
|
||||
|
||||
TEST_F(Fuzz, SparseTrimmed) {
|
||||
// handcrafted malform sparse file which is trimmed
|
||||
const std::vector<char> buf = {
|
||||
|
|
Loading…
Reference in a new issue