Merge "Allow Conformance tests to verify userspace fastboot."
This commit is contained in:
commit
4aa42b46c9
3 changed files with 23 additions and 0 deletions
|
|
@ -86,6 +86,12 @@ bool FastBootTest::UsbStillAvailible() {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FastBootTest::UserSpaceFastboot() {
|
||||
std::string value;
|
||||
fb->GetVar("is-userspace", &value);
|
||||
return value == "yes";
|
||||
}
|
||||
|
||||
RetCode FastBootTest::DownloadCommand(uint32_t size, std::string* response,
|
||||
std::vector<std::string>* info) {
|
||||
return fb->DownloadCommand(size, response, info);
|
||||
|
|
@ -158,6 +164,12 @@ void FastBootTest::SetLockState(bool unlock, bool assert_change) {
|
|||
return;
|
||||
}
|
||||
|
||||
// User space fastboot implementations are not allowed to communicate to
|
||||
// secure hardware and hence cannot lock/unlock the device.
|
||||
if (UserSpaceFastboot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string resp;
|
||||
std::vector<std::string> info;
|
||||
// To avoid risk of bricking device, make sure unlock ability is set to 1
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class FastBootTest : public testing::Test {
|
|||
|
||||
static int MatchFastboot(usb_ifc_info* info, const char* local_serial = nullptr);
|
||||
bool UsbStillAvailible();
|
||||
bool UserSpaceFastboot();
|
||||
|
||||
protected:
|
||||
RetCode DownloadCommand(uint32_t size, std::string* response = nullptr,
|
||||
|
|
|
|||
|
|
@ -289,6 +289,12 @@ TEST_F(Conformance, GetVarAll) {
|
|||
TEST_F(Conformance, UnlockAbility) {
|
||||
std::string resp;
|
||||
std::vector<std::string> info;
|
||||
// Userspace fastboot implementations do not have a way to get this
|
||||
// information.
|
||||
if (UserSpaceFastboot()) {
|
||||
GTEST_LOG_(INFO) << "This test is skipped for userspace fastboot.";
|
||||
return;
|
||||
}
|
||||
EXPECT_EQ(fb->RawCommand("flashing get_unlock_ability", &resp, &info), SUCCESS)
|
||||
<< "'flashing get_unlock_ability' failed";
|
||||
// There are two ways this can be reported, through info or the actual response
|
||||
|
|
@ -412,6 +418,10 @@ TEST_F(Conformance, LockAndUnlockPrompt) {
|
|||
ASSERT_TRUE(resp == "yes" || resp == "no")
|
||||
<< "Device did not respond with 'yes' or 'no' for getvar:unlocked";
|
||||
bool curr = resp == "yes";
|
||||
if (UserSpaceFastboot()) {
|
||||
GTEST_LOG_(INFO) << "This test is skipped for userspace fastboot.";
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
std::string action = !curr ? "unlock" : "lock";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue