From 3128cb7da60ecf77dd9ab85b3e14507313fbba23 Mon Sep 17 00:00:00 2001 From: John Barboza Date: Tue, 12 Jun 2018 17:44:23 -0700 Subject: [PATCH] test: avoid running fsync on directory on AIX On AIX the underlying fsync system call returns EBADF on a file descriptor for an open directory. So avoid running fsync on it. PR-URL: https://github.com/nodejs/node/pull/21298 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Michael Dawson Reviewed-By: James M Snell Signed-off-by: Beth Griggs --- test/parallel/test-fs-utimes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index 3dc0bb59def6a2..ad83bc93653256 100644 --- a/test/parallel/test-fs-utimes.js +++ b/test/parallel/test-fs-utimes.js @@ -35,7 +35,11 @@ function stat_resource(resource) { if (typeof resource === 'string') { return fs.statSync(resource); } else { + const stats = fs.fstatSync(resource); // ensure mtime has been written to disk + // except for directories on AIX where it cannot be synced + if (common.isAIX && stats.isDirectory()) + return stats; fs.fsyncSync(resource); return fs.fstatSync(resource); }