diff options
author | Connor O'Brien | 2018-02-24 12:47:40 -0600 |
---|---|---|
committer | android-build-merger | 2018-02-24 12:47:40 -0600 |
commit | 39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a (patch) | |
tree | 0d1cffd85a267e49304f560162fe77a9cec0cf11 | |
parent | dd7fa72823d30d7ecaf5091de4c49ce995a59d6e (diff) | |
parent | 0a7184563ee7f5e4e502a57b39dc2d274722b06b (diff) | |
download | platform-hardware-interfaces-39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a.tar.gz platform-hardware-interfaces-39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a.tar.xz platform-hardware-interfaces-39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a.zip |
Merge "Fix boot VTS GetSuffix test" am: 5cd16a71f5 am: 9485e78b93
am: 0a7184563e
Change-Id: I86d3ed15cad7336d4250e52061574e12b8bf360e
-rw-r--r-- | boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp index d1d7f73b..2f2052c8 100644 --- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp +++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <VtsHalHidlTargetTestBase.h> | 24 | #include <VtsHalHidlTargetTestBase.h> |
25 | #include <VtsHalHidlTargetTestEnvBase.h> | 25 | #include <VtsHalHidlTargetTestEnvBase.h> |
26 | 26 | ||
27 | #include <unordered_set> | ||
28 | |||
27 | using ::android::hardware::boot::V1_0::IBootControl; | 29 | using ::android::hardware::boot::V1_0::IBootControl; |
28 | using ::android::hardware::boot::V1_0::CommandResult; | 30 | using ::android::hardware::boot::V1_0::CommandResult; |
29 | using ::android::hardware::boot::V1_0::BoolResult; | 31 | using ::android::hardware::boot::V1_0::BoolResult; |
@@ -32,6 +34,7 @@ using ::android::hardware::hidl_string; | |||
32 | using ::android::hardware::Return; | 34 | using ::android::hardware::Return; |
33 | using ::android::sp; | 35 | using ::android::sp; |
34 | using std::string; | 36 | using std::string; |
37 | using std::unordered_set; | ||
35 | using std::vector; | 38 | using std::vector; |
36 | 39 | ||
37 | // Test environment for Boot HIDL HAL. | 40 | // Test environment for Boot HIDL HAL. |
@@ -168,14 +171,18 @@ TEST_F(BootHidlTest, IsSlotMarkedSuccessful) { | |||
168 | // Sanity check Boot::getSuffix() on good and bad inputs. | 171 | // Sanity check Boot::getSuffix() on good and bad inputs. |
169 | TEST_F(BootHidlTest, GetSuffix) { | 172 | TEST_F(BootHidlTest, GetSuffix) { |
170 | string suffixStr; | 173 | string suffixStr; |
171 | vector<string> correctSuffixes = {"_a", "_b"}; | 174 | unordered_set<string> suffixes; |
172 | auto cb = [&](hidl_string suffix) { suffixStr = suffix.c_str(); }; | 175 | auto cb = [&](hidl_string suffix) { suffixStr = suffix.c_str(); }; |
173 | for (Slot i = 0; i < 2; i++) { | 176 | for (Slot i = 0; i < boot->getNumberSlots(); i++) { |
174 | CommandResult cr; | 177 | CommandResult cr; |
175 | Return<void> result = boot->getSuffix(i, cb); | 178 | Return<void> result = boot->getSuffix(i, cb); |
176 | EXPECT_TRUE(result.isOk()); | 179 | EXPECT_TRUE(result.isOk()); |
177 | ASSERT_EQ(0, suffixStr.compare(correctSuffixes[i])); | 180 | ASSERT_EQ('_', suffixStr[0]); |
181 | ASSERT_LE((unsigned)2, suffixStr.size()); | ||
182 | suffixes.insert(suffixStr); | ||
178 | } | 183 | } |
184 | // All suffixes should be unique | ||
185 | ASSERT_EQ(boot->getNumberSlots(), suffixes.size()); | ||
179 | { | 186 | { |
180 | string emptySuffix = ""; | 187 | string emptySuffix = ""; |
181 | Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb); | 188 | Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb); |