From 3c7448ab6f178cfc171545d15ae039f318e38225 Mon Sep 17 00:00:00 2001 From: Neel Natu Date: Thu, 20 Jun 2019 15:57:11 -0700 Subject: Deflake TestSIGALRMToMainThread. Bump up the threshold on number of SIGALRMs received by worker threads from 50 to 200. Even with the new threshold we still expect that the majority of SIGALRMs are received by the thread group leader. PiperOrigin-RevId: 254289787 --- test/syscalls/linux/itimer.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/syscalls/linux') diff --git a/test/syscalls/linux/itimer.cc b/test/syscalls/linux/itimer.cc index 57ffd1595..51ce323b9 100644 --- a/test/syscalls/linux/itimer.cc +++ b/test/syscalls/linux/itimer.cc @@ -196,13 +196,18 @@ int TestSIGALRMToMainThread() { // ITIMER_REAL-generated SIGALRMs prefer to deliver to the thread group leader // (but don't guarantee it), so we expect to see most samples on the main // thread. + // + // The number of SIGALRMs delivered to a worker should not exceed 20% + // of the number of total signals expected (this is somewhat arbitrary). + const int worker_threshold = result.expected_total / 5; + // // Linux only guarantees timers will never expire before the requested time. // Thus, we only check the upper bound and also it at least have one sample. TEST_CHECK(result.main_thread_samples <= result.expected_total); TEST_CHECK(result.main_thread_samples > 0); for (int num : result.worker_samples) { - TEST_CHECK_MSG(num <= 50, "worker received too many samples"); + TEST_CHECK_MSG(num <= worker_threshold, "worker received too many samples"); } return 0; -- cgit v1.2.3