Skip to content
Permalink
Browse files
test: loosen test for negative timestamps in test-fs-stat-date
PR-URL: #44707
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
LiviaMedeiros authored and danielleadams committed Oct 11, 2022
1 parent db5aeed commit fe91bebb67ab78c82bf8917590c28440e326ddb1
Showing 1 changed file with 8 additions and 0 deletions.
@@ -31,6 +31,14 @@ function closeEnough(actual, expected, margin) {
if (process.arch === 'ppc64') {
margin += 1000;
}

// Filesystems without support for timestamps before 1970-01-01, such as NFSv3,
// should return 0 for negative numbers. Do not treat it as error.
if (actual === 0 && expected < 0) {
console.log(`ignored 0 while expecting ${expected}`);
return;
}

assert.ok(Math.abs(Number(actual - expected)) < margin,
`expected ${expected} ± ${margin}, got ${actual}`);
}

0 comments on commit fe91beb

Please sign in to comment.