MCPcopy Create free account
hub / github.com/apache/brpc / repeated_sleep_trace

Function repeated_sleep_trace

test/bthread_unittest.cpp:670–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668}
669
670void repeated_sleep_trace() {
671 bool ok = false;
672 for (int i = 0; i < 10; ++i) {
673 start = false;
674 stop = false;
675 bthread_t th;
676 ASSERT_EQ(0, bthread_start_urgent(&th, NULL, repeated_sleep, (void*)1));
677 while (!start) {
678 usleep(10 * 1000);
679 }
680
681 std::string st1 = bthread::stack_trace(th);
682 LOG(INFO) << "repeated_sleep stack trace:\n" << st1;
683 ok = st1.find("repeated_sleep") != std::string::npos;
684
685 stop = true;
686 ASSERT_EQ(0, bthread_join(th, NULL));
687
688 std::string st2 = bthread::stack_trace(th);
689 LOG(INFO) << "ended bthread stack trace:\n" << st2;
690 ASSERT_NE(std::string::npos, st2.find("not exist now"));
691
692 if (ok) {
693 break;
694 }
695 }
696 ASSERT_TRUE(ok);
697}
698
699TEST_F(BthreadTest, trace) {
700 spin_and_log_trace();

Callers 1

TEST_FFunction · 0.85

Calls 4

bthread_start_urgentFunction · 0.85
stack_traceFunction · 0.85
bthread_joinFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected