-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
test: add fs/promises filehandle sync() and datasync() tests. #20530
Conversation
await handle.datasync(); | ||
await handle.sync(); | ||
const buf = Buffer.from('hello world'); | ||
await write(handle, buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handle.write(buf)
?
Same results and coverage, also see #20559.
await handle.sync(); | ||
const buf = Buffer.from('hello world'); | ||
await write(handle, buf); | ||
const ret = await read(handle, Buffer.alloc(11), 0, 11, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read(handle
→ handle.read(
? See the comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChALkeR Fixed them. Thanks.
1ff5b56
to
e8f8408
Compare
/cc @Trott |
5784c2d
to
2b54d4a
Compare
This is rebased on 0300f7c. |
@nodejs/fs please give this a look and a review, if possible. It's been over a month. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to actually test that fsync
and fdatasync
calls are effective, but I am not quite sure how to write tests for them with our APIs either, so LGTM as long as the code paths are covered.
assert.deepStrictEqual(ret.buffer, buf); | ||
} | ||
|
||
validateSync().then(common.mustCall()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.mustCall()
here seems unnecessary. If anything, common.crashOnUnhandledRejection()
above gives a better hint about why it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joyeecheung Thanks. Removed common.mustCall()
.
To increase test coverage for fs/promises, added tests for filehandle.sync and filehandle.datasync.
Replacing fs/promises methods read and write with fs/promises filehandle methods.
Fix module loading because fs/promises was moved to fs.promises
2b54d4a
to
d462d2c
Compare
CI failure is not related to this. It happens in |
I think CI failure |
To increase test coverage for fs.promises, added tests for filehandle.sync and filehandle.datasync. PR-URL: nodejs#20530 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Landed in 71ca076. Thanks for the contribution @shisama. |
To increase test coverage for fs.promises, added tests for filehandle.sync and filehandle.datasync. PR-URL: #20530 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
To increase test coverage for fs/promises,
added tests for filehandle.sync and filehandle.datasync.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes