summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
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 e896cbf83b..8b9cb62ad0 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');