-
Notifications
You must be signed in to change notification settings - Fork 59
Test old Linux kernels using Qemu #280
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
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a9d1e70
Add scripts for testing older Linux distros and kernels via qemu
cmcgee1024 9378aba
Code cleanup and fix various checks
cmcgee1024 6ac8247
Fix remaining license header check failure
cmcgee1024 05d9966
Fix remaining license header check failure
cmcgee1024 c33326b
Fix tests so that they work in a slow qemu environment
cmcgee1024 33bfdfd
Improved ergonomics of test script for interactive debugging
cmcgee1024 649cbb4
Unlock subprocess fork lock after failures in clone3
cmcgee1024 80d682a
Close the pidfd once epoll no longer references it
cmcgee1024 0943dca
Revert closing pidfds, adjust concurrency limit used for tests
cmcgee1024 683b38d
Better handling for epoll errors
cmcgee1024 b70141e
Bump memory for test VM
cmcgee1024 c540777
Gracefully handle epoll_ctl(DEL) failures, prevent single task failur…
cmcgee1024 6db447a
Add EMFILE and ENFILE to the ENOSYS fallback condition
cmcgee1024 c3c96e6
Revert change to catch EMFILE/ENFILE errors on pdfork
cmcgee1024 e086ce2
Fix two pidfd leak cases, and calculate available concurrency by read…
cmcgee1024 dcf84fa
Fix compile error for RLIMIT_NOFILE usage with FreeBSD
cmcgee1024 c603101
Fix compile error for RLIMIT_NOFILE usage with FreeBSD
cmcgee1024 f099368
Fix compile error for RLIMIT_NOFILE usage with FreeBSD
cmcgee1024 7eeb596
Fix occasional test hangs on FreeBSD
cmcgee1024 404067b
Fix FreeBSD hang while testing
cmcgee1024 d4cde49
Code review feedback
cmcgee1024 899b624
Revert converting defer close to closeAfter
cmcgee1024 8ff3fd4
Add detailed description for the continuation resume
cmcgee1024 cb5e9f4
Merge branch 'main' of https://github.com/swiftlang/swift-subprocess
cmcgee1024 fbfd28f
Revert changes to Thread
cmcgee1024 d542ed5
Revert vestigial BSD changes
cmcgee1024 3a3dcc7
Code review feedback
cmcgee1024 e18bbc1
Try without the no-parallel option for the qemu tests
cmcgee1024 49beeff
Revert process descriptor check
cmcgee1024 b9cb6cf
Code review feedback
cmcgee1024 346c6e7
Fix compile error
cmcgee1024 2a41bd4
Code review feedback
cmcgee1024 8499acd
Fix formatting
cmcgee1024 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 6.2.0 | ||
| 6.3.2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| #!/bin/bash | ||
| ##===----------------------------------------------------------------------===## | ||
| ## | ||
| ## This source file is part of the Swift.org open source project | ||
| ## | ||
| ## Copyright (c) 2026 Apple Inc. and the Swift project authors | ||
| ## Licensed under Apache License v2.0 with Runtime Library Exception | ||
| ## | ||
| ## See https://swift.org/LICENSE.txt for license information | ||
| ## | ||
| ##===----------------------------------------------------------------------===## | ||
|
|
||
| # This script does a bit of extra preparation of the docker containers used to run the GitHub workflows | ||
| # that are specific to this project's needs when building/testing. Note that this script runs on | ||
| # every supported Linux distribution so it must adapt to the distribution that it is running. | ||
|
|
||
| if [[ "$(uname -s)" == "Linux" ]]; then | ||
| # Install the basic utilities depending on the type of Linux distribution | ||
| apt-get --help && apt-get update && TZ=Etc/UTC apt-get -y install curl make gpg tzdata | ||
| yum --help && (curl --help && yum -y install curl) && yum -y install make gpg tar procps | ||
| fi | ||
|
|
||
| set -e | ||
|
|
||
| while [ $# -ne 0 ]; do | ||
| arg="$1" | ||
| case "$arg" in | ||
| --install-swiftly) | ||
| installSwiftly=true | ||
| ;; | ||
| --swift-snapshot) | ||
| swiftSnapshot="$2" | ||
| shift; | ||
| ;; | ||
| *) | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
|
|
||
| if [ "$installSwiftly" == true ]; then | ||
| echo "Installing swiftly" | ||
|
|
||
| curl -O "https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz" && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install | ||
| # shellcheck source=/dev/null | ||
| . "/root/.local/share/swiftly/env.sh" | ||
|
|
||
| hash -r | ||
|
|
||
| selector=() | ||
| runSelector=() | ||
|
|
||
| if [ "$swiftSnapshot" != "" ]; then | ||
| echo "Installing latest $swiftSnapshot-snapshot toolchain" | ||
| selector=("$swiftSnapshot-snapshot") | ||
| runSelector=("+$swiftSnapshot-snapshot") | ||
| elif [ -f .swift-version ]; then | ||
| echo "Installing selected swift toolchain from .swift-version file" | ||
| selector=() | ||
| runSelector=() | ||
| else | ||
| echo "Installing latest toolchain" | ||
| selector=("latest") | ||
| runSelector=("+latest") | ||
| fi | ||
|
|
||
| TMPDIR=/var/tmp swiftly install --post-install-file=post-install.sh "${selector[@]}" | ||
|
|
||
| if [ -f post-install.sh ]; then | ||
| echo "Performing swift toolchain post-installation" | ||
| chmod u+x post-install.sh && ./post-install.sh | ||
| fi | ||
|
|
||
| echo "Displaying swift version" | ||
| swiftly run "${runSelector[@]}" swift --version | ||
| fi |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just curious: what's our policy to update this file when new Swift is released? Do we always try to use the current release?
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.
Honestly, I end up deleting it in my working tree half the time because it causes problems when using a different version.
This is really meant for "apps" which build with one canonical version only, not libraries which build with multiple. [/rant]
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.
In term of the policy of swift-subprocess and the swift version file, it's up to the code owners here what to do with it.
The swift version file is there to record that at least one person, and ideally the CI too, has verified that the project can be developed on a specific toolchain version with a degree of confidence that the package builds, tests will build and pass, the language server works, and things like code formatting work without extraneous diffs. The hope is to lessen "it works at my desk" kinds of problems with a measure of reproducibility, and to encourage new developers to a package because things just work right away.
By no means does this file indicate that this is the only version of the toolchain that can be used with this package, or the only one it supports. This is just the default that gets developers working with it to a known good configuration for most things and swiftly can help them with that.
Also, it has no effect on dependent packages. This is for development of this package, even if the package is a library package like this one.
It's worth noting that this file instructs what toolchain version to use for testing with the Linux kernel versions added as GH workflows in this PR as it stands. The Qemu setup script uses of swiftly to install the swift toolchain into the Linux VM that normally won't have it. It's currently configured to use this file as it's visible, easy to update, and swiftly can use it.
Please let me know if you'd prefer the test script to always use "latest", or something that's statically coded into the test script, or the GH workflow. I think that this file is simpler, more visible, and more reproducible than those alternatives.