diff options
author | Devin Moore <devinmoore@google.com> | 2023-11-13 19:03:01 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-11-13 19:03:01 +0000 |
commit | e8c8aecde016a068d478e6096b4cada7310eebab (patch) | |
tree | c707b4ead4045f9719b5cf391342cc9222145208 | |
parent | 6795358d48702ad5d2b809edcd247f681ea84d1b (diff) | |
parent | 30284b316d6404018069259cf21523d7d23571eb (diff) | |
download | libhidl-e8c8aecde016a068d478e6096b4cada7310eebab.tar.gz |
Merge changes from topic "remove_hidl_memory" into main am: 30284b316d
Original change: https://android-review.googlesource.com/c/platform/system/libhidl/+/2820300
Change-Id: Ia5bcefa931d9f91fffd2786e6483dd8037f1fce9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | test_main.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test_main.cpp b/test_main.cpp index 8681375..f4f7fe1 100644 --- a/test_main.cpp +++ b/test_main.cpp @@ -23,6 +23,10 @@ #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> @@ -33,12 +37,6 @@ #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__)) @@ -633,18 +631,26 @@ 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 - if (!kAndroid) GTEST_SKIP(); - +#ifndef __ANDROID__ + GTEST_SKIP(); +#else using ::android::hardware::preloadPassthroughService; using ::android::hidl::memory::V1_0::IMemory; - // installed on all devices by default in both bitnesses and not otherwise a dependency of this + // 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 // 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> |