diff options
author | Ali Ijaz Sheikh <ofrobots@google.com> | 2018-10-30 16:59:53 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-11-01 19:07:24 -0700 |
commit | a03165a5fd5ab0325eec506e346f6ec5db46780d (patch) | |
tree | d7d507519a46a7cb153c0ad800b5b642bf204fd2 /test/sequential | |
parent | 67d74e400b55f2a4b03c70bf0f92f7d248d7fd3e (diff) | |
download | android-node-v8-a03165a5fd5ab0325eec506e346f6ec5db46780d.tar.gz android-node-v8-a03165a5fd5ab0325eec506e346f6ec5db46780d.tar.bz2 android-node-v8-a03165a5fd5ab0325eec506e346f6ec5db46780d.zip |
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/sequential')
-rw-r--r-- | test/sequential/test-fs-watch-system-limit.js | 15 |
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'); |