-
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: added input validation test for fchmod #18217
Conversation
Hey look @cjihrig ... @lucamaraschi submitted a test case! How many more does he have to go ;-) |
@jasnell if my math is right, 90 once this lands. |
CI complains about a syntax error:
|
test/parallel/test-fs-fchmod.js
Outdated
// Check for mode values range | ||
const modeUpperBoundaryValue = 0o777; | ||
common.mustCall(() => fs.fchmod(1, modeUpperBoundaryValue); | ||
common.mustCall(() => fs.fchmodSync(1, modeUpperBoundaryValue); |
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.
nit: missing parens at the end of both of these lines.
572c760
to
b16a6e5
Compare
test/parallel/test-fs-fchmod.js
Outdated
// Check for mode values range | ||
const modeUpperBoundaryValue = 0o777; | ||
common.mustCall(() => fs.fchmod(1, modeUpperBoundaryValue)); | ||
common.mustCall(() => fs.fchmodSync(1, modeUpperBoundaryValue)); |
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.
Is it me or something is missing? The function returned by common.mustCall
is never called, so I expect the test to fail.
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.
Good point. And neither of these two entries should require being wrapped in a mustCall.
Added a test to ensure input validation for FD and mode for fs.fchmod. Removed check for values lower than 0 for `mode` as it's already checked by `validateUint32`.
b16a6e5
to
61d47f2
Compare
Added a test to ensure input validation for FD and mode for fs.fchmod. Removed check for values lower than 0 for `mode` as it's already checked by `validateUint32`. PR-URL: nodejs#18217 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 075eef5 @lucamaraschi you are very much behind with those tests! |
Should this be backported to |
Added a test to ensure input validation for FD and mode for fs.fchmod.
Removed check for values lower than 0 for
mode
as it's already checkedby
validateUint32
.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test, fs