Skip to content

Commit

Permalink
test: skip test-fs-readdir-ucs2 if no support
Browse files Browse the repository at this point in the history
If the filesystem does not support UCS2, do not run the test.

PR-URL: nodejs#14029
Fixes: nodejs#14028
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
Trott committed Aug 15, 2017
1 parent cebce8b commit f41047e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ test-fs-read-buffer-tostring-fail : PASS,FLAKY
[$system==macos]

[$arch==arm || $arch==arm64]
test-fs-readdir-ucs2 : PASS,FLAKY
test-npm-install: PASS,FLAKY

[$system==solaris] # Also applies to SmartOS
Expand Down
18 changes: 10 additions & 8 deletions test/parallel/test-fs-readdir-ucs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ const root = Buffer.from(`${common.tmpDir}${path.sep}`);
const filebuff = Buffer.from(filename, 'ucs2');
const fullpath = Buffer.concat([root, filebuff]);

fs.closeSync(fs.openSync(fullpath, 'w+'));
try {
fs.closeSync(fs.openSync(fullpath, 'w+'));
} catch (e) {
if (e.code === 'EINVAL')
common.skip('test requires filesystem that supports UCS2');
throw e;
}

fs.readdir(common.tmpDir, 'ucs2', (err, list) => {
if (err) throw err;
fs.readdir(common.tmpDir, 'ucs2', common.mustCall((err, list) => {
assert.ifError(err);
assert.strictEqual(1, list.length);
const fn = list[0];
assert.deepStrictEqual(filebuff, Buffer.from(fn, 'ucs2'));
assert.strictEqual(fn, filename);
});

process.on('exit', () => {
fs.unlinkSync(fullpath);
});
}));

0 comments on commit f41047e

Please sign in to comment.