Skip to content

Commit

Permalink
test: module loading error fix solaris #3798
Browse files Browse the repository at this point in the history
- refactor test to accept multiple error messages per platform
- add new message to be found in Solaris 11.3 as per #3798

PR-URL: #3855
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
  • Loading branch information
fansworld-claudio authored and rvagg committed Dec 4, 2015
1 parent 7b294bb commit 654192f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions test/parallel/test-module-loading-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ var assert = require('assert');
console.error('load test-module-loading-error.js');

var error_desc = {
win32: '%1 is not a valid Win32 application',
linux: 'file too short',
sunos: 'unknown file type'
win32: ['%1 is not a valid Win32 application'],
linux: ['file too short', 'Exec format error'],
sunos: ['unknown file type', 'not an ELF file']
};
var musl_errno_enoexec = 'Exec format error';

var dlerror_msg = error_desc[process.platform];

if (!dlerror_msg) {
Expand All @@ -21,11 +19,9 @@ if (!dlerror_msg) {
try {
require('../fixtures/module-loading-error.node');
} catch (e) {
if (process.platform === 'linux' &&
e.toString().indexOf(musl_errno_enoexec) !== -1) {
dlerror_msg = musl_errno_enoexec;
}
assert.notEqual(e.toString().indexOf(dlerror_msg), -1);
assert.strictEqual(dlerror_msg.some((errMsgCase) => {
return e.toString().indexOf(errMsgCase) !== -1;
}), true);
}

try {
Expand Down

0 comments on commit 654192f

Please sign in to comment.