Skip to content

Fix repeated SECTIONs in one test cycle#3178

Open
tianrking wants to merge 1 commit into
catchorg:develfrom
tianrking:agent/reject-repeated-sections
Open

Fix repeated SECTIONs in one test cycle#3178
tianrking wants to merge 1 commit into
catchorg:develfrom
tianrking:agent/reject-repeated-sections

Conversation

@tianrking

Copy link
Copy Markdown

Summary

  • reject a previously-open SECTION when the same source location is encountered again after the current test cycle has completed
  • add tracker-level coverage for the repeated nested-section path

Root cause

A helper called twice in the same test cycle can reacquire a section that is still marked open after one of its children completed the cycle. The second acquisition skips reopening it, but the public section wrapper still treats it as open and later closes it from an invalid tracker position, causing a hang or crash.

Validation

  • cmake --build build --config Debug --target SelfTest --parallel 1
  • build/tests/Debug/SelfTest.exe "Tracker rejects a section encountered twice in one cycle" --reporter compact
  • build/tests/Debug/SelfTest.exe "Tracker" --reporter compact
  • a standalone nested-section reproducer: baseline hangs; with this change it fails immediately with a controlled Catch2 error

Fixes #2802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When the same SECTION is encountered multiple times in one cycle, catch crashes on assert

1 participant