| 26 | |
| 27 | // Date might round down timestamp |
| 28 | function closeEnough(actual, expected, margin) { |
| 29 | // On ppc64, value is rounded to seconds |
| 30 | if (process.arch === 'ppc64') { |
| 31 | margin += 1000; |
| 32 | } |
| 33 | |
| 34 | // Filesystems without support for timestamps before 1970-01-01, such as NFSv3, |
| 35 | // should return 0 for negative numbers. Do not treat it as error. |
| 36 | if (actual === 0 && expected < 0) { |
| 37 | console.log(`ignored 0 while expecting ${expected}`); |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | assert.ok(Math.abs(Number(actual - expected)) < margin, |
| 42 | `expected ${expected} ± ${margin}, got ${actual}`); |
| 43 | } |
| 44 | |
| 45 | // Ensure that accessed atime and mtime are enumerable |
| 46 | function validateEnumerability(stats) { |