diff options
author | Devin Moore <devinmoore@google.com> | 2023-11-13 22:37:19 +0000 |
---|---|---|
committer | Devin Moore <devinmoore@google.com> | 2023-11-13 22:40:05 +0000 |
commit | 3eff313d1adc5d890502290e76b99075398c53d1 (patch) | |
tree | c707b4ead4045f9719b5cf391342cc9222145208 | |
parent | bafe15a3d256a7db3c4988bb3c94f8451bc68fbc (diff) | |
download | libhidl-3eff313d1adc5d890502290e76b99075398c53d1.tar.gz |
Reapply "Skip the test that loads the android.hidl.memory library"
This reverts commit aabe8d365eed5766ce0ff8c768df485f036953cc.
Test: atest libhidl_test
Bug: 205764958
Bug: 310700278
Bug: 310680652
Change-Id: Icbf6c0b0407101c802a2c82c5ddf0b75612d0776
-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> |