Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Commit

Permalink
Fix test-exception.js for PPC
Browse files Browse the repository at this point in the history
On PPC architectures, --abort_on_uncaught_exception (currently set by
nodereport for the `exception` event) exits with SIGTRAP instead of SIGILL.

PR-URL: #24
Reviewed-By: Richard Chamberlain <richard_chamberlain@uk.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
richardlau authored and rnchamberlain committed Nov 18, 2016
1 parent 9b80f24 commit 6065383
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ exports.findReports = (pid) => {
return files.filter((file) => filePattern.test(file));
};

exports.isPPC = () => {
return process.arch.startsWith('ppc');
};

exports.isWindows = () => {
return process.platform === 'win32';
};

exports.validate = (t, report, pid) => {
t.test('Validating ' + report, (t) => {
fs.readFile(report, (err, data) => {
Expand Down
5 changes: 3 additions & 2 deletions test/test-exception.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ if (process.argv[2] === 'child') {

const child = spawn(process.execPath, [__filename, 'child']);
child.on('exit', (code, signal) => {
const expectedExitCode = process.platform === 'win32' ? 0xC0000005 : null;
const expectedSignal = process.platform === 'win32' ? null : 'SIGILL';
const expectedExitCode = common.isWindows() ? 0xC0000005 : null;
const expectedSignal = common.isWindows() ? null :
common.isPPC() ? 'SIGTRAP' : 'SIGILL';
tap.plan(4);
tap.equal(code, expectedExitCode, 'Process should not exit cleanly');
tap.equal(signal, expectedSignal,
Expand Down
2 changes: 1 addition & 1 deletion test/test-signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if (process.argv[2] === 'child') {
const fork = require('child_process').fork;
const tap = require('tap');

if (process.platform === 'win32') {
if (common.isWindows()) {
tap.fail('Unsupported on Windows', { skip: true });
return;
}
Expand Down

0 comments on commit 6065383

Please sign in to comment.