Skip to content

Commit f64b2f5

Browse files
committed
test: fix test-fs-utimes on non-Y2K38 file systems
Fixes: nodejs#36591
1 parent 8a6d7a0 commit f64b2f5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/parallel/test-fs-utimes.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,15 @@ function runTests(iter) {
160160
const path = `${tmpdir.path}/test-utimes-precision`;
161161
fs.writeFileSync(path, '');
162162

163-
// Test Y2K38 for all platforms [except 'arm', 'OpenBSD', 'SunOS' and 'IBMi']
164-
if (!process.arch.includes('arm') &&
165-
!common.isOpenBSD && !common.isSunOS && !common.isIBMi) {
163+
{
166164
const Y2K38_mtime = 2 ** 31;
167165
fs.utimesSync(path, Y2K38_mtime, Y2K38_mtime);
168166
const Y2K38_stats = fs.statSync(path);
169-
assert.strictEqual(Y2K38_stats.mtime.getTime() / 1000, Y2K38_mtime);
167+
const mtimeStamp = Y2K38_stats.mtime.getTime() / 1000;
168+
// Off-by-one value is permissible for file systems that don't support Y2K38.
169+
if (mtimeStamp !== Y2K38_mtime && mtimeStamp !== Y2K38_mtime - 1) {
170+
assert.fail(`${mtimeStamp} unexpected`);
171+
}
170172
}
171173

172174
if (common.isWindows) {

0 commit comments

Comments
 (0)