Skip to content

Commit fcb67dd

Browse files
hmalphettesrvagg
authored andcommitted
test: fix test-module-loading-error for musl
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 <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent 4800198 commit fcb67dd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/parallel/test-module-loading-error.js

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var error_desc = {
99
linux: 'file too short',
1010
sunos: 'unknown file type'
1111
};
12+
var musl_errno_enoexec = 'Exec format error';
1213

1314
var dlerror_msg = error_desc[process.platform];
1415

@@ -20,6 +21,10 @@ if (!dlerror_msg) {
2021
try {
2122
require('../fixtures/module-loading-error.node');
2223
} catch (e) {
24+
if (process.platform === 'linux' &&
25+
e.toString().indexOf(musl_errno_enoexec) !== -1) {
26+
dlerror_msg = musl_errno_enoexec;
27+
}
2328
assert.notEqual(e.toString().indexOf(dlerror_msg), -1);
2429
}
2530

0 commit comments

Comments
 (0)