Skip to content

Commit

Permalink
test: add filesystem check to test-fs-stat-date.mjs
Browse files Browse the repository at this point in the history
PR-URL: #44174
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
LiviaMedeiros authored and ruyadorno committed Aug 22, 2022
1 parent a3cc8ce commit e373144
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/parallel/test-fs-stat-date.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ const filepath = path.resolve(tmpdir.path, 'timestamp');

await (await fsPromises.open(filepath, 'w')).close();

// Perform a trivial check to determine if filesystem supports setting
// and retrieving atime and mtime. If it doesn't, skip the test.
await fsPromises.utimes(filepath, 2, 2);
const { atimeMs, mtimeMs } = await fsPromises.stat(filepath);
if (atimeMs !== 2000 || mtimeMs !== 2000) {
common.skip(`Unsupported filesystem (atime=${atimeMs}, mtime=${mtimeMs})`);
}

// Date might round down timestamp
function closeEnough(actual, expected, margin) {
// On ppc64, value is rounded to seconds
Expand Down

0 comments on commit e373144

Please sign in to comment.