Skip to content

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

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

plemarquand
Copy link
Contributor

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.

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`.
@plemarquand plemarquand requested a review from ahoppen as a code owner June 27, 2024 15:52
Copy link
Member

@ahoppen ahoppen left a 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.
@plemarquand plemarquand requested a review from ahoppen June 28, 2024 13:42
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? {
Copy link
Contributor Author

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.

Copy link
Member

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? {
Copy link
Member

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?

@plemarquand plemarquand requested a review from ahoppen June 28, 2024 16:45
@ahoppen
Copy link
Member

ahoppen commented Jun 28, 2024

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge June 28, 2024 16:54
@ahoppen
Copy link
Member

ahoppen commented Jun 28, 2024

@plemarquand Could you also create a cherry-pick PR for this change to release/6.0? https://github.com/swiftlang/sourcekit-lsp/blob/main/CONTRIBUTING.md#opening-a-pr-for-release-branch

auto-merge was automatically disabled June 28, 2024 18:42

Head branch was pushed to by a user without write access

@ahoppen
Copy link
Member

ahoppen commented Jul 1, 2024

@swift-ci Please test

@ahoppen
Copy link
Member

ahoppen commented Jul 1, 2024

@swift-ci Please test Windows

@ahoppen ahoppen enabled auto-merge July 1, 2024 16:51
@ahoppen ahoppen merged commit 1efb267 into swiftlang:main Jul 1, 2024
3 checks passed
@ahoppen ahoppen mentioned this pull request Jul 15, 2024
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.

2 participants