mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Re-enable boot HAL tests and make sure they restore previous slot flags. am: d028b91f4a
Change-Id: I1e5c42c592419c097e678bd966b3ee3b26efd3c9
This commit is contained in:
@@ -80,9 +80,11 @@ TEST_P(BootHidlTest, MarkBootSuccessful) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/156557331): The test should switch back to the original boot slot.
|
||||
// Sanity check Boot::setActiveBootSlot() on good and bad inputs.
|
||||
TEST_P(BootHidlTest, DISABLED_SetActiveBootSlot) {
|
||||
TEST_P(BootHidlTest, SetActiveBootSlot) {
|
||||
Slot curSlot = boot->getCurrentSlot();
|
||||
Slot otherSlot = curSlot ? 0 : 1;
|
||||
auto otherBootable = boot->isSlotBootable(otherSlot);
|
||||
|
||||
for (Slot s = 0; s < 2; s++) {
|
||||
CommandResult cr;
|
||||
Return<void> result = boot->setActiveBootSlot(s, generate_callback(&cr));
|
||||
@@ -91,7 +93,17 @@ TEST_P(BootHidlTest, DISABLED_SetActiveBootSlot) {
|
||||
{
|
||||
// Restore original flags to avoid problems on reboot
|
||||
CommandResult cr;
|
||||
Return<void> result = boot->markBootSuccessful(generate_callback(&cr));
|
||||
auto result = boot->setActiveBootSlot(curSlot, generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(cr.success);
|
||||
|
||||
if (otherBootable == BoolResult::FALSE) {
|
||||
result = boot->setSlotAsUnbootable(otherSlot, generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(cr.success);
|
||||
}
|
||||
|
||||
result = boot->markBootSuccessful(generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(cr.success);
|
||||
}
|
||||
@@ -104,22 +116,23 @@ TEST_P(BootHidlTest, DISABLED_SetActiveBootSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(b/156557331): It should switch back the original boot slot after testing.
|
||||
// Sanity check Boot::setSlotAsUnbootable() on good and bad inputs.
|
||||
TEST_P(BootHidlTest, DISABLED_SetSlotAsUnbootable) {
|
||||
TEST_P(BootHidlTest, SetSlotAsUnbootable) {
|
||||
Slot curSlot = boot->getCurrentSlot();
|
||||
Slot otherSlot = curSlot ? 0 : 1;
|
||||
auto otherBootable = boot->isSlotBootable(otherSlot);
|
||||
{
|
||||
CommandResult cr;
|
||||
Slot curSlot = boot->getCurrentSlot();
|
||||
Slot otherSlot = curSlot ? 0 : 1;
|
||||
Return<void> result = boot->setSlotAsUnbootable(otherSlot, generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
if (cr.success) {
|
||||
EXPECT_EQ(BoolResult::FALSE, boot->isSlotBootable(otherSlot));
|
||||
|
||||
// Restore original flags to avoid problems on reboot
|
||||
result = boot->setActiveBootSlot(otherSlot, generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(cr.success);
|
||||
if (otherBootable == BoolResult::TRUE) {
|
||||
result = boot->setActiveBootSlot(otherSlot, generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(cr.success);
|
||||
}
|
||||
result = boot->setActiveBootSlot(curSlot, generate_callback(&cr));
|
||||
EXPECT_TRUE(result.isOk());
|
||||
EXPECT_TRUE(cr.success);
|
||||
|
||||
Reference in New Issue
Block a user