summaryrefslogtreecommitdiff
path: root/test/report/test-report-fatal-error.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-02-28 20:54:35 -0500
committercjihrig <cjihrig@gmail.com>2019-03-02 21:17:19 -0500
commitfe292fac55c2b41432db2c326fe40ae154a1ab21 (patch)
tree659b2ae6022f0077b5acf9d83bf6657fabea79e3 /test/report/test-report-fatal-error.js
parent060af324ae7093a390edd1524855d7679ce6837b (diff)
downloadandroid-node-v8-fe292fac55c2b41432db2c326fe40ae154a1ab21.tar.gz
android-node-v8-fe292fac55c2b41432db2c326fe40ae154a1ab21.tar.bz2
android-node-v8-fe292fac55c2b41432db2c326fe40ae154a1ab21.zip
test: rename node-report suite to report
This commit renames the "node-report" test suite to "report" in order to begin differentiating core's diagnostic reporting from the original node-report module on npm PR-URL: https://github.com/nodejs/node/pull/26371 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/report/test-report-fatal-error.js')
-rw-r--r--test/report/test-report-fatal-error.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/report/test-report-fatal-error.js b/test/report/test-report-fatal-error.js
new file mode 100644
index 0000000000..b6cf792725
--- /dev/null
+++ b/test/report/test-report-fatal-error.js
@@ -0,0 +1,38 @@
+'use strict';
+
+const common = require('../common');
+common.skipIfReportDisabled();
+const assert = require('assert');
+// Testcase to produce report on fatal error (javascript heap OOM)
+if (process.argv[2] === 'child') {
+
+ const list = [];
+ while (true) {
+ const record = new MyRecord();
+ list.push(record);
+ }
+
+ function MyRecord() {
+ this.name = 'foo';
+ this.id = 128;
+ this.account = 98454324;
+ }
+} else {
+ const helper = require('../common/report.js');
+ const tmpdir = require('../common/tmpdir');
+ tmpdir.refresh();
+ const spawn = require('child_process').spawn;
+ const args = ['--experimental-report',
+ '--diagnostic-report-on-fatalerror',
+ '--max-old-space-size=20',
+ __filename,
+ 'child'];
+ const child = spawn(process.execPath, args, { cwd: tmpdir.path });
+ child.on('exit', common.mustCall((code) => {
+ assert.notStrictEqual(code, 0, 'Process exited unexpectedly');
+ const reports = helper.findReports(child.pid, tmpdir.path);
+ assert.strictEqual(reports.length, 1);
+ const report = reports[0];
+ helper.validate(report);
+ }));
+}