Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2018-10-31 02:59:53 +0300
committerMyles Borins <mylesborins@google.com>2018-12-03 21:31:56 +0300
commit5bedd1ce2f02beece3710cb1a0c04251f6631f3f (patch)
treef5d68df3d5c1c1c44d6611c57ba1ed29887e971a /test
parent52215a4c35d519f1523e4ab7ad74458c30f3c9e4 (diff)
test: fix test-fs-watch-system-limit
On some systems the default inotify limits might be too high for the test to actually fail. Detect and skip the test in such environments. PR-URL: https://github.com/nodejs/node/pull/23986 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/sequential/test-fs-watch-system-limit.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/sequential/test-fs-watch-system-limit.js b/test/sequential/test-fs-watch-system-limit.js
index e896cbf83b9..8b9cb62ad0a 100644
--- a/test/sequential/test-fs-watch-system-limit.js
+++ b/test/sequential/test-fs-watch-system-limit.js
@@ -2,6 +2,7 @@
const common = require('../common');
const assert = require('assert');
const child_process = require('child_process');
+const fs = require('fs');
const stream = require('stream');
if (!common.isLinux)
@@ -9,6 +10,20 @@ if (!common.isLinux)
if (!common.enoughTestCpu)
common.skip('This test is resource-intensive');
+try {
+ // Ensure inotify limit is low enough for the test to actually exercise the
+ // limit with small enough resources.
+ const limit = Number(
+ fs.readFileSync('/proc/sys/fs/inotify/max_user_watches', 'utf8'));
+ if (limit > 16384)
+ common.skip('inotify limit is quite large');
+} catch (e) {
+ if (e.code === 'ENOENT')
+ common.skip('the inotify /proc subsystem does not exist');
+ // Fail on other errors.
+ throw e;
+}
+
const processes = [];
const gatherStderr = new stream.PassThrough();
gatherStderr.setEncoding('utf8');