Fix POLLHUP test in libpdx UDS transport tests.
UDS channel events require a translation call to determine the real
event mask that was signaled by the service. Add the correct
translation call to fix the test.
Bug: None
Test: build; push libpdx_uds_tests; run libpdx_uds_tests
Change-Id: I18f0a5dcaf7c507d72ed5226df1fe0e2c2e3dd98
diff --git a/libs/vr/libpdx_uds/service_framework_tests.cpp b/libs/vr/libpdx_uds/service_framework_tests.cpp
index 8891600..9e31e82 100644
--- a/libs/vr/libpdx_uds/service_framework_tests.cpp
+++ b/libs/vr/libpdx_uds/service_framework_tests.cpp
@@ -26,6 +26,7 @@
using android::pdx::Channel;
using android::pdx::ChannelReference;
using android::pdx::ClientBase;
+using android::pdx::ErrorStatus;
using android::pdx::LocalChannelHandle;
using android::pdx::LocalHandle;
using android::pdx::Message;
@@ -379,6 +380,14 @@
data_array.size() * sizeof(int), nullptr, 0));
}
+ Status<int> GetEventMask(int events) {
+ if (auto* client_channel = GetChannel()) {
+ return client_channel->GetEventMask(events);
+ } else {
+ return ErrorStatus(EINVAL);
+ }
+ }
+
using ClientBase<TestClient>::event_fd;
enum : size_t { kMaxPayload = MAX_IMPULSE_LENGTH };
@@ -634,7 +643,9 @@
count = epoll_wait(client->event_fd(), &event, 1, -1);
ASSERT_EQ(1, count);
- ASSERT_TRUE((EPOLLHUP & event.events) != 0);
+ auto event_status = client->GetEventMask(event.events);
+ ASSERT_TRUE(event_status.ok());
+ ASSERT_TRUE((EPOLLHUP & event_status.get()) != 0);
}
TEST_F(ServiceFrameworkTest, LargeDataSum) {