2016-05-16 21:41:37 +02:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const cp = require('child_process');
|
|
|
|
|
|
|
|
if (process.argv[2] === 'child') {
|
|
|
|
process.abort();
|
|
|
|
} else {
|
|
|
|
const child = cp.spawnSync(`${process.execPath}`, [`${__filename}`, 'child']);
|
2017-08-25 08:18:58 +02:00
|
|
|
const stderr = child.stderr.toString();
|
2016-05-16 21:41:37 +02:00
|
|
|
|
|
|
|
assert.strictEqual(child.stdout.toString(), '');
|
2018-12-03 17:15:45 +01:00
|
|
|
// Stderr will be empty for systems that don't support backtraces.
|
2017-08-25 08:18:58 +02:00
|
|
|
if (stderr !== '') {
|
|
|
|
const frames = stderr.trimRight().split('\n').map((s) => s.trim());
|
|
|
|
|
|
|
|
if (!frames.every((frame, index) => frame.startsWith(`${index + 1}:`))) {
|
|
|
|
assert.fail(`Each frame should start with a frame number:\n${stderr}`);
|
|
|
|
}
|
|
|
|
|
2017-11-11 14:42:17 +01:00
|
|
|
if (!common.isWindows) {
|
2018-03-07 22:34:10 +01:00
|
|
|
const { getBinaryPath } = require('../common/shared-lib-util');
|
|
|
|
if (!frames.some((frame) => frame.includes(`[${getBinaryPath()}]`))) {
|
2017-11-11 14:42:17 +01:00
|
|
|
assert.fail(`Some frames should include the binary name:\n${stderr}`);
|
|
|
|
}
|
2017-08-25 08:18:58 +02:00
|
|
|
}
|
|
|
|
}
|
2016-05-16 21:41:37 +02:00
|
|
|
}
|