-
Notifications
You must be signed in to change notification settings - Fork 16
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
tests: Fix EndToEnd test deadlock under swift test
, but exclude from CI
#144
Merged
Conversation
This file contains 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
euanh
force-pushed
the
endtoend-test-deadlock
branch
15 times, most recently
from
November 8, 2024 09:16
9eb63de
to
790c17d
Compare
The EndToEnd tests build SDKs in several places. This commit consolidates this duplicated code in one function. This makes it easier for the next commit to give each build a temporary scratch directory, which will fix the problem of the tests deadlocking when run under `swift test`.
euanh
force-pushed
the
endtoend-test-deadlock
branch
7 times, most recently
from
November 11, 2024 09:10
dd7f401
to
6a26b1e
Compare
Building an SDK requires running the sdk-generator with `swift run swift-sdk-generator`. This takes a lock on `.build`, but if the tests are being run by `swift test` the outer Swift Package Manager instance will already hold this lock, causing the test to deadlock. We can work around this by giving the `swift run swift-sdk-generator` instance its own scratch directory.
…xecutable `testPackageInitExecutable` checks that the default Swift package generated by `swift package init` can be built with each SDK under test. The packages are already generated in temporary directories, so they do not suffer from the deadlocking problem when run under `swift test`. Currently each test run uses a directory with the same name in the user's temporary directory. This means that the test has to remove anything left behind by a previous run before starting a new on. Using `withTemporaryDirectory` avoids this problem because it creates a fresh temporary directory for each run and deletes it automatically when the body closure returns.
euanh
force-pushed
the
endtoend-test-deadlock
branch
from
November 11, 2024 09:21
6a26b1e
to
ccb2a9b
Compare
The EndToEnd tests no longer deadlock under `swift test` and can now be run on macOS and Linux. The CI cannot currently run the end to end tests because SDK generator cannot use the CI HTTP proxy to download packages. This commit explicitly skips the tests when running under CI. The tests can be run under macOS and Linux for local testing. Fixes: swiftlang#143
Packages.gz for jammy-updates now expands to more than 10MB. With the previous buffer size, ProcessExecutor.TooMuchProcessOutputError would be thrown when unpacking this file.
euanh
force-pushed
the
endtoend-test-deadlock
branch
from
November 11, 2024 17:09
ccb2a9b
to
8bd80df
Compare
@swift-ci test |
euanh
changed the title
tests: Fix EndToEnd test deadlock under
tests: Fix EndToEnd test deadlock under Nov 11, 2024
swift test
and enable tests on macOSswift test
, but exclude from CI
I may need to refactor these tests more when I start on #138, but this PR should at least let them run and pass in local testing for now. |
MaxDesiatov
approved these changes
Nov 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Building an SDK requires running the sdk-generator with
swift run swift-sdk-generator
. This takes a lock on.build
, but if the tests are being run byswift test
the outer Swift Package Manager instance will already hold this lock, causing the test to deadlock. We can avoid this by giving theswift run swift-sdk-generator
instance its own scratch directory.This PR consolidates the code which builds SDKs in one function, then runs each SDK build with its own temporary scratch directory. This avoids the deadlock on the
.build
directory when run underswift test
.The tests continue to pass when run under Xcode, which was not affected by the deadlock because it works in a separate scratch directory.
swift test
but skips them when running in the CI. When the downloading problem is solved, the tests can be enabled in CI as well.swift test
while working on this problem, to prevent regressions such as #141.Fixes #143