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
This commit is contained in:
Neel Natu 2019-06-20 15:57:11 -07:00 committed by gVisor bot
parent 7db8685100
commit 3c7448ab6f
1 changed files with 6 additions and 1 deletions

View File

@ -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;