Skip to content

Fix up dispatch_io tests #26

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 6 commits into from
Dec 31, 2015
Merged

Conversation

seabaylea
Copy link
Contributor

This PR fixes up the dispatch_io tests so that that pass. I've submitted this as a collection of commits as each fixes a different area. If you rather I squashed them, let me know.

  • Add equivalent to immutable write test for Linux
    There's currently a test that sets a directory as immutable, then runs a write test against it and checks that the write fails and the correct amount of data is still pending to write. As immutable isn't available in Linux, I've replaced this with setting the directory as non-writeable (and retaining the use of immutable on Mac OS).
  • Limit data read in to the size of the file
    The IO read/write test reads in 1024 * 1024 bytes of data from /usr/share/dict/words however there isn't necessarily that much data available (there isn't on my Linux install), so I've switched the amount of data to be the min of 1024 * 1024 or the file size.
  • Switch to using random rather than random for consistency
    As for PR Switch to using /dev/urandom as file source #24, the use of random on Linux means that we don't read in the expected level of data. Switching to random gives us the same expected behaviour on Linux and Mac OS.
  • Allow for access permission issues when walking /usr/lib
    The read many files test walks /usr/lib as its source of files, however they are not necessarily all readable. I certainly hit any issue trying to read /usr/lib/cups/backend/serial so this allows for EACCES to occur and ignores the file.
  • Remove is_done check for concurrent reads
    The concurrent async read test checks to see wether is_done is set (by the read callbacks) inside the cleanup handler. This presumes that the read callbacks will occur before close down happens, but there doesn't look to be a reason for that assumption - its not documented, and you aren't expected to clean up anything that the read callback requires. I've removed the is_done check because it doesn't appear to be valid.


int in = open(path_in, O_RDONLY);
if (in == -1) {
test_errno("open", errno, 0);
test_stop();
}
struct stat sb;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment is not right, we use tabs.

The vim settings to use for our coding rules are mostly:

set cinoptions=
set cinoptions+=Ls
set cinoptions+=:0,=1s
set cinoptions+=t0
set cinoptions+=+2s,(2s,u2s,W2s
set cinoptions+=j1,J1,m1

au FileType d,c,cpp,objc setlocal tw=80 ts=4 sw=4 noet noignorecase

@MadCoder
Copy link
Contributor

I've made my remarks, I don't care for a squashed commit here as much as we won't backport tests changes to Darwin. We do have a test-suite that's more comprehensive than the open source version but that rely on internal infrastructure.

squashed commit is only to help us merge back to Darwin and downstream the change again.

@seabaylea
Copy link
Contributor Author

Updated to use #ifdef UF_IMMUTABLE and fix the whitespace issues.

MadCoder added a commit that referenced this pull request Dec 31, 2015
@MadCoder MadCoder merged commit e1eb8d9 into swiftlang:master Dec 31, 2015
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