[Tarantool-patches] [PATCH 1/4] test: resolving program name

Maxim Kokryashkin max.kokryashkin at gmail.com
Mon Jul 5 14:49:42 MSK 2021


From: Maxim Kokryashkin <m.kokryashkin at tarantool.org>

Part of tarantool/tarantool#5970
---
The patch `fperrad/lua-Harness at 1be25a8` from lua-Harness suite is the 
same as the patch `tarantool/luajit at 8376885`, except for 
`get_lua_binary_name()`, which was renamed to `_retrieve_progname()` 
in `fperadd/lua-Harness`.

 test/lua-Harness-tests/241-standalone.t.disabled | 2 +-
 test/lua-Harness-tests/242-luac.t                | 2 +-
 test/lua-Harness-tests/301-basic.t               | 2 +-
 test/lua-Harness-tests/308-io.t                  | 2 +-
 test/lua-Harness-tests/309-os.t                  | 2 +-
 test/lua-Harness-tests/320-stdin.t               | 2 +-
 test/lua-Harness-tests/411-luajit.t.disabled     | 2 +-
 test/lua-Harness-tests/tap.lua                   | 8 ++++++++
 8 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/test/lua-Harness-tests/241-standalone.t.disabled b/test/lua-Harness-tests/241-standalone.t.disabled
index c5237eed..b8b6aa60 100755
--- a/test/lua-Harness-tests/241-standalone.t.disabled
+++ b/test/lua-Harness-tests/241-standalone.t.disabled
@@ -41,7 +41,7 @@ elseif ravi then
     banner = '^Ravi %d%.%d%.%d'
 end
 
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 local luac = jit and lua or (lua .. 'c')
 
 if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
diff --git a/test/lua-Harness-tests/242-luac.t b/test/lua-Harness-tests/242-luac.t
index a95a334a..93c990ed 100755
--- a/test/lua-Harness-tests/242-luac.t
+++ b/test/lua-Harness-tests/242-luac.t
@@ -38,7 +38,7 @@ if ravi then
     skip_all("ravi")
 end
 
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 local luac = lua .. 'c'
 
 if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
diff --git a/test/lua-Harness-tests/301-basic.t b/test/lua-Harness-tests/301-basic.t
index a4bb09ff..a4fe6381 100755
--- a/test/lua-Harness-tests/301-basic.t
+++ b/test/lua-Harness-tests/301-basic.t
@@ -48,7 +48,7 @@ local has_warn = _VERSION >= 'Lua 5.4'
 local has_xpcall52 = _VERSION >= 'Lua 5.2' or jit
 local has_xpcall53 = _VERSION >= 'Lua 5.3' or jit
 
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 
 plan'no_plan'
 
diff --git a/test/lua-Harness-tests/308-io.t b/test/lua-Harness-tests/308-io.t
index 35d39c02..dfe2d832 100755
--- a/test/lua-Harness-tests/308-io.t
+++ b/test/lua-Harness-tests/308-io.t
@@ -40,7 +40,7 @@ local has_read53 = _VERSION >= 'Lua 5.3' or luajit21
 local has_meta53 = _VERSION >= 'Lua 5.3'
 local has_meta54 = _VERSION >= 'Lua 5.4'
 
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 
 plan'no_plan'
 
diff --git a/test/lua-Harness-tests/309-os.t b/test/lua-Harness-tests/309-os.t
index a787b147..8258e8af 100755
--- a/test/lua-Harness-tests/309-os.t
+++ b/test/lua-Harness-tests/309-os.t
@@ -34,7 +34,7 @@ require'tap'
 local profile = require'profile'
 local luajit20 = jit and (jit.version_num < 20100 and not jit.version:match'^RaptorJIT')
 local has_execute51 = _VERSION == 'Lua 5.1' and (not profile.luajit_compat52 or ujit)
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 
 plan'no_plan'
 
diff --git a/test/lua-Harness-tests/320-stdin.t b/test/lua-Harness-tests/320-stdin.t
index 4828285d..8b19c5c5 100755
--- a/test/lua-Harness-tests/320-stdin.t
+++ b/test/lua-Harness-tests/320-stdin.t
@@ -26,7 +26,7 @@ Tests Lua Basic & IO Libraries with stdin
 
 require'tap'
 
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 
 if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
     skip_all "io.popen not supported"
diff --git a/test/lua-Harness-tests/411-luajit.t.disabled b/test/lua-Harness-tests/411-luajit.t.disabled
index feb752eb..25c3ee52 100755
--- a/test/lua-Harness-tests/411-luajit.t.disabled
+++ b/test/lua-Harness-tests/411-luajit.t.disabled
@@ -31,7 +31,7 @@ if not jit or ujit then
     skip_all("only with LuaJIT")
 end
 
-local lua = get_lua_binary_name()
+local lua = _retrieve_progname()
 
 if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
     skip_all("io.popen not supported")
diff --git a/test/lua-Harness-tests/tap.lua b/test/lua-Harness-tests/tap.lua
index a8454ae0..86cca4e0 100644
--- a/test/lua-Harness-tests/tap.lua
+++ b/test/lua-Harness-tests/tap.lua
@@ -9,6 +9,14 @@
 
 ]]
 
+function _retrieve_progname ()
+    local i = 0
+    while arg[i] do
+        i = i - 1
+    end
+    return arg[i + 1]
+end
+
 if pcall(require, 'Test.More') then
     diag 'Test.More loaded'
     return
-- 
2.31.1



More information about the Tarantool-patches mailing list