Open
Conversation
mckurt
reviewed
Nov 22, 2016
src/cc/qfsc/test-qfsc.c
Outdated
| // | ||
| // Using O_APPEND itself does not produce the same result. Opening a file with | ||
| // O_APPEND and writing to it will create hole of the appropriate size to make | ||
| // the previous chunk reach the chunksize. This can be useful as an atomic |
Contributor
There was a problem hiding this comment.
"This can be useful as an atomic append, but is not the behavior you'd expect from a normal filesystem."
I don't think this statement is needed here.
mckurt
reviewed
Nov 22, 2016
src/cc/qfsc/test-qfsc.c
Outdated
|
|
||
| // Generate the string consisting of the testdata twice | ||
| char expected_str[expected_len]; | ||
| strcpy(expected_str, testdata); |
Contributor
There was a problem hiding this comment.
why not use memcpy instead of strcpy followed by strcat?
Contributor
|
@noahgoldman Can you squeeze this into a single commit? One that reads something like "Add an append test by writing, closing, then seeking and writing ...". |
mckurt
reviewed
Nov 22, 2016
src/cc/qfsc/test-qfsc.c
Outdated
| strcpy(expected_str, testdata); | ||
| strcat(expected_str, testdata); | ||
|
|
||
| char buf[expected_len]; |
Contributor
There was a problem hiding this comment.
not sure if variable sized array declaration is a good idea.
c35348d to
41c45e0
Compare
Current coverage is 64.89% (diff: 100%)@@ master #198 diff @@
==========================================
Files 8 8
Lines 245 245
Methods 34 34
Messages 0 0
Branches 31 31
==========================================
Hits 159 159
Misses 69 69
Partials 17 17
|
This adds a test for appending to a file by writing, closing the file, opening it again and seeking to the end, then writing again. I added a clarifying comment before the test describing why this method is used as opposed to just opening the file with "O_APPEND".
Contributor
Author
|
@mckurt Updated this PR from your comments:
|
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 adds a test for appending to a file by writing, closing the file, opening it again and seeking to the end, then writing again. I added a clarifying comment before the test describing why this method is used as opposed to just opening the file with "O_APPEND".
@kstinsonqc @mckurt @mikeov