Skip to content

Commit

Permalink
test: fix test-module-loading-error for musl
Browse files Browse the repository at this point in the history
When a compiled library file does not have the proper format,
musl returns the error message ENOEXEC as 'Exec format error' but
glibc returns 'file too short' if the file is under a certain size.

Reference:
http://git.musl-libc.org/cgit/musl/tree/src/errno/__strerror.h#n46

This patch consists of tolerating musl's error.

PR-URL: #3657
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
  • Loading branch information
hmalphettes authored and Myles Borins committed Nov 17, 2015
1 parent d7b4f75 commit 2570cb7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/parallel/test-module-loading-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var error_desc = {
linux: 'file too short',
sunos: 'unknown file type'
};
var musl_errno_enoexec = 'Exec format error';

var dlerror_msg = error_desc[process.platform];

Expand All @@ -20,6 +21,10 @@ 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);
}

Expand Down

0 comments on commit 2570cb7

Please sign in to comment.