[Tarantool-patches] [PATCH] test: fix dynamic modules loading on macOS

Sergey Kaplun skaplun at tarantool.org
Wed Dec 29 14:58:10 MSK 2021


Since the auxiliary libraries are built as dynamically loaded modules on
macOS instead of shared libraries as it is done on Linux and BSD,
another environment variable should be used to guide `ffi.load()` while
searching the extension. Hence the paths are set in test need to be set
to `DYLD_LIBRARY_PATH` variable instead of `LD_LIBRARY_PATH` on macOS.
---

Branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-fix-macos-fiber-switch-test-full-ci

 .../gh-1700-abort-recording-on-fiber-switch.test.lua        | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua b/test/app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua
index 7b9156c22..47408e5b8 100755
--- a/test/app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua
+++ b/test/app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua
@@ -25,17 +25,19 @@ if #arg == 0 then
 
   test:plan(#checks)
 
+  local libext = package.cpath:match('?.(%a+);')
   local vars = {
     LUABIN = arg[-1],
     SCRIPT = arg[0],
     -- To support out-of-source build use relative paths in repo
     PATH   = arg[-1]:gsub('src/tarantool$', 'test/app-tap'),
-    SUFFIX = package.cpath:match('?.(%a+);'),
+    SUFFIX = libext,
   }
 
   local cmd = string.gsub('LUA_CPATH="$LUA_CPATH;<PATH>/?.<SUFFIX>" ' ..
                           'LUA_PATH="$LUA_PATH;<PATH>/?.lua" ' ..
-                          'LD_LIBRARY_PATH=<PATH> ' ..
+                          ((libext == 'dylib' and 'DYLD' or 'LD') ..
+                           '_LIBRARY_PATH=<PATH> ') ..
                           '<LUABIN> 2>&1 <SCRIPT>', '%<(%w+)>', vars)
 
   for _, ch in pairs(checks) do
-- 
2.34.1



More information about the Tarantool-patches mailing list