diff options
| author | Connor O'Brien <connoro@google.com> | 2017-01-12 11:30:43 -0800 |
|---|---|---|
| committer | Connor O'Brien <connoro@google.com> | 2017-01-12 15:40:53 -0800 |
| commit | 86a7ec303cac830649440a0c2aef8ea872e1e0bf (patch) | |
| tree | b7aec0d77a2b936e67e2c34abb04cf94109a0eeb | |
| parent | 420c43940bc4027846adec4a8916a8565ad5a7ab (diff) | |
| download | android_hardware_interfaces-86a7ec303cac830649440a0c2aef8ea872e1e0bf.tar.gz android_hardware_interfaces-86a7ec303cac830649440a0c2aef8ea872e1e0bf.tar.bz2 android_hardware_interfaces-86a7ec303cac830649440a0c2aef8ea872e1e0bf.zip | |
Fix bugs in boot HAL VTS test
Remove copied code and ensure that changes to boot slots are rolled
back to prevent problems on reboot.
Bug: 34220303
Test: Tests pass; device reboots successfully afterward.
Change-Id: I40f8ec283beae3feb09ab6f416fd4e178b173b87
Signed-off-by: Connor O'Brien <connoro@google.com>
| -rw-r--r-- | boot/1.0/vts/functional/boot_hidl_hal_test.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/boot/1.0/vts/functional/boot_hidl_hal_test.cpp b/boot/1.0/vts/functional/boot_hidl_hal_test.cpp index cdca7e2b7..3413a93c9 100644 --- a/boot/1.0/vts/functional/boot_hidl_hal_test.cpp +++ b/boot/1.0/vts/functional/boot_hidl_hal_test.cpp @@ -35,18 +35,8 @@ using ::android::sp; class BootHidlTest : public ::testing::Test { public: virtual void SetUp() override { - // TODO(b/33385836) Delete copied code - bool getStub = false; - char getsubProperty[PROPERTY_VALUE_MAX]; - if (property_get("vts.hidl.get_stub", getsubProperty, "") > 0) { - if (!strcmp(getsubProperty, "true") || !strcmp(getsubProperty, "True") || - !strcmp(getsubProperty, "1")) { - getStub = true; - } - } - boot = IBootControl::getService("bootctrl", getStub); + boot = IBootControl::getService("bootctrl"); ASSERT_NE(boot, nullptr); - ASSERT_EQ(!getStub, boot->isRemote()); } virtual void TearDown() override {} @@ -91,6 +81,13 @@ TEST_F(BootHidlTest, SetActiveBootSlot) { EXPECT_TRUE(result.isOk()); } { + // Restore original flags to avoid problems on reboot + CommandResult cr; + Return <void> result = boot->markBootSuccessful(generate_callback(&cr)); + EXPECT_TRUE(result.isOk()); + EXPECT_TRUE(cr.success); + } + { CommandResult cr; uint32_t slots = boot->getNumberSlots(); Return<void> result = @@ -111,7 +108,16 @@ TEST_F(BootHidlTest, SetSlotAsUnbootable) { EXPECT_TRUE(result.isOk()); if (cr.success) { EXPECT_EQ(BoolResult::FALSE, boot->isSlotBootable(otherSlot)); - boot->setActiveBootSlot(otherSlot, generate_callback(&cr)); + + // Restore original flags to avoid problems on reboot + 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); + result = boot->markBootSuccessful(generate_callback(&cr)); + EXPECT_TRUE(result.isOk()); EXPECT_TRUE(cr.success); } } |
