Test that largefiles can be read through the tree API#4874
Merged
ethomson merged 6 commits intolibgit2:masterfrom Apr 4, 2019
Merged
Test that largefiles can be read through the tree API#4874ethomson merged 6 commits intolibgit2:masterfrom
ethomson merged 6 commits intolibgit2:masterfrom
Conversation
Contributor
Author
|
Note that it's a green test locally, so it look like it's fixed (on the off-chance that the build is red, or that invasive tests are not enabled — I don't recall). |
pks-t
reviewed
Nov 7, 2018
7d4674c to
ccb82f3
Compare
ethomson
reviewed
Jan 17, 2019
Member
|
Attempting to add a Win32 version of |
pks-t
reviewed
Feb 22, 2019
| return p_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode); | ||
| } | ||
|
|
||
| int p_fallocate(int fd, off_t offset, off_t len) |
Member
There was a problem hiding this comment.
Might make sense to have some tests in tests/core/posix.c, right?
Member
There was a problem hiding this comment.
I added a test - I'm always a little nervous testing the POSIX stuff because it's easy to get caught up testing everybody else's implementation. 😀 But let's give it a shot.
Emulate `p_fallocate` on Windows by seeking beyond the end of the file and setting the size to the current seek position.
On macOS, fcntl(..., F_PREALLOCATE, ...) will only succeed when followed by an ftruncate(), even when it reports success. However, that syscall will fail when the file already exists. Thus, we must ignore the error code and simply let ftruncate extend the size of the file itself (albeit slowly). By calling ftruncate, we also need to prevent against file shrinkage, for compatibility with posix_ftruncate, which will only extend files, never shrink them.
Member
|
Cool cool. Thanks, @tiennou! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 is the test case for #4615, ported to clar.
Now I'm hoping
fcntlis something portable 🤞.