-
Notifications
You must be signed in to change notification settings - Fork 304
Prepend module name to TestItem IDs #1530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepend module name to TestItem IDs #1530
Conversation
It is possible to have two identically named suites in two different test targets. These were being erroniously rolled up in to the same parent TestItem. Disambiguate these TestItems by prepending the module name. This has the added benefit of making the TestItem IDs a fully qualified name that can be passed to `swift test`. The module name is pulled from the compiler arguments for the target. If no module name can be found we fall back to the `targetID` for the `ConfiguredTarget`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Paul.
Parse the obj-c module name for targets by looking at the `-fmodule-name` flag.
extension Array { | ||
/// Returns the element at the specified index if it is within the Array's | ||
/// bounds, otherwise `nil`. | ||
public subscript(safe index: Index) -> Element? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extension has been useful on previous projects; let me know if its overkill for this one usage and I'll switch to checking the index bounds in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. Could you also add this file to CMakeLists.txt?
extension Array { | ||
/// Returns the element at the specified index if it is within the Array's | ||
/// bounds, otherwise `nil`. | ||
public subscript(safe index: Index) -> Element? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. Could you also add this file to CMakeLists.txt?
@swift-ci Please test |
@plemarquand Could you also create a cherry-pick PR for this change to |
Head branch was pushed to by a user without write access
@swift-ci Please test |
@swift-ci Please test Windows |
It is possible to have two identically named suites in two different test targets. These were being erroniously rolled up in to the same parent TestItem.
Disambiguate these TestItems by prepending the module name. This has the added benefit of making the TestItem IDs a fully qualified name that can be passed to
swift test
.The module name is pulled from the compiler arguments for the target. If no module name can be found we fall back to the
targetID
for theConfiguredTarget
.