Loading fastboot/fuzzy_fastboot/fixtures.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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 Loading fastboot/fuzzy_fastboot/fixtures.h +1 −0 Original line number Diff line number Diff line Loading @@ -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, Loading fastboot/fuzzy_fastboot/main.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 Loading
fastboot/fuzzy_fastboot/fixtures.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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 Loading
fastboot/fuzzy_fastboot/fixtures.h +1 −0 Original line number Diff line number Diff line Loading @@ -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, Loading
fastboot/fuzzy_fastboot/main.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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