summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Moore <devinmoore@google.com>2023-11-13 19:32:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-11-13 19:32:46 +0000
commitaabe8d365eed5766ce0ff8c768df485f036953cc (patch)
treeffeba6f39d54fb4a9bbf462f33b53e6f63823b30
parent867d2ceae739f369d71346e50eb0ca79ee6a551a (diff)
downloadlibhidl-aabe8d365eed5766ce0ff8c768df485f036953cc.tar.gz
Revert "Skip the test that loads the android.hidl.memory library"
Revert submission 2818339-remove_hidl_memory Reason for revert: b/310680652 broke VTS tests Reverted changes: /q/submissionid:2818339-remove_hidl_memory Change-Id: I84f7c659db60946b77dffe523388eeea7929bcba
-rw-r--r--test_main.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/test_main.cpp b/test_main.cpp
index f4f7fe1..8681375 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -23,10 +23,6 @@
#pragma clang diagnostic pop
#include <android-base/logging.h>
-#include <android-base/properties.h>
-#ifdef __ANDROID__
-#include <android/api-level.h>
-#endif
#include <android/hidl/memory/1.0/IMemory.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -37,6 +33,12 @@
#include <fstream>
#include <vector>
+#ifdef __ANDROID__
+static bool kAndroid = true;
+#else
+static bool kAndroid = false;
+#endif
+
#define EXPECT_ARRAYEQ(__a1__, __a2__, __size__) EXPECT_TRUE(isArrayEqual(__a1__, __a2__, __size__))
#define EXPECT_2DARRAYEQ(__a1__, __a2__, __size1__, __size2__) \
EXPECT_TRUE(is2dArrayEqual(__a1__, __a2__, __size1__, __size2__))
@@ -631,26 +633,18 @@ TEST_F(LibHidlTest, StatusStringTest) {
TEST_F(LibHidlTest, PreloadTest) {
// HIDL doesn't have support to load passthrough implementations on host, but we
// could do this by loading implementations from the output directory
-#ifndef __ANDROID__
- GTEST_SKIP();
-#else
+ if (!kAndroid) GTEST_SKIP();
+
using ::android::hardware::preloadPassthroughService;
using ::android::hidl::memory::V1_0::IMemory;
- // android.hidl.memory@1.0-impl.so is installed on all devices by default up
- // to Android U in both bitnesses and not otherwise a dependency of this
- // test.
- // Android V+ devices do not have this installed by default, so skip the
+ // installed on all devices by default in both bitnesses and not otherwise a dependency of this
// test.
- if (android::base::GetIntProperty("ro.vendor.api_level", 0) >= __ANDROID_API_V__) {
- GTEST_SKIP();
- }
static const std::string kLib = "android.hidl.memory@1.0-impl.so";
EXPECT_FALSE(isLibraryOpen(kLib));
preloadPassthroughService<IMemory>();
EXPECT_TRUE(isLibraryOpen(kLib));
-#endif
}
template <typename T, size_t start, size_t end>