test, fs: fix chmod mask testing on windows#12835
test, fs: fix chmod mask testing on windows#12835refack wants to merge 1 commit intonodejs:masterfrom
Conversation
|
Refs: #12803 |
test/parallel/test-fs-chmod.js
Outdated
There was a problem hiding this comment.
Is this added because the files being operated on are in the fixtures dir? IMO, the test should be refactored to use the tmp dir instead so that we don't need to do this. Tests shouldn't modify files in fixtures. Then it can check mode on file creation too, I suppose.
There was a problem hiding this comment.
If I copy the files to common.tmpDir it doesn't repro
|
/cc @nodejs/fs |
|
See about |
There was a problem hiding this comment.
This is not necessary if known_issues.status is properly updated, if I get this right.
There was a problem hiding this comment.
I'll need to set it to be excluded for every platform but windows.
This way seems less noisy...
test/parallel/test-fs-chmod.js
Outdated
There was a problem hiding this comment.
/bin/sh: copy: command not found in Linux CI.
There was a problem hiding this comment.
Linter:
11:22 error Strings must use singlequote quotes
11:55 error Missing semicolon semi
test/parallel/test-fs-chmod.js
Outdated
There was a problem hiding this comment.
Linter: 78:25 error Strings must use singlequote quotes
test/parallel/test-fs-chmod.js
Outdated
There was a problem hiding this comment.
Linter: 79:25 error Strings must use singlequote quotes
test/parallel/test-fs-chmod.js
Outdated
There was a problem hiding this comment.
Linter: 81:23 error Missing semicolon semi
|
@vsemozhetbyt de-linted. P.S. how do you run the lint locally, I couldn't find a good command? |
|
@refack |
works so bad on Windows 😭 |
|
@refack node tools/eslint/bin/eslint.js --rulesdir tools/eslint-rules/ --ext=.js,.md benchmark doc lib test toolsor just: eslint --rulesdir tools/eslint-rules/ --ext=.js,.md benchmark doc lib test toolsFor a file: eslint --rulesdir tools/eslint-rules/ path/to/a/file.js
eslint --rulesdir tools/eslint-rules/ path/to/a/file.md |
|
@nodejs/platform-macos if this a real bug? Snippet from test (last line is 94)const file1 = path.join(common.tmpDir, Date.now() + 'duck.js');
const file2 = path.join(common.tmpDir, Date.now() + 'goose.js');
fs.writeFileSync(file1, 'ga ga');
fs.writeFileSync(file2, 'waq waq');
// to flush some buffers
console.log('written');
console.log('written some more');
if (common.isWindows) {
execSync(`attrib -a -h -i -r -s ${file1}`);
execSync(`attrib -a -h -i -r -s ${file2}`);
} else {
execSync(`touch ${file1}`);
execSync(`touch ${file2}`);
}
fs.chmod(file1, mode_async.toString(8), common.mustCall((err) => {
assert.ifError(err);
console.log(fs.statSync(file1).mode);Output |
|
Failing on freeBSD: https://ci.nodejs.org/job/node-stress-single-test/1213/nodes=freebsd10-64/ |
|
Try to fail on macOS: https://ci.nodejs.org/job/node-stress-single-test/1215/nodes=osx1010/ |
6de5aa1 to
1576078
Compare
|
Latest CI: https://ci.nodejs.org/job/node-test-commit/9870/ |
|
@Trott @vsemozhetbyt PTAL
|
|
@refack I feel murky on this issue, so I dare not make any definitive review( |
|
@nodejs/testing PTAL |
test/parallel/test-fs-chmod.js
Outdated
There was a problem hiding this comment.
Why the chmod in the exit handler?
There was a problem hiding this comment.
If the file stays RO, common.refreshTmpDir fails
There was a problem hiding this comment.
Are you certain about that? If so, it must be Windows-only behavior.
There was a problem hiding this comment.
Are you certain about that? If so, it must be Windows-only behavior.
Yes, common.refreshTmpDir fails in a few cases on Windows
There was a problem hiding this comment.
OK, well in that case, either surrounding it with if (common.isWindows) and/or providing a comment explaining why it's there might help prevent someone like me from coming along and obliviously removing it in six months. :-D
There was a problem hiding this comment.
So let's wait with this. I want to fix common.refreshTmpDir on windows.
|
New CI:https://ci.nodejs.org/job/node-test-commit/9914/ (hopefully we got the flakes out of the way) |
There was a problem hiding this comment.
We generally use common.skip to skip tests.
There was a problem hiding this comment.
Since this is a known-issue it's supposed to fail.
So it's either this line or exclude this test for all platforms but Windows in known_issues.status
Otherwise we get:
refael@refaelux:/mnt/d/code/node-cur$ python tools/test.py known_issues
=== release test-fs-fchmod-12835 [negative] ===
Path: known_issues/test-fs-fchmod-12835
1..0 # Skipped: undefined
Command: out/Release/node /mnt/d/code/node-cur/test/known_issues/test-fs-fchmod-12835.js
[00:11|% 100|+ 13|- 1]: Done
Currently this uncovers a regression in `fs.fchmodSync(fd, mode_sync);` No solution yet... Also as issue on macOS in test-fs-chmod:94 fail to access file1 Fixes:nodejs#12803
|
Blocking until we fix |
|
Ping @refack |
| const assert = require('assert'); | ||
| const path = require('path'); | ||
| const fs = require('fs'); | ||
| const {execSync} = require('child_process'); |
There was a problem hiding this comment.
Is the linter not complaining about this without extra whitespace?^^
There was a problem hiding this comment.
It seems the rule was landed later than the last CI here.
|
@refack this needs a rebase |
|
Closing due to long inactivity. @refack please reopen if you want to further pursue this. |
Currently this uncovers a regression in
fs.fchmodSync(fd, mode_sync);No solution yet...
Fixes:#12803
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
fs,libuv,test