summaryrefslogtreecommitdiffstats
path: root/boot/1.0
diff options
context:
space:
mode:
authorConnor O'Brien <connoro@google.com>2018-02-24 18:47:40 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-02-24 18:47:40 +0000
commit39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a (patch)
tree0d1cffd85a267e49304f560162fe77a9cec0cf11 /boot/1.0
parentdd7fa72823d30d7ecaf5091de4c49ce995a59d6e (diff)
parent0a7184563ee7f5e4e502a57b39dc2d274722b06b (diff)
downloadandroid_hardware_interfaces-39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a.tar.gz
android_hardware_interfaces-39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a.tar.bz2
android_hardware_interfaces-39a4374fc5bf89aff2b89dc95b83b7c17e6c8e3a.zip
Merge "Fix boot VTS GetSuffix test" am: 5cd16a71f5 am: 9485e78b93
am: 0a7184563e Change-Id: I86d3ed15cad7336d4250e52061574e12b8bf360e
Diffstat (limited to 'boot/1.0')
-rw-r--r--boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp13
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 d1d7f73b6..2f2052c83 100644
--- a/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
+++ b/boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp
@@ -24,6 +24,8 @@
#include <VtsHalHidlTargetTestBase.h>
#include <VtsHalHidlTargetTestEnvBase.h>
+#include <unordered_set>
+
using ::android::hardware::boot::V1_0::IBootControl;
using ::android::hardware::boot::V1_0::CommandResult;
using ::android::hardware::boot::V1_0::BoolResult;
@@ -32,6 +34,7 @@ using ::android::hardware::hidl_string;
using ::android::hardware::Return;
using ::android::sp;
using std::string;
+using std::unordered_set;
using std::vector;
// Test environment for Boot HIDL HAL.
@@ -168,14 +171,18 @@ TEST_F(BootHidlTest, IsSlotMarkedSuccessful) {
// Sanity check Boot::getSuffix() on good and bad inputs.
TEST_F(BootHidlTest, GetSuffix) {
string suffixStr;
- vector<string> correctSuffixes = {"_a", "_b"};
+ unordered_set<string> suffixes;
auto cb = [&](hidl_string suffix) { suffixStr = suffix.c_str(); };
- for (Slot i = 0; i < 2; i++) {
+ for (Slot i = 0; i < boot->getNumberSlots(); i++) {
CommandResult cr;
Return<void> result = boot->getSuffix(i, cb);
EXPECT_TRUE(result.isOk());
- ASSERT_EQ(0, suffixStr.compare(correctSuffixes[i]));
+ ASSERT_EQ('_', suffixStr[0]);
+ ASSERT_LE((unsigned)2, suffixStr.size());
+ suffixes.insert(suffixStr);
}
+ // All suffixes should be unique
+ ASSERT_EQ(boot->getNumberSlots(), suffixes.size());
{
string emptySuffix = "";
Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb);