Skip to content

Test fixes and intermittent Linux failures #24

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented Apr 24, 2025

Subprocess is not currently compiling on Linux with the 6.1 toolchain. Fix
the compile error by restoring the original pipe method call when not on
the Windows platform.

There is a test failing when using swiftly because the swift binary isn't in
"/usr/bin/swift". Change the test to use the simple name "swift" for the
executable, finding the swift that's on the PATH.

Tests are intermittently failing on PATH lookups for fully qualified path
executables specified in the test, such as /usr/bin/id. These should be
full .path() executables instead.

Add EACCES as another type of error that can come back through execve()
because of permissions or irregular file types. When this error is encountered
continue to the next possible path.

@cmcgee1024 cmcgee1024 requested a review from iCharlesHu as a code owner April 24, 2025 17:51
@@ -871,7 +871,11 @@ internal struct CreatedPipe {
}

internal init(closeWhenDone: Bool) throws {
#if os(Windows)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already fixed by #23

.swift-version Outdated
@@ -0,0 +1 @@
main-snapshot-2025-04-12
Copy link
Contributor

Choose a reason for hiding this comment

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

I really don't understand the purpose of .swift-version... it doesn't really make sense for things that aren't a product (like libraries) and are expected to work across many different Swift versions.

And if we're fixing the compile error right now, what's the value in pinning to a snapshot anyways?

Copy link
Member Author

@cmcgee1024 cmcgee1024 Apr 24, 2025

Choose a reason for hiding this comment

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

I'm just trying to build and generate the documentation for this project and I couldn't get it to work on Linux reliably with the usual 6.1 toolchain. It might have been a weird bug I was encountering though so I can change this back to 6.1.0 for other developers working with this project.

The swift version file helps with development environments, and CI if it's configured to get everyone on a known good toolchain for developing the project.

Copy link
Contributor

Choose a reason for hiding this comment

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

With #23 this builds successfully for me on Linux with Swift 6.1, although runLinter() hangs and testSubprocessPlatfomOptionsPreSpawnProcessConfigurator() and testSuspendResumeProcess() fail. Is that what you're seeing as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, also testSubprocessPlatformOptionsUserID is failing with an EACCES errno intermittently.

EACCES can be something that comes back from execve() for reasons
related to permissions, or file type. Instead of failing due to the
underlying error, just continue to the next possible path.
@cmcgee1024 cmcgee1024 changed the title Fix Linux compile error and one failing test Test fixes and intermittent Linux failures Apr 24, 2025
@@ -0,0 +1 @@
6.1.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Could elaborate more on what this file does? I don't think 6.1.0 is an appropriate version because we need 6.2 for Span and the majority of the package depends on that trait (i.e. would require 6.2).

Copy link
Member Author

Choose a reason for hiding this comment

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

This file marks what the standard swift toolchain version for this project should be for development, and testing. So, if I were developing with this package, what toolchain should I use to swift build and swift test and expect it to work.

If a developer has swiftly installed then swiftly will use it automatically. If CI supports it then that will be the toolchain that it uses as well. This has no effect on downstream packages.

https://www.swift.org/swiftly/documentation/swiftly/use-toolchains#Sharing-recommended-toolchain-versions

Copy link
Member Author

Choose a reason for hiding this comment

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

If 6.2 of Swift is required to develop/test subprocess, then the swift version file could have a particular main-snapshot-xxxx-yy-zz that's known to be good at a point in time, possibly tested by CI.

@shahmishal shahmishal closed this Apr 26, 2025
@shahmishal shahmishal reopened this Apr 26, 2025
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.

4 participants