Merge "Test is-logical command for vendor and boot partitions." into qt-dev

This commit is contained in:
TreeHugger Robot 2019-04-09 05:11:19 +00:00 committed by Android (Google) Code Review
commit b017a1cd9b

View file

@ -201,18 +201,28 @@ TEST_F(LogicalPartitionCompliance, GetVarIsLogical) {
ASSERT_TRUE(UserSpaceFastboot());
std::string has_slot;
EXPECT_EQ(fb->GetVar("has-slot:system", &has_slot), SUCCESS) << "getvar has-slot:system failed";
std::string is_logical_cmd;
std::string is_logical_cmd_system = "is-logical:system";
std::string is_logical_cmd_vendor = "is-logical:vendor";
std::string is_logical_cmd_boot = "is-logical:boot";
if (has_slot == "yes") {
std::string current_slot;
EXPECT_EQ(fb->GetVar("current-slot", &current_slot), SUCCESS)
ASSERT_EQ(fb->GetVar("current-slot", &current_slot), SUCCESS)
<< "getvar current-slot failed";
is_logical_cmd = "is-logical:system_" + current_slot;
} else {
is_logical_cmd = "is-logical:system";
std::string slot_suffix = "_" + current_slot;
is_logical_cmd_system += slot_suffix;
is_logical_cmd_vendor += slot_suffix;
is_logical_cmd_boot += slot_suffix;
}
std::string is_logical;
EXPECT_EQ(fb->GetVar(is_logical_cmd, &is_logical), SUCCESS) << "getvar is-logical failed";
ASSERT_EQ(is_logical, "yes");
EXPECT_EQ(fb->GetVar(is_logical_cmd_system, &is_logical), SUCCESS)
<< "system must be a logical partition";
EXPECT_EQ(is_logical, "yes");
EXPECT_EQ(fb->GetVar(is_logical_cmd_vendor, &is_logical), SUCCESS)
<< "vendor must be a logical partition";
EXPECT_EQ(is_logical, "yes");
EXPECT_EQ(fb->GetVar(is_logical_cmd_boot, &is_logical), SUCCESS)
<< "boot must not be logical partition";
EXPECT_EQ(is_logical, "no");
}
TEST_F(LogicalPartitionCompliance, FastbootRebootTest) {