From 81997840f22cae23f30b1e180216378be2eff9cd 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/3657 Reviewed-By: Ben Noordhuis Reviewed-By: Johan Bergström --- test/parallel/test-module-loading-error.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-module-loading-error.js b/test/parallel/test-module-loading-error.js index 3756953a40dc3c..f2581a4df5bb9f 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,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); }