mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test: add filesystem check to test-fs-stat-date.mjs
PR-URL: https://github.com/nodejs/node/pull/44174 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
a3cc8ce959
commit
e37314497a
1 file changed
+8
@@ -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
|
||||
|
||||
Reference in new issue
Block a user