Skip to content

Commit

Permalink
test: fix test-fs-utimes on non-Y2K38 file systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Mar 13, 2021
1 parent 5ff2e58 commit 0e1b585
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/parallel/test-fs-utimes.js
Expand Up @@ -160,13 +160,15 @@ function runTests(iter) {
const path = `${tmpdir.path}/test-utimes-precision`;
fs.writeFileSync(path, '');

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

if (common.isWindows) {
Expand Down

0 comments on commit 0e1b585

Please sign in to comment.