Skip to content
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

Add tests for URLSession._MultiHandle Windows issue #4854

Closed

Conversation

lxbndr
Copy link
Contributor

@lxbndr lxbndr commented Dec 19, 2023

This adds test cases for #4791.

Test HTTPServer needs to be reconfigured (we need synchronous processing and minimal listening socket backlog) for one of the test scenarios, so there are options now.

  • test_httpTimeout - former test_timeoutInterval, is adjusted to actually test for timeout (it was falsely detecting connection error as expected result)
  • test_connectTimeout - tests a specific scenario, when the socket is timing out on connection attempt. Seems like with recent cURL library update this now works same way as http timeout, but in the past there was difference, so it is good thing to test
  • test_repeatedRequestsStress - included only in Windows suite, does a heavy pressure on URLSession/Dispatch using small packs of simultaneous requests, repeated lot of times. There are a bit of randomness, but I find 3000 cycles enough to reproduce crash on my machine. In most of cases it fails on first 300-500 cycles.

macOS system Foundation runs these tests perfectly (btw did we lose Darwin Compatibility Tests target?), but for SwiftFoundation on macOS the test_repeatedRequestsStress is surprisingly way slower (I'd say x10 slower) than even on Windows. Anyway, this particular test is intended only for testing against socket reuse on Windows.

This adds test cases for swiftlang#4791. Test HTTPServer needs to be reconfigured for one of the test scenarios, so there are options now.
lxbndr added a commit to readdle/swift-corelibs-foundation that referenced this pull request Dec 26, 2023
Extends socket lifetime enough to let DispatchSource cancel properly.
Also prevents from creating new DispatchSources while other are in the
middle of cancelling.

Also includes tests (see swiftlang#4854 for test details).
lxbndr added a commit to readdle/swift-corelibs-foundation that referenced this pull request Dec 26, 2023
Extends socket lifetime enough to let DispatchSource cancel properly.
Also prevents from creating new DispatchSources while other are in the
middle of cancelling.

Also includes tests (see swiftlang#4854 for test details).
lxbndr added a commit to readdle/swift-corelibs-foundation that referenced this pull request Dec 27, 2023
Extends socket lifetime enough to let DispatchSource cancel properly.
Also prevents from creating new DispatchSources while other are in the
middle of cancelling.

Also includes tests (see swiftlang#4854 for test details).
lxbndr added a commit to readdle/swift-corelibs-foundation that referenced this pull request Dec 29, 2023
Extends socket lifetime enough to let DispatchSource cancel properly.
Also prevents from creating new DispatchSources while other are in the
middle of cancelling.

Also includes tests (see swiftlang#4854 for test details).
@compnerd
Copy link
Member

compnerd commented Jan 8, 2024

@swift-ci please test

@lxbndr
Copy link
Contributor Author

lxbndr commented Jan 23, 2024

/Users/ec2-user/jenkins/workspace/swift-corelibs-foundation-PR-macOS/branch-main/swift-corelibs-foundation/CoreFoundation/PlugIn.subproj/CFBundle_Locale.c:151:70: error: initializer element is not a compile-time constant
    static CFStringRef const __CFBundleCommonLanguageNamesArray[] = {CFSTR("English"), CFSTR("French"), CFSTR("German"), CFSTR("Italian"), CFSTR("Dutch"), CFSTR("Spanish"), CFSTR("Japanese")};

This part works in Xcode 14.2, but not in Xcode 15. Not related to the changes in this PR.

@lxbndr
Copy link
Contributor Author

lxbndr commented Jul 19, 2024

Closing, as all relevant code is merged as part of other PR

@lxbndr lxbndr closed this Jul 19, 2024
@lxbndr lxbndr deleted the readdle/urlsession-dispatchsource-tests branch July 19, 2024 21:56
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