Skip to content

[6.0] Prefix module name to test #1546

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

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand requested a review from ahoppen as a code owner July 2, 2024 18:09
@plemarquand plemarquand marked this pull request as draft July 2, 2024 18:10
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 force-pushed the prefix-module-name-to-test-id branch from c49d6a9 to 1abfb65 Compare July 2, 2024 18:20
@plemarquand plemarquand marked this pull request as ready for review July 2, 2024 18:21
@ahoppen ahoppen requested a review from bnbarham July 2, 2024 20:20
@@ -154,6 +155,37 @@ extension BuildSystemManager {
.first
}

/// Returns the target's module name as parsed from the `ConfiguredTarget`'s compiler arguments.
public func moduleName(for document: DocumentURI, in target: ConfiguredTarget) async -> String? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like something that should be provided by the build system, rather than found from the settings after the fact. We could have a default that does this though.

It's also the last argument that wins, so both the .first* below should be .last* instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its my understanding that the build settings already give us a standardized way of getting the compilerArguments across all the difference build systems, so pushing the implementation down into each individual BuildSystem would be largely duplicating the implementation of BuildSystem.buildSettings(for:in:language:). Let me know if this isn't what you meant.

Great catch on argument precedence, I'll put up a patch that fixes it on main and then roll it in to this cherry-pick.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #1549 to fix argument precedence

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its my understanding that the build settings already give us a standardized way of getting the compilerArguments across all the difference build systems

This is true, but doesn't necessarily mean we should go searching through build settings for the information we want (I would consider that a fallback) - the build system may already have the information needed. And like I said, we could always have a default implementation for that method that does as you are now.

@bnbarham
Copy link
Contributor

bnbarham commented Jul 3, 2024

Feel free to just cherry-pick the update in this one too

@ahoppen
Copy link
Member

ahoppen commented Jul 3, 2024

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge July 3, 2024 21:05
@ahoppen ahoppen merged commit f31f7b6 into swiftlang:release/6.0 Jul 3, 2024
3 checks passed
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.

3 participants