@@ -622,7 +622,7 @@ TEST(StackWalkThreadTest, WalkOfOwnThreadStateWalksSelfRatherThanFailing) {
622622
623623TEST (StackWalkThreadTest, WalksAnotherThreadThroughItsThreadState) {
624624 StackWalk sw;
625- SpinningThread other;
625+ SpinningThread other{ 1 } ;
626626 PyThreadState tstate = fakeThreadState (other.id ());
627627
628628 std::vector<FramePair> frames;
@@ -633,7 +633,6 @@ TEST(StackWalkThreadTest, WalksAnotherThreadThroughItsThreadState) {
633633 });
634634
635635 EXPECT_EQ (walked, WalkResult::Completed);
636- // A parked thread sits several frames deep inside libstdc++ and libc.
637636 EXPECT_GT (frames.size (), 1u );
638637}
639638
@@ -642,7 +641,7 @@ TEST(StackWalkThreadTest, WalksAnotherThreadThroughItsThreadState) {
642641// directly. Only whatever the chain ends on is off-stack.
643642TEST (StackWalkThreadTest, ACrossThreadWalkCostsAFewSafeReadsNotOnePerFrame) {
644643 StackWalk sw;
645- SpinningThread other;
644+ SpinningThread other{ 8 } ;
646645 PyThreadState tstate = fakeThreadState (other.id ());
647646
648647 const uint64_t before = StackWalk::safeReadCount ();
@@ -657,11 +656,11 @@ TEST(StackWalkThreadTest, ACrossThreadWalkCostsAFewSafeReadsNotOnePerFrame) {
657656 WalkResult::Completed);
658657 const uint64_t reads = StackWalk::safeReadCount () - before;
659658
660- // A parked thread sits several frames deep inside libstdc++ and libc.
661- ASSERT_GT (frames, 3u );
662659 EXPECT_LE (reads, 2u ) << " walked " << frames << " frames but spent " << reads
663660 << " safe reads; the target's stack bounds are not "
664661 " reaching the walk" ;
662+ EXPECT_GT (frames, 8u ) << " the walk did not reach every recursive fixture "
663+ " frame" ;
665664}
666665
667666// Walking our own stack takes the same fast path, via currentStackBounds().
@@ -676,9 +675,10 @@ TEST(StackWalkThreadTest, WalkingOurOwnStackCostsAFewSafeReadsNotOnePerFrame) {
676675 WalkResult::Completed);
677676 const uint64_t reads = StackWalk::safeReadCount () - before;
678677
679- ASSERT_GT (frames, 3u );
680678 EXPECT_LE (reads, 2u ) << " walked " << frames << " frames but spent " << reads
681679 << " safe reads" ;
680+ EXPECT_GT (frames, reads)
681+ << " the walk did not find more frames than it read through the fallback" ;
682682}
683683
684684TEST (StackWalkThreadTest, CallbackReturningFalseStopsACrossThreadWalk) {
0 commit comments