diff options
author | Devin Moore <devinmoore@google.com> | 2023-11-29 01:39:47 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-11-29 01:39:47 +0000 |
commit | c587078db694ba7cc842246c511a1eb4a3a95ce4 (patch) | |
tree | 947ed46121b30518b37d382661b60a53e2ff9cf2 | |
parent | 59f03455c819e9ccf9841aee09d5d634f768c8fb (diff) | |
parent | b60430328f45e0f9e96aa117d641d12e0df91feb (diff) | |
download | hidl-c587078db694ba7cc842246c511a1eb4a3a95ce4.tar.gz |
Skip these lazy tests when HIDL is not supported am: d0b8ff93f5 am: b60430328f
Original change: https://android-review.googlesource.com/c/platform/system/tools/hidl/+/2850816
Change-Id: I2bb209d3cc51a649358d074d6b9566f46ac08744
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | test/lazy_test/Android.bp | 8 | ||||
-rw-r--r-- | test/lazy_test/hidl_lazy_test.cpp | 10 |
2 files changed, 15 insertions, 3 deletions
diff --git a/test/lazy_test/Android.bp b/test/lazy_test/Android.bp index 801c9e61..457b7c8f 100644 --- a/test/lazy_test/Android.bp +++ b/test/lazy_test/Android.bp @@ -13,9 +13,6 @@ cc_test { srcs: ["hidl_lazy_test.cpp"], shared_libs: [ - "android.hardware.tests.lazy@1.0", - "android.hardware.tests.lazy@1.1", - "android.hardware.tests.lazy_cb@1.0", "libbase", "libcutils", "libhidl-gen-utils", @@ -23,6 +20,11 @@ cc_test { "liblog", "libutils", ], + static_libs: [ + "android.hardware.tests.lazy@1.0", + "android.hardware.tests.lazy@1.1", + "android.hardware.tests.lazy_cb@1.0", + ], test_suites: ["general-tests"], require_root: true, diff --git a/test/lazy_test/hidl_lazy_test.cpp b/test/lazy_test/hidl_lazy_test.cpp index 4f27463f..4047bec3 100644 --- a/test/lazy_test/hidl_lazy_test.cpp +++ b/test/lazy_test/hidl_lazy_test.cpp @@ -36,6 +36,7 @@ #include <hidl/HidlSupport.h> #include <hidl/HidlTransportSupport.h> #include <hidl/HidlTransportUtils.h> +#include <hidl/ServiceManagement.h> #include <hwbinder/IPCThreadState.h> using ::android::FqInstance; @@ -88,6 +89,8 @@ class HidlLazyTestBase : public ::testing::Test { class HidlLazyTest : public HidlLazyTestBase { protected: void SetUp() override { + if (!android::hardware::isHidlSupported()) + GTEST_SKIP() << "HIDL is not supported on this device"; HidlLazyTestBase::SetUp(); for (const auto& instance : gInstances) { ASSERT_FALSE(isServiceRunning(instance)) @@ -99,6 +102,8 @@ class HidlLazyTest : public HidlLazyTestBase { } void TearDown() override { + // If we skipped the setup, then we skip the TearDown. + if (!android::hardware::isHidlSupported()) return; std::cout << "Waiting " << SHUTDOWN_WAIT_TIME << " seconds before checking that the " << "service has shut down." << std::endl; IPCThreadState::self()->flushCommands(); @@ -114,6 +119,11 @@ class HidlLazyTest : public HidlLazyTestBase { class HidlLazyCbTest : public HidlLazyTestBase { protected: static constexpr size_t CALLBACK_SHUTDOWN_WAIT_TIME = 5; + void SetUp() override { + if (!android::hardware::isHidlSupported()) + GTEST_SKIP() << "HIDL is not supported on this device"; + HidlLazyTestBase::SetUp(); + } }; static constexpr size_t NUM_IMMEDIATE_GET_UNGETS = 100; |