From dd231e2796971ec8b7813a596ca3e1e961eabb8e Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 8 Sep 2022 19:47:49 +0000 Subject: binderRpcTest: sleeps /= 10 This test takes too long now that we do many combinations. Reduce sleeps, expose races. Bug: 244325464 Test: binderRpcTest Change-Id: I492f264b3d321a7df4b8876ea9afad9bedb02037 --- libs/binder/tests/binderRpcTest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp index 21b0354b60..2a9d18c479 100644 --- a/libs/binder/tests/binderRpcTest.cpp +++ b/libs/binder/tests/binderRpcTest.cpp @@ -777,12 +777,12 @@ TEST_P(BinderRpc, ThreadPoolGreaterThanEqualRequested) { ts.push_back(std::thread([&] { proc.rootIface->lockUnlock(); })); } - usleep(100000); // give chance for calls on other threads + usleep(10000); // give chance for calls on other threads // other calls still work EXPECT_EQ(OK, proc.rootBinder->pingBinder()); - constexpr size_t blockTimeMs = 500; + constexpr size_t blockTimeMs = 50; size_t epochMsBefore = epochMillis(); // after this, we should never see a response within this time EXPECT_OK(proc.rootIface->unlockInMsAsync(blockTimeMs)); @@ -1074,7 +1074,7 @@ TEST_P(BinderRpc, SingleDeathRecipient) { } std::unique_lock lock(dr->mMtx); - ASSERT_TRUE(dr->mCv.wait_for(lock, 1000ms, [&]() { return dr->dead; })); + ASSERT_TRUE(dr->mCv.wait_for(lock, 100ms, [&]() { 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)); @@ -1109,7 +1109,7 @@ TEST_P(BinderRpc, SingleDeathRecipientOnShutdown) { std::unique_lock lock(dr->mMtx); if (!dr->dead) { - EXPECT_EQ(std::cv_status::no_timeout, dr->mCv.wait_for(lock, 1000ms)); + EXPECT_EQ(std::cv_status::no_timeout, dr->mCv.wait_for(lock, 100ms)); } EXPECT_TRUE(dr->dead) << "Failed to receive the death notification."; @@ -1692,7 +1692,7 @@ TEST_P(BinderRpcServerOnly, Shutdown) { bool shutdown = false; for (int i = 0; i < 10 && !shutdown; i++) { - usleep(300 * 1000); // 300ms; total 3s + usleep(30 * 1000); // 30ms; total 300ms if (server->shutdown()) shutdown = true; } ASSERT_TRUE(shutdown) << "server->shutdown() never returns true"; -- cgit v1.2.3-59-g8ed1b