diff options
Diffstat (limited to 'test/lazy_test/hidl_lazy_test.cpp')
-rw-r--r-- | test/lazy_test/hidl_lazy_test.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; |