2017-01-03 22:16:48 +01:00
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
|
|
// following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included
|
|
|
|
// in all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-07-18 22:33:42 +02:00
|
|
|
const common = require('../common');
|
2017-07-01 01:29:09 +02:00
|
|
|
if (common.isWindows)
|
2016-05-11 21:34:52 +02:00
|
|
|
common.skip('no RLIMIT_NOFILE on Windows');
|
2014-01-09 22:33:51 +01:00
|
|
|
|
2017-07-01 01:29:09 +02:00
|
|
|
const assert = require('assert');
|
2016-12-31 00:38:06 +01:00
|
|
|
const exec = require('child_process').exec;
|
2014-01-09 22:33:51 +01:00
|
|
|
|
2017-04-28 03:06:42 +02:00
|
|
|
let cmdline = `ulimit -c 0; ${process.execPath}`;
|
2014-10-08 12:34:51 +02:00
|
|
|
cmdline += ' --max-old-space-size=4 --max-semi-space-size=1';
|
2014-01-13 23:56:12 +01:00
|
|
|
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';
|
2014-01-09 22:33:51 +01:00
|
|
|
|
|
|
|
exec(cmdline, function(err, stdout, stderr) {
|
2014-01-28 03:05:39 +01:00
|
|
|
if (!err) {
|
|
|
|
console.log(stdout);
|
|
|
|
console.log(stderr);
|
|
|
|
assert(false, 'this test should fail');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-28 03:27:10 +01:00
|
|
|
if (err.code !== 134 && err.signal !== 'SIGABRT') {
|
2014-01-28 03:05:39 +01:00
|
|
|
console.log(stdout);
|
|
|
|
console.log(stderr);
|
|
|
|
console.log(err);
|
|
|
|
assert(false, err);
|
|
|
|
}
|
2014-01-09 22:33:51 +01:00
|
|
|
});
|