Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 186d7721 authored by Corey Tabaka's avatar Corey Tabaka
Browse files

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
parent 7c1a9a58
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ using android::pdx::BorrowedChannelHandle;
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 @@ class TestClient : public ClientBase<TestClient> {
                        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 @@ TEST_F(ServiceFrameworkTest, PollHup) {

  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) {