[Tarantool-patches] [PATCH v1 2/5] tests: adjust tests for Tarantool
imeevma at tarantool.org
imeevma at tarantool.org
Tue Jan 19 19:58:21 MSK 2021
This patch makes it possible to run lua-Harness test suite using
Tarantool.
Part of tarantool/tarantool#4064
Part of tarantool/tarantool#4473
---
test/lua-Harness/090-tap.t | 2 +-
test/lua-Harness/091-profile.t | 2 +-
test/lua-Harness/101-boolean.t | 2 +-
test/lua-Harness/102-function.t | 2 +-
test/lua-Harness/103-nil.t | 2 +-
test/lua-Harness/104-number.t | 2 +-
test/lua-Harness/105-string.t | 2 +-
test/lua-Harness/106-table.t | 2 +-
test/lua-Harness/107-thread.t | 2 +-
test/lua-Harness/108-userdata.t | 2 +-
test/lua-Harness/200-examples.t | 2 +-
test/lua-Harness/201-assign.t | 6 +--
test/lua-Harness/202-expr.t | 4 +-
test/lua-Harness/203-lexico.t | 2 +-
test/lua-Harness/204-grammar.t | 2 +-
test/lua-Harness/211-scope.t | 2 +-
test/lua-Harness/212-function.t | 2 +-
test/lua-Harness/213-closure.t | 2 +-
test/lua-Harness/214-coroutine.t | 2 +-
test/lua-Harness/221-table.t | 2 +-
test/lua-Harness/222-constructor.t | 2 +-
test/lua-Harness/223-iterator.t | 2 +-
test/lua-Harness/231-metatable.t | 2 +-
test/lua-Harness/232-object.t | 2 +-
test/lua-Harness/241-standalone.t | 20 ++++-----
test/lua-Harness/242-luac.t | 2 +-
test/lua-Harness/301-basic.t | 14 +++---
test/lua-Harness/303-package.t | 10 ++---
test/lua-Harness/304-string.t | 4 +-
test/lua-Harness/305-utf8.t | 2 +-
test/lua-Harness/306-table.t | 2 +-
test/lua-Harness/307-math.t | 4 +-
test/lua-Harness/308-io.t | 2 +-
test/lua-Harness/309-os.t | 2 +-
test/lua-Harness/310-debug.t | 2 +-
test/lua-Harness/311-bit32.t | 4 +-
test/lua-Harness/314-regex.t | 2 +-
test/lua-Harness/320-stdin.t | 9 ++--
test/lua-Harness/401-bitop.t | 2 +-
test/lua-Harness/402-ffi.t | 4 +-
test/lua-Harness/403-jit.t | 4 +-
test/lua-Harness/404-ext.t | 2 +-
test/lua-Harness/411-luajit.t | 4 +-
test/lua-Harness/CMakeLists.txt | 2 +-
test/lua-Harness/{tap.lua => tap_local.lua} | 11 ++++-
test/lua-Harness/tests_list | 50 +++++++++++++++++++++
46 files changed, 135 insertions(+), 77 deletions(-)
rename test/lua-Harness/{tap.lua => tap_local.lua} (95%)
create mode 100644 test/lua-Harness/tests_list
diff --git a/test/lua-Harness/090-tap.t b/test/lua-Harness/090-tap.t
index 92f04d8..3492e52 100755
--- a/test/lua-Harness/090-tap.t
+++ b/test/lua-Harness/090-tap.t
@@ -22,7 +22,7 @@
]]
-require'tap'
+require'tap_local'
plan(3)
ok( true, 'ok' )
diff --git a/test/lua-Harness/091-profile.t b/test/lua-Harness/091-profile.t
index db47438..2e34bd4 100755
--- a/test/lua-Harness/091-profile.t
+++ b/test/lua-Harness/091-profile.t
@@ -22,7 +22,7 @@
]]
-require'tap'
+require'tap_local'
plan'no_plan'
diff --git a/test/lua-Harness/101-boolean.t b/test/lua-Harness/101-boolean.t
index 0033eff..3be968b 100755
--- a/test/lua-Harness/101-boolean.t
+++ b/test/lua-Harness/101-boolean.t
@@ -22,7 +22,7 @@
]]
-require'tap'
+require'tap_local'
local has_op53 = _VERSION >= 'Lua 5.3'
plan'no_plan'
diff --git a/test/lua-Harness/102-function.t b/test/lua-Harness/102-function.t
index 48ed814..73a3a7c 100755
--- a/test/lua-Harness/102-function.t
+++ b/test/lua-Harness/102-function.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local has_op53 = _VERSION >= 'Lua 5.3'
plan'no_plan'
diff --git a/test/lua-Harness/103-nil.t b/test/lua-Harness/103-nil.t
index 561b101..56cba00 100755
--- a/test/lua-Harness/103-nil.t
+++ b/test/lua-Harness/103-nil.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local has_op53 = _VERSION >= 'Lua 5.3'
plan'no_plan'
diff --git a/test/lua-Harness/104-number.t b/test/lua-Harness/104-number.t
index 0d4d3fd..0d038c4 100755
--- a/test/lua-Harness/104-number.t
+++ b/test/lua-Harness/104-number.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local has_op53 = _VERSION >= 'Lua 5.3'
diff --git a/test/lua-Harness/105-string.t b/test/lua-Harness/105-string.t
index cd8c88b..b45bf69 100755
--- a/test/lua-Harness/105-string.t
+++ b/test/lua-Harness/105-string.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local has_op53 = _VERSION >= 'Lua 5.3'
diff --git a/test/lua-Harness/106-table.t b/test/lua-Harness/106-table.t
index 0c0ba49..9c360eb 100755
--- a/test/lua-Harness/106-table.t
+++ b/test/lua-Harness/106-table.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local has_op53 = _VERSION >= 'Lua 5.3'
plan'no_plan'
diff --git a/test/lua-Harness/107-thread.t b/test/lua-Harness/107-thread.t
index 3d4af18..623ea41 100755
--- a/test/lua-Harness/107-thread.t
+++ b/test/lua-Harness/107-thread.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local has_op53 = _VERSION >= 'Lua 5.3'
plan'no_plan'
diff --git a/test/lua-Harness/108-userdata.t b/test/lua-Harness/108-userdata.t
index b1e3641..9956670 100755
--- a/test/lua-Harness/108-userdata.t
+++ b/test/lua-Harness/108-userdata.t
@@ -22,7 +22,7 @@
--]]
-require'tap'
+require'tap_local'
local has_op53 = _VERSION >= 'Lua 5.3'
plan'no_plan'
diff --git a/test/lua-Harness/200-examples.t b/test/lua-Harness/200-examples.t
index 362aae3..3a1f7cc 100755
--- a/test/lua-Harness/200-examples.t
+++ b/test/lua-Harness/200-examples.t
@@ -24,7 +24,7 @@ First tests in order to check infrastructure.
--]]
-require'tap'
+require'tap_local'
plan(5)
diff --git a/test/lua-Harness/201-assign.t b/test/lua-Harness/201-assign.t
index 7d023d8..f4e5e3e 100755
--- a/test/lua-Harness/201-assign.t
+++ b/test/lua-Harness/201-assign.t
@@ -28,13 +28,13 @@ L<https://www.lua.org/manual/5.4/manual.html#3.3.3>
--]]
-require'tap'
+require'tap_local'
local has_env = _VERSION >= 'Lua 5.2'
plan'no_plan'
do
- is(b, nil, "global variable")
+ is(variable_exists('b'), nil, "global variable")
b = 10
is(b, 10)
if has_env then
@@ -43,7 +43,7 @@ do
error_like([[ _ENV = nil; b = 20 ]],
"attempt to ")
else
- is(_ENV, nil, "no _ENV");
+ is(variable_exists('_ENV'), nil, "no _ENV");
end
b = nil
is(b, nil)
diff --git a/test/lua-Harness/202-expr.t b/test/lua-Harness/202-expr.t
index 2576750..810b570 100755
--- a/test/lua-Harness/202-expr.t
+++ b/test/lua-Harness/202-expr.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#3.4>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local nocvtn2s = profile.nocvtn2s
local nocvts2n = profile.nocvts2n
@@ -101,7 +101,7 @@ if not nocvtn2s then
end
error_like(function () return 'hello' + 1 end,
- ((not nocvts2n and _VERSION >= 'Lua 5.4') or ravi) and "attempt to add" or "perform arithmetic",
+ ((not nocvts2n and _VERSION >= 'Lua 5.4') or variable_exists('ravi')) and "attempt to add" or "perform arithmetic",
"no coercion")
error_like(function ()
diff --git a/test/lua-Harness/203-lexico.t b/test/lua-Harness/203-lexico.t
index c1abebf..3c127b9 100755
--- a/test/lua-Harness/203-lexico.t
+++ b/test/lua-Harness/203-lexico.t
@@ -31,7 +31,7 @@ L<https://www.lua.org/manual/5.4/manual.html#3.1>
--]]
-require'tap'
+require'tap_local'
local loadstring = loadstring or load
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
diff --git a/test/lua-Harness/204-grammar.t b/test/lua-Harness/204-grammar.t
index d9ae3a6..197f9d9 100755
--- a/test/lua-Harness/204-grammar.t
+++ b/test/lua-Harness/204-grammar.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#9>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local has_goto = _VERSION >= 'Lua 5.2' or jit
local has_attr = _VERSION >= 'Lua 5.4'
diff --git a/test/lua-Harness/211-scope.t b/test/lua-Harness/211-scope.t
index 64eed52..3f02bab 100755
--- a/test/lua-Harness/211-scope.t
+++ b/test/lua-Harness/211-scope.t
@@ -30,7 +30,7 @@ See section "Local Variables and Blocks" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
plan(10)
diff --git a/test/lua-Harness/212-function.t b/test/lua-Harness/212-function.t
index 2851053..6841308 100755
--- a/test/lua-Harness/212-function.t
+++ b/test/lua-Harness/212-function.t
@@ -30,7 +30,7 @@ See section "Functions" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
local loadstring = loadstring or load
plan(68)
diff --git a/test/lua-Harness/213-closure.t b/test/lua-Harness/213-closure.t
index fc3bd29..c0b6fb5 100755
--- a/test/lua-Harness/213-closure.t
+++ b/test/lua-Harness/213-closure.t
@@ -24,7 +24,7 @@ See section "Closures" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
plan(15)
diff --git a/test/lua-Harness/214-coroutine.t b/test/lua-Harness/214-coroutine.t
index 92929e1..28c18ab 100755
--- a/test/lua-Harness/214-coroutine.t
+++ b/test/lua-Harness/214-coroutine.t
@@ -30,7 +30,7 @@ See section "Coroutines" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
local has_coroutine52 = _VERSION >= 'Lua 5.2' or jit
diff --git a/test/lua-Harness/221-table.t b/test/lua-Harness/221-table.t
index 7ed6c65..4894d7e 100755
--- a/test/lua-Harness/221-table.t
+++ b/test/lua-Harness/221-table.t
@@ -24,7 +24,7 @@ See section "Tables" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
plan(25)
diff --git a/test/lua-Harness/222-constructor.t b/test/lua-Harness/222-constructor.t
index a01be2e..79ed80c 100755
--- a/test/lua-Harness/222-constructor.t
+++ b/test/lua-Harness/222-constructor.t
@@ -30,7 +30,7 @@ See section "Table Constructors" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
plan(16)
diff --git a/test/lua-Harness/223-iterator.t b/test/lua-Harness/223-iterator.t
index 777ad73..501588e 100755
--- a/test/lua-Harness/223-iterator.t
+++ b/test/lua-Harness/223-iterator.t
@@ -25,7 +25,7 @@ section "Coroutines as Iterators" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
plan(8)
diff --git a/test/lua-Harness/231-metatable.t b/test/lua-Harness/231-metatable.t
index a2c6499..09412db 100755
--- a/test/lua-Harness/231-metatable.t
+++ b/test/lua-Harness/231-metatable.t
@@ -30,7 +30,7 @@ See section "Metatables and Metamethods" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local has_metamethod52 = _VERSION >= 'Lua 5.2' or profile.luajit_compat52
local has_metamethod_ipairs = _VERSION == 'Lua 5.2' or profile.compat52 or profile.luajit_compat52
diff --git a/test/lua-Harness/232-object.t b/test/lua-Harness/232-object.t
index 0d87572..e54258e 100755
--- a/test/lua-Harness/232-object.t
+++ b/test/lua-Harness/232-object.t
@@ -24,7 +24,7 @@ See section "Object-Oriented Programming" in "Programming in Lua".
--]]
-require'tap'
+require'tap_local'
plan(18)
diff --git a/test/lua-Harness/241-standalone.t b/test/lua-Harness/241-standalone.t
index c99f324..c6e5b69 100755
--- a/test/lua-Harness/241-standalone.t
+++ b/test/lua-Harness/241-standalone.t
@@ -28,8 +28,8 @@ L<https://www.lua.org/manual/5.4/manual.html#7>
--]]
-require'tap'
-local has_bytecode = not ujit and not ravi
+require'tap_local'
+local has_bytecode = not variable_exists('ujit') and not variable_exists('ravi')
local has_error52 = _VERSION >= 'Lua 5.2'
local has_error53 = _VERSION >= 'Lua 5.3'
local has_opt_E = _VERSION >= 'Lua 5.2' or jit
@@ -37,7 +37,7 @@ local has_opt_W = _VERSION >= 'Lua 5.4'
local banner = '^[%w%s%-%.]-Copyright %(C%) %d%d%d%d'
if jit and jit.version:match'^RaptorJIT' then
banner = '^[%w%s%.]- %-%- '
-elseif ravi then
+elseif variable_exists('ravi') then
banner = '^Ravi %d%.%d%.%d'
end
@@ -108,10 +108,10 @@ f:close()
cmd = lua .. " -i hello-241.lua < hello-241.lua 2>&1"
f = io.popen(cmd)
like(f:read'*l', banner, "-i")
-if ujit then
+if variable_exists('ujit') then
like(f:read'*l', '^JIT:')
end
-if ravi then
+if variable_exists('ravi') then
like(f:read'*l', '^Copyright %(C%)')
like(f:read'*l', '^Portions Copyright %(C%)')
like(f:read'*l', '^Options')
@@ -190,7 +190,7 @@ f:close()
cmd = lua .. [[ -v hello-241.lua 2>&1]]
f = io.popen(cmd)
like(f:read'*l', banner, "-v & script")
-if ravi then
+if variable_exists('ravi') then
like(f:read'*l', '^Copyright %(C%)')
like(f:read'*l', '^Portions Copyright %(C%)')
like(f:read'*l', '^Options')
@@ -228,14 +228,14 @@ end
like(f:read'*l', "^usage: ", "no file")
f:close()
-cmd = lua .. [[ -ltap -e "print(type(ok))"]]
+cmd = lua .. [[ -ltap_local -e "print(type(ok))"]]
f = io.popen(cmd)
-is(f:read'*l', 'function', "-ltap")
+is(f:read'*l', 'function', "-ltap_local")
f:close()
-cmd = lua .. [[ -l tap -e "print(type(ok))"]]
+cmd = lua .. [[ -l tap_local -e "print(type(ok))"]]
f = io.popen(cmd)
-is(f:read'*l', 'function', "-l tap")
+is(f:read'*l', 'function', "-l tap_local")
f:close()
cmd = lua .. [[ -l lpeg -e "print(1)" 2>&1]]
diff --git a/test/lua-Harness/242-luac.t b/test/lua-Harness/242-luac.t
index 2d166e5..4755fc3 100755
--- a/test/lua-Harness/242-luac.t
+++ b/test/lua-Harness/242-luac.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#7>
--]]
-require'tap'
+require'tap_local'
if jit then
skip_all("LuaJIT")
diff --git a/test/lua-Harness/301-basic.t b/test/lua-Harness/301-basic.t
index e45599e..c11f21b 100755
--- a/test/lua-Harness/301-basic.t
+++ b/test/lua-Harness/301-basic.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.1>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local has_error53 = _VERSION >= 'Lua 5.3'
local has_gcinfo = _VERSION == 'Lua 5.1'
@@ -300,7 +300,7 @@ end
diag(msg)
end
type_ok(f, 'function', "function load(reader)")
- is(bar, nil)
+ is(variable_exists('bar'), nil)
f()
is(bar('ok'), 'ok')
bar = nil
@@ -324,7 +324,7 @@ end
if _VERSION == 'Lua 5.1' and not jit then
todo("not with 5.1")
end
- is(baz, nil)
+ is(variable_exists('baz'), nil)
t = { [[?syntax error?]] }
i = 0
@@ -388,7 +388,7 @@ end
]]
f:close()
f = loadfile('foo-301.lua')
- is(foo, nil, "function loadfile")
+ is(variable_exists('foo'), nil, "function loadfile")
f()
is(foo('ok'), 'ok')
@@ -559,7 +559,7 @@ if has_rawlen then
"^[^:]+:%d+: bad argument #1 to 'rawlen' %(table ",
"function rawlen (bad arg)")
else
- is(rawlen, nil, "no rawlen")
+ is(variable_exists('rawlen'), nil, "no rawlen")
end
do -- rawget
@@ -686,7 +686,7 @@ do -- type
is(type(true), 'boolean')
is(type(nil), 'nil')
is(type(io.stdin), 'userdata')
- is(type(type(X)), 'string')
+ is(type(type(variable_exists('X'))), 'string')
local a = nil
is(type(a), 'nil', "function type")
@@ -791,7 +791,7 @@ if has_warn then
"^[^:]+:%d+: bad argument #1 to 'warn' %(string expected, got no value%)",
"function warn (no arg)")
else
- is(warn, nil, "no warn")
+ is(variable_exists('warn'), nil, "no warn")
end
do -- xpcall
diff --git a/test/lua-Harness/303-package.t b/test/lua-Harness/303-package.t
index 7e5216d..e9c1e07 100755
--- a/test/lua-Harness/303-package.t
+++ b/test/lua-Harness/303-package.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.3>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
local has_loaders = _VERSION == 'Lua 5.1'
@@ -130,9 +130,9 @@ end
-- searchpath
if has_searcherpath then
- local p = package.searchpath('tap', package.path)
+ local p = package.searchpath('tap_local', package.path)
type_ok(p, 'string', "searchpath")
- p = package.searchpath('tap', 'bad path')
+ p = package.searchpath('tap_local', 'bad path')
is(p, nil)
else
is(package.searchpath, nil, "no package.searchpath")
@@ -265,12 +265,12 @@ if has_module then
package.seeall(m)
m.pass("function package.seeall")
- is(mod, nil, "function module & seeall")
+ is(variable_exists('mod'), nil, "function module & seeall")
module('mod', package.seeall)
type_ok(mod, 'table')
is(mod, package.loaded.mod)
- is(modz, nil, "function module")
+ is(variable_exists('modz'), nil, "function module")
local _G = _G
module('modz')
_G.type_ok(_G.modz, 'table')
diff --git a/test/lua-Harness/304-string.t b/test/lua-Harness/304-string.t
index 991600a..7ca57b7 100755
--- a/test/lua-Harness/304-string.t
+++ b/test/lua-Harness/304-string.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.4>
]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
local has_dump53 = _VERSION >= 'Lua 5.3' or jit
@@ -396,7 +396,7 @@ do -- gsub
function expand (str)
return (string.gsub(str, '$(%w+)', function (n)
- return tostring(_G[n]), 1
+ return tostring(variable_exists(n)), 1
end))
end
like(expand("print = $print; a = $a"), "^print = function: [0]?[Xx]?[builtin]*#?%x+; a = nil")
diff --git a/test/lua-Harness/305-utf8.t b/test/lua-Harness/305-utf8.t
index 4304b6c..14a7a28 100755
--- a/test/lua-Harness/305-utf8.t
+++ b/test/lua-Harness/305-utf8.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.5>
--]]
-require 'tap'
+require'tap_local'
local profile = require'profile'
local has_utf8 = _VERSION >= 'Lua 5.3' or (jit and jit.version:match'moonjit') or profile.utf8
diff --git a/test/lua-Harness/306-table.t b/test/lua-Harness/306-table.t
index 9836655..59293f1 100755
--- a/test/lua-Harness/306-table.t
+++ b/test/lua-Harness/306-table.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.6>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
local has_foreach = _VERSION == 'Lua 5.1'
diff --git a/test/lua-Harness/307-math.t b/test/lua-Harness/307-math.t
index 8b51ed1..1a49bcf 100755
--- a/test/lua-Harness/307-math.t
+++ b/test/lua-Harness/307-math.t
@@ -30,14 +30,14 @@ L<https://www.lua.org/manual/5.4/manual.html#6.7>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local has_integer = _VERSION >= 'Lua 5.3' or (jit and jit.version:match'moonjit') or profile.integer
local has_mathx = _VERSION < 'Lua 5.3' or profile.compat52 or profile.compat53 or profile.has_mathx
local has_log10 = _VERSION < 'Lua 5.2' or profile.compat51 or profile.has_math_log10 or
profile.compat52 or profile.compat53 or profile.has_mathx
local has_log_with_base = _VERSION >= 'Lua 5.2' or profile.compat52
-local has_mod = profile.has_math_mod or ujit
+local has_mod = profile.has_math_mod or variable_exists('ujit')
local nocvts2n = profile.nocvts2n or jit
plan'no_plan'
diff --git a/test/lua-Harness/308-io.t b/test/lua-Harness/308-io.t
index cdbcb83..3857eb1 100755
--- a/test/lua-Harness/308-io.t
+++ b/test/lua-Harness/308-io.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.8>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
local has_write51 = _VERSION == 'Lua 5.1' and (not profile.luajit_compat52 or ujit)
diff --git a/test/lua-Harness/309-os.t b/test/lua-Harness/309-os.t
index e42fb53..593df26 100755
--- a/test/lua-Harness/309-os.t
+++ b/test/lua-Harness/309-os.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.9>
--]]
-require'tap'
+require'tap_local'
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)
diff --git a/test/lua-Harness/310-debug.t b/test/lua-Harness/310-debug.t
index f78af03..7079ee0 100755
--- a/test/lua-Harness/310-debug.t
+++ b/test/lua-Harness/310-debug.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.10>
]]
-require 'tap'
+require'tap_local'
local profile = require'profile'
local has_getfenv = _VERSION == 'Lua 5.1'
local has_gethook54 = _VERSION >= 'Lua 5.4'
diff --git a/test/lua-Harness/311-bit32.t b/test/lua-Harness/311-bit32.t
index 7023906..a12d669 100755
--- a/test/lua-Harness/311-bit32.t
+++ b/test/lua-Harness/311-bit32.t
@@ -29,11 +29,11 @@ L<https://www.lua.org/manual/5.2/manual.html#6.7>
--]]
-require 'tap'
+require'tap_local'
local profile = require'profile'
local has_bit32 = _VERSION == 'Lua 5.2' or profile.compat52 or profile.has_bit32
-if not bit32 then
+if not variable_exists('bit32') then
plan(1)
nok(has_bit32, "no has_bit32")
os.exit(0)
diff --git a/test/lua-Harness/314-regex.t b/test/lua-Harness/314-regex.t
index ad4554c..315531c 100755
--- a/test/lua-Harness/314-regex.t
+++ b/test/lua-Harness/314-regex.t
@@ -49,7 +49,7 @@ Description of the test.
--]]
-require'tap'
+require'tap_local'
local loadstring = loadstring or load
plan(162)
diff --git a/test/lua-Harness/320-stdin.t b/test/lua-Harness/320-stdin.t
index 36528e8..0af83c3 100755
--- a/test/lua-Harness/320-stdin.t
+++ b/test/lua-Harness/320-stdin.t
@@ -24,7 +24,7 @@ Tests Lua Basic & IO Libraries with stdin
--]]
-require'tap'
+require'tap_local'
local lua = arg[-3] or arg[-1]
@@ -32,7 +32,7 @@ if not pcall(io.popen, lua .. [[ -e "a=1"]]) then
skip_all "io.popen not supported"
end
-plan(12)
+plan(11)
do
local f = io.open('lib-320.lua', 'w')
@@ -64,10 +64,9 @@ end
]]
f:close()
- local cmd = lua .. [[ -e "f = loadfile(); print(foo); f(); print(foo('ok'))" < foo-320.lua]]
+ local cmd = lua .. [[ -e "f = loadfile(); f(); print(foo('ok'))" < foo-320.lua]]
f = io.popen(cmd)
- is(f:read'*l', 'nil', "function loadfile (stdin)")
- is(f:read'*l', 'ok')
+ is(f:read'*l', 'ok', "function loadfile (stdin)")
f:close()
os.remove('foo-320.lua') -- clean up
diff --git a/test/lua-Harness/401-bitop.t b/test/lua-Harness/401-bitop.t
index f95aebf..2856e3d 100755
--- a/test/lua-Harness/401-bitop.t
+++ b/test/lua-Harness/401-bitop.t
@@ -24,7 +24,7 @@ See L<http://bitop.luajit.org/>.
--]]
-require 'tap'
+require'tap_local'
if not jit then
skip_all("only with LuaJIT")
diff --git a/test/lua-Harness/402-ffi.t b/test/lua-Harness/402-ffi.t
index a2e32a5..d61ee12 100755
--- a/test/lua-Harness/402-ffi.t
+++ b/test/lua-Harness/402-ffi.t
@@ -24,7 +24,7 @@ See L<http://luajit.org/ext_ffi.html>.
--]]
-require 'tap'
+require'tap_local'
if not jit then
skip_all("only with LuaJIT")
@@ -39,7 +39,7 @@ end
plan(33)
-is(_G.ffi, nil, "ffi not loaded by default")
+is(variable_exists('ffi'), nil, "ffi not loaded by default")
ffi = require'ffi'
is(package.loaded.ffi, ffi, "package.loaded")
is(require'ffi', ffi, "require")
diff --git a/test/lua-Harness/403-jit.t b/test/lua-Harness/403-jit.t
index 0073c90..95f4031 100755
--- a/test/lua-Harness/403-jit.t
+++ b/test/lua-Harness/403-jit.t
@@ -24,7 +24,7 @@ See L<http://luajit.org/ext_jit.html>.
--]]
-require 'tap'
+require'tap_local'
local profile = require'profile'
if not jit then
@@ -35,7 +35,7 @@ local compiled_with_jit = jit.status()
local luajit20 = jit.version_num < 20100 and not jit.version:match'RaptorJIT'
local has_jit_opt = compiled_with_jit
local has_jit_security = jit.security
-local has_jit_util = not ujit and not jit.version:match'RaptorJIT'
+local has_jit_util = not variable_exists('ujit') and not jit.version:match'RaptorJIT'
plan'no_plan'
diff --git a/test/lua-Harness/404-ext.t b/test/lua-Harness/404-ext.t
index 22a52c7..9ed93dd 100755
--- a/test/lua-Harness/404-ext.t
+++ b/test/lua-Harness/404-ext.t
@@ -24,7 +24,7 @@ See L<http://luajit.org/ext_jit.html>.
--]]
-require 'tap'
+require'tap_local'
local profile = require'profile'
local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
diff --git a/test/lua-Harness/411-luajit.t b/test/lua-Harness/411-luajit.t
index 05111be..bd09211 100755
--- a/test/lua-Harness/411-luajit.t
+++ b/test/lua-Harness/411-luajit.t
@@ -24,10 +24,10 @@ See L<http://luajit.org/running.html>
--]]
-require'tap'
+require'tap_local'
local profile = require'profile'
-if not jit or ujit then
+if not jit or variable_exists('ujit') then
skip_all("only with LuaJIT")
end
diff --git a/test/lua-Harness/CMakeLists.txt b/test/lua-Harness/CMakeLists.txt
index 840a2f5..30077c0 100644
--- a/test/lua-Harness/CMakeLists.txt
+++ b/test/lua-Harness/CMakeLists.txt
@@ -18,7 +18,7 @@ add_custom_command(
env
LUA_PATH="./?.lua\;${LUAJIT_SOURCE_DIR}/?.lua\;\;"
LUA_CPATH="./?${CMAKE_SHARED_LIBRARY_SUFFIX}\;${LUAJIT_SOURCE_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;\;"
- ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR}
+ ${PROVE} - < tests_list
--exec "${LUAJIT_TEST_BINARY} -l profile_luajit21"
--failures --shuffle
&& touch tests.ok
diff --git a/test/lua-Harness/tap.lua b/test/lua-Harness/tap_local.lua
similarity index 95%
rename from test/lua-Harness/tap.lua
rename to test/lua-Harness/tap_local.lua
index 96afec7..4ad0dbd 100644
--- a/test/lua-Harness/tap.lua
+++ b/test/lua-Harness/tap_local.lua
@@ -39,7 +39,7 @@ function done_testing ()
end
function skip_all (reason)
- out = "1..0"
+ local out = "1..0"
if reason then
out = out .. " # SKIP " .. reason
end
@@ -196,6 +196,15 @@ function todo (reason, count)
todo_reason = reason
end
+function variable_exists (name)
+ for k,_ in pairs(_G) do
+ if (k == name) then
+ return _G[name]
+ end
+ end
+ return nil
+end
+
--
-- Copyright (c) 2009-2018 Francois Perrad
--
diff --git a/test/lua-Harness/tests_list b/test/lua-Harness/tests_list
new file mode 100644
index 0000000..7a7e2d1
--- /dev/null
+++ b/test/lua-Harness/tests_list
@@ -0,0 +1,50 @@
+000-sanity.t
+001-if.t
+002-table.t
+011-while.t
+012-repeat.t
+014-fornum.t
+015-forlist.t
+090-tap.t
+091-profile.t
+101-boolean.t
+102-function.t
+103-nil.t
+104-number.t
+105-string.t
+106-table.t
+107-thread.t
+108-userdata.t
+200-examples.t
+201-assign.t
+202-expr.t
+203-lexico.t
+204-grammar.t
+211-scope.t
+212-function.t
+213-closure.t
+214-coroutine.t
+221-table.t
+222-constructor.t
+223-iterator.t
+231-metatable.t
+232-object.t
+241-standalone.t
+242-luac.t
+301-basic.t
+303-package.t
+304-string.t
+305-utf8.t
+306-table.t
+307-math.t
+308-io.t
+309-os.t
+310-debug.t
+311-bit32.t
+314-regex.t
+320-stdin.t
+401-bitop.t
+402-ffi.t
+403-jit.t
+404-ext.t
+411-luajit.t
--
2.25.1
More information about the Tarantool-patches
mailing list