Starts a thread performing dangerous operations and then gathers its stack trace in a loop trying to trigger races.
| 369 | // Starts a thread performing dangerous operations and then gathers |
| 370 | // its stack trace in a loop trying to trigger races. |
| 371 | TEST_P(RaceTest, TestStackTraceRaces) { |
| 372 | DangerousOp op = GetParam(); |
| 373 | CountDownLatch l(1); |
| 374 | scoped_refptr<Thread> t; |
| 375 | ASSERT_OK(Thread::Create("test", "test thread", |
| 376 | [op, &l]() { DangerousOperationThread(op, &l); }, &t)); |
| 377 | SCOPED_CLEANUP({ |
| 378 | // Allow the thread to finish. |
| 379 | l.CountDown(); |
| 380 | // Crash if we can't join the thread after a reasonable amount of time. |
| 381 | // That probably indicates a deadlock. |
| 382 | CHECK_OK(ThreadJoiner(t.get()).give_up_after_ms(10000).Join()); |
| 383 | }); |
| 384 | MonoTime end_time = MonoTime::Now() + MonoDelta::FromSeconds(1); |
| 385 | while (MonoTime::Now() < end_time) { |
| 386 | StackTrace trace; |
| 387 | GetThreadStack(t->tid(), &trace); |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | void BlockSignalsThread() { |
| 392 | sigset_t set; |
nothing calls this directly
no test coverage detected