Fix up dispatch_io tests #26
Merged
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.
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.
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).
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.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.
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.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 theis_done
check because it doesn't appear to be valid.