Skip to content

TestURLSession: Fixes for Ubuntu18.04 #1602

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 4 commits into from
Jun 21, 2018

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Jun 14, 2018

  • Disable test_cancelTask() as this seems to be the failing
    task causing the others to fail, re-enable test_taskTimeout().

  • Ensure the HTTP server is ready before starting a test function
    that uses it.

This is a followup to #1599 . Its not a complete fix as test_cancelTask() still shows up issues and needs to be fixed.

Tested ok on Ubuntu 18.04

@spevans
Copy link
Contributor Author

spevans commented Jun 14, 2018

/cc @ianpartridge @shahmishal

@spevans
Copy link
Contributor Author

spevans commented Jun 14, 2018

@swift-ci please test

@spevans
Copy link
Contributor Author

spevans commented Jun 14, 2018

@millenomi Could you test this on Ubutntu14.04 if you have some time?

@spevans spevans changed the title TestURLSession: Fixes for Ubuntu18.04 [WIP] TestURLSession: Fixes for Ubuntu18.04 Jun 15, 2018
spevans added 3 commits June 19, 2018 11:43
- 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.
@spevans spevans force-pushed the pr_urlsession_fixes branch from 5a1d64b to f995719 Compare June 19, 2018 15:22
@spevans
Copy link
Contributor Author

spevans commented Jun 19, 2018

@swift-ci please test

@shahmishal
Copy link
Member

@spevans @ianpartridge Can we merge this PR?

- Add a delay into the test server response so that the task will always
  be cancelled before the server returns the complete response.
@spevans
Copy link
Contributor Author

spevans commented Jun 20, 2018

@swift-ci please test

1 similar comment
@spevans
Copy link
Contributor Author

spevans commented Jun 20, 2018

@swift-ci please test

@spevans
Copy link
Contributor Author

spevans commented Jun 20, 2018

@shahmishal This PR requires #1610 to be merged first and I still need to fix one more test (TestURLSession.test_simpleUploadWithDelegate) which has always failed intermittently and so I disabled it. However along with #1613 I was able to run the test suite on both 16.04 and 18.04 300times in a loop without any test failures, so once I have fixed the last test it will be ready for merging.

@parkera
Copy link
Contributor

parkera commented Jun 20, 2018

Ok I've got those other two merged.

@parkera
Copy link
Contributor

parkera commented Jun 20, 2018

If we're good to go here, let's merge.

@spevans spevans changed the title [WIP] TestURLSession: Fixes for Ubuntu18.04 TestURLSession: Fixes for Ubuntu18.04 Jun 20, 2018
@spevans
Copy link
Contributor Author

spevans commented Jun 20, 2018

@swift-ci please test and merge

@spevans
Copy link
Contributor Author

spevans commented Jun 20, 2018

I'll do a fix for test_simpleUploadWithDelegate in a separate PR - its disabled for now as it fails intermittently but I think I know the fix it needs.

@swift-ci swift-ci merged commit eaafb67 into swiftlang:master Jun 21, 2018
@spevans
Copy link
Contributor Author

spevans commented Jun 22, 2018

@parkera Shall I try and put together a PR with all of the Ubuntu18 fixes for Swift 4.2 or are you just going to merge master into swift-4.2-branch?

@parkera
Copy link
Contributor

parkera commented Jun 22, 2018

Good question. If it will be relatively quick to cherry pick these then we should do that now to unblock things.

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