Fix flaky futex test.

The test is long running (175128 ms or so) which causes timeouts.
The test simply makes sure that private futexes can acquire
locks concurrently. Dropping current threads and increasing the
number of locks each thread tests the same concurrency concerns
but drops execution time to ~1411 ms.

PiperOrigin-RevId: 264476144
This commit is contained in:
Zach Koopmans 2019-08-20 15:05:17 -07:00 committed by gVisor bot
parent cf8a689be7
commit 3d0715b3f8
1 changed files with 2 additions and 2 deletions

View File

@ -689,10 +689,10 @@ TEST_P(PrivateAndSharedFutexTest, PITryLockConcurrency_NoRandomSave) {
std::atomic<int> a = ATOMIC_VAR_INIT(0);
const bool is_priv = IsPrivate();
std::unique_ptr<ScopedThread> threads[100];
std::unique_ptr<ScopedThread> threads[10];
for (size_t i = 0; i < ABSL_ARRAYSIZE(threads); ++i) {
threads[i] = absl::make_unique<ScopedThread>([is_priv, &a] {
for (size_t j = 0; j < 10;) {
for (size_t j = 0; j < 100;) {
if (futex_trylock_pi(is_priv, &a) >= 0) {
++j;
EXPECT_EQ(a.load() & FUTEX_TID_MASK, gettid());