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>
This commit is contained in:
parent
67d74e400b
commit
a03165a5fd
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user