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

Commit 4aa42b46 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Allow Conformance tests to verify userspace fastboot."

parents b127c35a bdc14294
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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,
+10 −0
Original line number Diff line number Diff line
@@ -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";