diff options
| author | 2023-02-25 04:59:43 +0000 | |
|---|---|---|
| committer | 2023-03-01 01:37:50 +0000 | |
| commit | 5f2bc56da8edbcc328b213f783d5b494ae0fa26e (patch) | |
| tree | c90e1cb84de2a6c4a6b3a970baf8b42677b6ad8d | |
| parent | 6b8b79986e66617f23ed8f2e813cf1f014cab296 (diff) | |
libbinder: Flush pending messages in OnewayCallQueuingWithFds
The OnewayCallQueuingWithFds test uses oneway calls
and needs to handle the incoming decrefs sent by
flushExcessBinderRefs on the other side. This change
flushes those decref messages using saturateThreadPool
which makes one sync call on every server thread,
forcing the session to read and handle all those
pending messages.
Bug: 259517277
Test: presubmit
Change-Id: Ib4a9b637baa763f3f0a9429e5c494ce86352a9c6
| -rw-r--r-- | libs/binder/tests/binderRpcTest.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp index 84c93ddc30..dcea880ef9 100644 --- a/libs/binder/tests/binderRpcTest.cpp +++ b/libs/binder/tests/binderRpcTest.cpp @@ -544,6 +544,8 @@ TEST_P(BinderRpc, OnewayCallQueueingWithFds) { GTEST_SKIP() << "This test requires multiple threads"; } + constexpr size_t kNumServerThreads = 3; + // This test forces a oneway transaction to be queued by issuing two // `blockingSendFdOneway` calls, then drains the queue by issuing two // `blockingRecvFd` calls. @@ -552,7 +554,7 @@ TEST_P(BinderRpc, OnewayCallQueueingWithFds) { // https://developer.android.com/reference/android/os/IBinder#FLAG_ONEWAY auto proc = createRpcTestSocketServerProcess({ - .numThreads = 3, + .numThreads = kNumServerThreads, .clientFileDescriptorTransportMode = RpcSession::FileDescriptorTransportMode::UNIX, .serverSupportedFileDescriptorTransportModes = {RpcSession::FileDescriptorTransportMode::UNIX}, @@ -573,6 +575,8 @@ TEST_P(BinderRpc, OnewayCallQueueingWithFds) { EXPECT_OK(proc.rootIface->blockingRecvFd(&fdB)); CHECK(android::base::ReadFdToString(fdB.get(), &result)); EXPECT_EQ(result, "b"); + + saturateThreadPool(kNumServerThreads, proc.rootIface); } TEST_P(BinderRpc, OnewayCallQueueing) { |