From 18d3d9fae4412ff3f702228487aeb8ca5d8444ec Mon Sep 17 00:00:00 2001 From: Hugues Malphettes Date: Tue, 10 Nov 2015 09:50:31 +0800 Subject: [PATCH] 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. --- test/parallel/test-module-loading-error.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 3756953a40dc3c..7b96cd06e2393a 100644 --- a/test/parallel/test-module-loading-error.js +++ b/test/parallel/test-module-loading-error.js @@ -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]; @@ -20,6 +21,9 @@ if (!dlerror_msg) { try { require('../fixtures/module-loading-error.node'); } catch (e) { + if (platform === 'linux' && e.toString().indexOf(musl_errno_enoexec) !== -1) { + dlerror_msg = musl_errno_enoexec; + } assert.notEqual(e.toString().indexOf(dlerror_msg), -1); }