aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Moore <devinmoore@google.com>2024-01-04 01:13:56 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-01-04 01:13:56 +0000
commit203f9f894c05ed612118d7b5d375bf00bee18202 (patch)
tree98e431f4cad55d85564adddf8a181ee88ce90ee6
parente67bd718f69273f8f0907172e9ecfae73edf9068 (diff)
parent7d38311818a5530a87f21eda89916338d97d79ae (diff)
downloadhidl-203f9f894c05ed612118d7b5d375bf00bee18202.tar.gz
Skip HIDL lazy tests if the services are not declared on the device am: c3462ecb60 am: 7d38311818
Original change: https://android-review.googlesource.com/c/platform/system/tools/hidl/+/2896540 Change-Id: Ifa774746f486e8ef0d16016cfd63ccb094c162bd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--test/lazy_test/hidl_lazy_test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lazy_test/hidl_lazy_test.cpp b/test/lazy_test/hidl_lazy_test.cpp
index 4047bec3..69525417 100644
--- a/test/lazy_test/hidl_lazy_test.cpp
+++ b/test/lazy_test/hidl_lazy_test.cpp
@@ -68,6 +68,13 @@ class HidlLazyTestBase : public ::testing::Test {
void SetUp() override {
manager = IServiceManager::getService();
ASSERT_NE(manager, nullptr);
+ // if the services aren't installed/declared on the device, skip.
+ // if one is installed, the other(s) are also installed so skip on the
+ // first instance that isn't declared.
+ for (const auto& instance : gInstances) {
+ if (!isServiceDeclared(instance))
+ GTEST_SKIP() << "No HIDL lazy test services on device";
+ }
}
bool isServiceRunning(const FqInstance& instance) {
@@ -84,6 +91,13 @@ class HidlLazyTestBase : public ::testing::Test {
.isOk());
return isRunning;
}
+ bool isServiceDeclared(const FqInstance& instance) {
+ const auto transport =
+ manager->getTransport(instance.getFqName().string(), instance.getInstance());
+ EXPECT_TRUE(transport.isOk());
+ if (transport == IServiceManager::Transport::HWBINDER) return true;
+ return false;
+ }
};
class HidlLazyTest : public HidlLazyTestBase {