summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConnor O'Brien2017-01-12 13:30:43 -0600
committerConnor O'Brien2017-01-12 17:40:53 -0600
commit86a7ec303cac830649440a0c2aef8ea872e1e0bf (patch)
treeb7aec0d77a2b936e67e2c34abb04cf94109a0eeb /boot/1.0/vts
parent420c43940bc4027846adec4a8916a8565ad5a7ab (diff)
downloadplatform-hardware-interfaces-86a7ec303cac830649440a0c2aef8ea872e1e0bf.tar.gz
platform-hardware-interfaces-86a7ec303cac830649440a0c2aef8ea872e1e0bf.tar.xz
platform-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>
Diffstat (limited to 'boot/1.0/vts')
-rw-r--r--boot/1.0/vts/functional/boot_hidl_hal_test.cpp30
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 cdca7e2b..3413a93c 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;
35class BootHidlTest : public ::testing::Test { 35class BootHidlTest : public ::testing::Test {
36 public: 36 public:
37 virtual void SetUp() override { 37 virtual void SetUp() override {
38 // TODO(b/33385836) Delete copied code 38 boot = IBootControl::getService("bootctrl");
39 bool getStub = false;
40 char getsubProperty[PROPERTY_VALUE_MAX];
41 if (property_get("vts.hidl.get_stub", getsubProperty, "") > 0) {
42 if (!strcmp(getsubProperty, "true") || !strcmp(getsubProperty, "True") ||
43 !strcmp(getsubProperty, "1")) {
44 getStub = true;
45 }
46 }
47 boot = IBootControl::getService("bootctrl", getStub);
48 ASSERT_NE(boot, nullptr); 39 ASSERT_NE(boot, nullptr);
49 ASSERT_EQ(!getStub, boot->isRemote());
50 } 40 }
51 41
52 virtual void TearDown() override {} 42 virtual void TearDown() override {}
@@ -91,6 +81,13 @@ TEST_F(BootHidlTest, SetActiveBootSlot) {
91 EXPECT_TRUE(result.isOk()); 81 EXPECT_TRUE(result.isOk());
92 } 82 }
93 { 83 {
84 // Restore original flags to avoid problems on reboot
85 CommandResult cr;
86 Return <void> result = boot->markBootSuccessful(generate_callback(&cr));
87 EXPECT_TRUE(result.isOk());
88 EXPECT_TRUE(cr.success);
89 }
90 {
94 CommandResult cr; 91 CommandResult cr;
95 uint32_t slots = boot->getNumberSlots(); 92 uint32_t slots = boot->getNumberSlots();
96 Return<void> result = 93 Return<void> result =
@@ -111,7 +108,16 @@ TEST_F(BootHidlTest, SetSlotAsUnbootable) {
111 EXPECT_TRUE(result.isOk()); 108 EXPECT_TRUE(result.isOk());
112 if (cr.success) { 109 if (cr.success) {
113 EXPECT_EQ(BoolResult::FALSE, boot->isSlotBootable(otherSlot)); 110 EXPECT_EQ(BoolResult::FALSE, boot->isSlotBootable(otherSlot));
114 boot->setActiveBootSlot(otherSlot, generate_callback(&cr)); 111
112 // Restore original flags to avoid problems on reboot
113 result = boot->setActiveBootSlot(otherSlot, generate_callback(&cr));
114 EXPECT_TRUE(result.isOk());
115 EXPECT_TRUE(cr.success);
116 result = boot->setActiveBootSlot(curSlot, generate_callback(&cr));
117 EXPECT_TRUE(result.isOk());
118 EXPECT_TRUE(cr.success);
119 result = boot->markBootSuccessful(generate_callback(&cr));
120 EXPECT_TRUE(result.isOk());
115 EXPECT_TRUE(cr.success); 121 EXPECT_TRUE(cr.success);
116 } 122 }
117 } 123 }