Skip to content

Commit 8d2095e

Browse files
committed
fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: fix test-fs-utimes on non-Y2K38 file systems
1 parent 9c8b1ed commit 8d2095e

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

test/parallel/test-fs-utimes-y2K38.js

+17-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,27 @@ const fs = require('fs');
77

88
tmpdir.refresh();
99

10-
// Check for Y2K38 support. For Windows, assume it's there. Windows doesn't have
11-
// `touch`.
12-
if (!common.isWindows) {
10+
// Check for Y2K38 support. For Windows and AIX, assume it's there. Windows
11+
// doesn't have `touch` and `date -r` which are used in the check for support.
12+
// AIX lacks `date -r`.
13+
if (!common.isWindows && !common.isAIX) {
1314
const testFilePath = `${tmpdir.path}/y2k38-test`;
1415
const testFileDate = '204001020304';
1516
const { spawnSync } = require('child_process');
16-
const { status } = spawnSync('touch',
17-
['-t', testFileDate, testFilePath],
17+
const touchResult = spawnSync('touch',
18+
['-t', testFileDate, testFilePath],
19+
{ encoding: 'utf8' });
20+
if (touchResult.status !== 0) {
21+
common.skip('File system appears to lack Y2K38 support (touch failed)');
22+
}
23+
24+
const dateResult = spawnSync('date',
25+
['-r', testFilePath, '+%Y%m%d%H%M'],
1826
{ encoding: 'utf8' });
19-
if (status !== 0) {
20-
common.skip('File system appears to lack Y2K38 support');
27+
28+
assert.strictEqual(dateResult.status, 0);
29+
if (dateResult.stdout.trim() !== testFileDate) {
30+
common.skip('File system appears to lack Y2k38 support (date failed)');
2131
}
2232
}
2333

0 commit comments

Comments
 (0)