diff options
| author | 2022-08-19 21:16:17 +0000 | |
|---|---|---|
| committer | 2022-08-22 20:19:56 +0000 | |
| commit | 47a12010b231d76c4bdc024cc5d1acc1841e9b0f (patch) | |
| tree | c1e5083603d6a22376818079ba8747728ac03341 | |
| parent | fc20cdf533b63de60923712b57c535f540c754b4 (diff) | |
binderRpcTest: assert on wait_for timeout
Use a version of wait_for that won't return for spurious wakeups.
Test: atest binderRpcTest
Bug: NA
Change-Id: I42ad6eb66d36759193980e1532ac9e6ec7565435
| -rw-r--r-- | libs/binder/tests/binderRpcTest.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp index 501a604026..87c204f9e3 100644 --- a/libs/binder/tests/binderRpcTest.cpp +++ b/libs/binder/tests/binderRpcTest.cpp @@ -1062,10 +1062,7 @@ TEST_P(BinderRpc, SingleDeathRecipient) { } std::unique_lock<std::mutex> lock(dr->mMtx); - if (!dr->dead) { - EXPECT_EQ(std::cv_status::no_timeout, dr->mCv.wait_for(lock, 1000ms)); - } - EXPECT_TRUE(dr->dead) << "Failed to receive the death notification."; + ASSERT_TRUE(dr->mCv.wait_for(lock, 1000ms, [&]() { return dr->dead; })); // need to wait for the session to shutdown so we don't "Leak session" EXPECT_TRUE(proc.proc.sessions.at(0).session->shutdownAndWait(true)); |