Skip to content

Conversation

@stmontgomery
Copy link
Contributor

This fixes a crash which can occur if there are many filter or skip arguments passed to the testing library's entry point.

In this situation, before this fix, one Configuration.TestFilter was created for each filter or skip argument and they were chained together to form a tree using combining(with:using:). Then, they were applied to a test graph recursively. If this tree was deep due to having many filter or skip arguments chained together, the recursion could exceed the stack and cause a crash.

The fix is to change Configuration.TestFilter.Kind.pattern so that it can store multiple patterns to match against instead of just one. This makes it more aligned with the other cases in its enum, which also store collections, and prevents the crash since it typically results in much shallower filter trees.

Result:

Crash is resolved, validated by a new unit test.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…Filter instead of chaining multiple pattern-matcher filters
@stmontgomery stmontgomery added the bug 🪲 Something isn't working label Jun 18, 2024
@stmontgomery stmontgomery self-assigned this Jun 18, 2024
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@stmontgomery stmontgomery added the tools integration 🛠️ Integration of swift-testing into tools/IDEs label Jun 18, 2024
@stmontgomery stmontgomery merged commit bfd57a6 into swiftlang:main Jun 18, 2024
@stmontgomery stmontgomery deleted the many-combined-filters branch June 18, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working tools integration 🛠️ Integration of swift-testing into tools/IDEs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants