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 <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information
Trott authored and refack committed Jul 4, 2017
1 parent 2d2986a commit 4dd7d09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ prefix parallel
[$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
16 changes: 9 additions & 7 deletions test/parallel/test-fs-readdir-ucs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,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) => {
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 4dd7d09

Please sign in to comment.