-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[4.2] Ubuntu18.04 fixes for TestURLSession #1615
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
[4.2] Ubuntu18.04 fixes for TestURLSession #1615
Conversation
@swift-ci please test |
1 similar comment
@swift-ci please test |
Looks like a test failure:
|
@swift-ci please test |
@spevans Can you look into this test failure?
|
- For expiry date, prefer maximum-age over expires-date but only use maximum-age for version 1 cookies. - For version 0 cookies only return the first port number, if available.
- Set SO_NOSIGPIPE on the client socket (Darwin) or use send() with flag MSG_NOSIGNAL (Linux). - listen() just after bind()ing. - Close the client socket after writing out the response. - When sending a response with a start delay dont use asyncAfter() with a semaphore, just use Thread.sleep(). - Fix parsing the HTTP request so that all of the header lines are read correctly instead of reading the last header line as the body. - When waiting for the server to become ready, wait for the semaphore with a timeout rather than an indefinite wait(). - Add setUp() to be run before each test class. - For test cases that check the respnse body, check the data is not nil before reading it. - Use 1 server for whole class clifetime. - Use shutdown() to interrupt accept() when shutting down the server.
- Uncomment failing tests that now work, fixes SR-7723 and SR-5751. - Disable TestURLSession.test_cancelTask() as it fails intermittently because the server can respond before the task is cancelled. - Disable TestURLSession.test_simpleUploadWithDelegate() as the server wont read the entire body successfully.
- Add a delay into the test server response so that the task will always be cancelled before the server returns the complete response.
…ithout null termination Changed _fastCStringContents (used in CFStringGetCStringPtr) to return NULL if required to return a string containing null termination. Since this fix, if you call CFStringGetCStringPtr with a Swift-based CFString, it returns NULL. Before the change: _fastCStringContents always returned a pointer to an ASCII string containing no NULL termination. This is because the code was using unsafeBitCast to get internal pointer of String of Swift. Swift's string does not guarantee null termination.
@shahmishal Im just rebasing and testing locally now, If I remember correctly this actually worked ok on my Ubuntu18 server so it may be an issue with Ubuntu16. Is it possible to use swift-ci to direct tests to the individual Ubuuntu18/16/14 servers? I don't want to get this working then find it breaks on Ubuntu14 after merging as is sometimes the case. |
53c06ef
to
b2c8092
Compare
@swift-ci please test |
@swift-ci test |
@swift-ci please test |
1 similar comment
@swift-ci please test |
At the moment this PR tests successfully on my local 16.04 and 18.04 test servers so it might take a while to figure out the issue on the CI server. Im just testing on 14.04 to see if that shows up the issue |
Looks like the issue is a bug in the redirection handling code. The test is failing because the redirect is not occurring correctly but it also looks like there is an Apache server running on the CI host which is intercepting these incorrect redirects and then serving a different error code to that expected by the tests. Im just working on a fix now |
@swift-ci please test |
The test passed with the fix https://ci.swift.org/view/Pull%20Request/job/swift-corelibs-foundation-PR-Linux/1190 |
ab31ed1
to
b2c8092
Compare
… new URL - If the new location includes a host but no port number, then DONT add the port number.
2d550d5
to
a657b2e
Compare
@swift-ci please test |
1 similar comment
@swift-ci please test |
@shahmishal Looks good now |
@swift-ci please test and merge |
This is a back port of various fixes to allow TestURLSession to work on Ubuntu18.04 without intermittent errors. It includes the following (some required because of what later fixes are based on)
#1602
#1613
#1565
#1498
#1650
Tested on macOS, Ubuntu 16.04 and Ubuntu 18.04