aboutsummaryrefslogtreecommitdiff
path: root/test/pummel/test-abort-fatal-error.js
blob: d1a8d3daa65e4cfef0f25d2e69a99856ec5695bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
const common = require('../common');
const assert = require('assert');

if (common.isWindows) {
  common.skip('no RLIMIT_NOFILE on Windows');
  return;
}

const exec = require('child_process').exec;

let cmdline = 'ulimit -c 0; ' + process.execPath;
cmdline += ' --max-old-space-size=4 --max-semi-space-size=1';
cmdline += ' -e "a = []; for (i = 0; i < 1e9; i++) { a.push({}) }"';

exec(cmdline, function(err, stdout, stderr) {
  if (!err) {
    console.log(stdout);
    console.log(stderr);
    assert(false, 'this test should fail');
    return;
  }

  if (err.code !== 134 && err.signal !== 'SIGABRT') {
    console.log(stdout);
    console.log(stderr);
    console.log(err);
    assert(false, err);
  }
});