Skip to content

Tests: Convert Run Command Tests to Swift Testing #8771

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

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Jun 5, 2025

Convert the Run Command Tests to Swift Testing.

Make use of parameterized tests to reduce duplication and use withKnownIssue to get signal when tests have been fixed.

Depends on: #8714

@bkhouri bkhouri force-pushed the t/convertBuildComment/convert_swift-run_test-commands-to-swift-testing branch from ca043ed to 928132e Compare June 10, 2025 20:01
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 10, 2025

@swift-ci test

@bkhouri bkhouri force-pushed the t/convertBuildComment/convert_swift-run_test-commands-to-swift-testing branch 3 times, most recently from cdf999c to e928ec6 Compare June 11, 2025 16:20
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 11, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 11, 2025

@swift-ci test windows

@bkhouri bkhouri force-pushed the t/convertBuildComment/convert_swift-run_test-commands-to-swift-testing branch from e928ec6 to 7572ef6 Compare June 13, 2025 17:52
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 13, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 13, 2025

@swift-ci test windows

@bkhouri bkhouri force-pushed the t/convertBuildComment/convert_swift-run_test-commands-to-swift-testing branch from 7572ef6 to 90ef1a8 Compare June 16, 2025 19:21
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 16, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 16, 2025

@swift-ci test windows

Convert the Run Command Tests to Swift Testing.

Make use of parameterized tests to reduce duplication and use
withKnownIssue to get signal when tests have been fixed.
@bkhouri bkhouri force-pushed the t/convertBuildComment/convert_swift-run_test-commands-to-swift-testing branch from 90ef1a8 to e4d7187 Compare June 16, 2025 20:19
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 16, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 16, 2025

@swift-ci test windows

1 similar comment
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 17, 2025

@swift-ci test windows

@bkhouri bkhouri marked this pull request as ready for review June 17, 2025 17:01
@bkhouri
Copy link
Contributor Author

bkhouri commented Jun 17, 2025

@swift-ci test windows

@bkhouri bkhouri enabled auto-merge (rebase) June 19, 2025 00:38
@@ -123,7 +123,7 @@ public let swiftTest: AbsolutePath = swiftpmBinaryDirectory.appending(component:

public let swiftRun: AbsolutePath = swiftpmBinaryDirectory.appending(component: "swift-run")

public let isSelfHosted: Bool = {
public let runningInSelfHostedPipeline: Bool = {
Copy link
Member

Choose a reason for hiding this comment

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

thought: By detecting the specific CI job that these tests are running, it could be undermining real understanding of the reasons why tests are failing, and having specific detection mechanisms for those cases. Otherwise, this seems to be no better than just marking isIntermittent on each withKnownIssue block. Also, it opens things up to intermittent failures if the job environment changes, such as an OS upgrade, or any other effect that makes these tests fail.

@@ -63,6 +63,14 @@ public let isRealSigningIdentitTestDefined = {
#endif
}()

public let duplicateSymbolRegex: Regex<AnyRegexOutput>? = {
Copy link
Member

Choose a reason for hiding this comment

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

suggestion (non-blocking): Make this regex non-optional, and in the computed property allow it to throw. Then if this regex ever fails to compile for any reason, the test will throw an error with the details of why the regex failed to compile.

@Suite(
.serialized, // to limit the number of swift executable running.
.tags(
Tag.TestSize.large,
Copy link
Member

Choose a reason for hiding this comment

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

praise: This is useful metadata to help understand the nature of the test suite.

.bug("https://github.com/swiftlang/swift-package-manager/issues/8602"),
arguments: SupportedBuildSystemOnPlatform,
)
func productArgumentPassing(
Copy link
Member

Choose a reason for hiding this comment

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

question: Why drop the word "unknown" from the name of the test function? Shouldn't this be testUnknownProductAndArgumentPassing?

XCTAssertMatch(error.stderr, .contains("error: no executable product named 'unknown'"))
// swift-build-tool output should go to stderr.
withKnownIssue {
#expect(stderr.contains("Compiling"))
Copy link
Member

Choose a reason for hiding this comment

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

question: There is no GitHub issue raised related to the stderr containing this specific output. Can you add one and add a .bug() reference to it?

}
} when: {
ProcessInfo.hostOperatingSystem == .windows
Copy link
Member

Choose a reason for hiding this comment

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

question: where is the .bug() reference to the GitHub issue for this known issue with Windows?

func swiftRunSIGINT(
buildSystem: BuildSystemProvider.Kind,
) throws {
try withKnownIssue("Seems to be flaky in CI", isIntermittent: true) {
Copy link
Member

Choose a reason for hiding this comment

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

praise: This looks like a good way to mark a known intermittent issue. Is there a GitHub issue for this flaky test?

Copy link
Member

@cmcgee1024 cmcgee1024 left a comment

Choose a reason for hiding this comment

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

Overall, this looks good to me. I've posted some thoughts, suggestions, and questions.

@bkhouri bkhouri merged commit c671f3f into swiftlang:main Jun 19, 2025
6 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.

2 participants