[Tarantool-patches] [PATCH luajit 2/6] test: adjust lua-Harness test suite for Tarantool

Igor Munkin imun at tarantool.org
Mon Mar 15 16:22:26 MSK 2021


Sergey,

Thanks for the patch, though it's almost excess...

On 12.03.21, Sergey Kaplun wrote:
> This patch makes it possible to run lua-Harness test suite using
> Tarantool.
> 
> Tarantool has its own loaded tap built in so need to change name to
> another one.

You can simply remove Tarantool TAP module from package.loaded in
test/luajit-test-init.lua (and move it out of the Debug condition
preliminary). See the incremental patches for both LuaJIT and Tarantool
repos at the end.

> 
> 203-lexico.t and 301-basic.t is adjusted to valid working with
> out-of-source build in Tarantool CI.

Your solution works, but it's too specific for our case. Consider the
following: one need to run lua-Harness suite outside from its source
tree. He faces the same issue, so I believe it's better to tweak the
test the next way (the patch is incremental for your branch).

================================================================================

diff --git a/test/lua-Harness-tests/203-lexico.t b/test/lua-Harness-tests/203-lexico.t
index be67a440..8ac140b2 100755
--- a/test/lua-Harness-tests/203-lexico.t
+++ b/test/lua-Harness-tests/203-lexico.t
@@ -117,24 +117,26 @@ do
     like(msg, "^[^:]+:%d+: unfinished long comment .-near")
 end
 
--- Adapt tests for testing with Tarantool's out of source build
--- on read only file system. CUR_SOURCE_DIR is set via CMake.
-local path_to_sources = os.getenv('CUR_SOURCE_DIR') .. '/'
+-- XXX: If this test is run out of the tests source tree, the
+-- relative paths below become invalid. Hence, we need to prepend
+-- the directory from the script (i.e. test) name to the auxiliary
+-- files to be loaded and executed.
+local cwd = arg[0]:gsub('([^/]+)%.t$', '')
 
 if _VERSION >= 'Lua 5.2' or jit then
-    dofile(path_to_sources .. 'lexico52/lexico.t')
+    dofile(cwd .. 'lexico52/lexico.t')
 end
 
 if _VERSION >= 'Lua 5.3' or luajit21 then
-    dofile(path_to_sources .. 'lexico53/lexico.t')
+    dofile(cwd .. 'lexico53/lexico.t')
 end
 
 if _VERSION >= 'Lua 5.4' then
-    dofile(path_to_sources .. 'lexico54/lexico.t')
+    dofile(cwd .. 'lexico54/lexico.t')
 end
 
 if jit and pcall(require, 'ffi') then
-    dofile(path_to_sources .. 'lexicojit/lexico.t')
+    dofile(cwd .. 'lexicojit/lexico.t')
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/301-basic.t b/test/lua-Harness-tests/301-basic.t
index 0489c707..55b10ce7 100755
--- a/test/lua-Harness-tests/301-basic.t
+++ b/test/lua-Harness-tests/301-basic.t
@@ -843,10 +843,11 @@ do -- xpcall
 end
 
 if jit and pcall(require, 'ffi') then
-    -- Adapt test for testing with Tarantool's out of source build
-    -- on read only file system. CUR_SOURCE_DIR is set via CMake.
-    local path_to_sources = os.getenv('CUR_SOURCE_DIR')
-    dofile(path_to_sources .. '/lexicojit/basic.t')
+    -- XXX: If this test is run out of the tests source tree, the
+    -- relative paths below become invalid. Hence, we need to
+    -- prepend the directory from the script (i.e. test) name to
+    -- the auxiliary files to be loaded and executed.
+    dofile(arg[0]:gsub('([^/]+)%.t$', '') .. 'lexicojit/basic.t')
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt
index e62f2d12..77ad9c21 100644
--- a/test/lua-Harness-tests/CMakeLists.txt
+++ b/test/lua-Harness-tests/CMakeLists.txt
@@ -42,9 +42,6 @@ add_custom_command(TARGET lua-Harness-tests
     # for more info.
     # So use less preferable way for tests.
     # See the root CMakeLists.txt for more info.
-    # XXX: Adapt to run test witht Tarantool on read-only
-    # file systems with dofile(CUR_SOURCE_DIR..filename).
-    CUR_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
     ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR}
       --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21'
       --ext ${LUA_TEST_SUFFIX}

================================================================================

Tres bien, n'est-ce pas? You can also propose the patch to Francois in
lua-Harness repo[1].

> 
> Also creates additional list of files provided to prove via stdin.
> This is required to avoid tests hungs via Tarantool's binary.
> Partially this problem is descripted in tarantool/tarantool#5040.

I removed the related changes and rebased the branch on the current
master with resolved #5040 (considering #5040 fixes the issue for all
long-term branches) and CI[2] is green (except the known issues). See
the incremental patches for both LuaJIT and Tarantool repos below.

> 
> Part of tarantool/tarantool#5844
> Part of tarantool/tarantool#4473
> ---
> Author: Mergen Imeev <imeevma at gmail.com>
> 
>  .gitignore                                      |  1 +
>  test/lua-Harness-tests/090-tap.t                |  2 +-
>  test/lua-Harness-tests/091-profile.t            |  2 +-
>  test/lua-Harness-tests/101-boolean.t            |  2 +-
>  test/lua-Harness-tests/102-function.t           |  2 +-
>  test/lua-Harness-tests/103-nil.t                |  2 +-
>  test/lua-Harness-tests/104-number.t             |  2 +-
>  test/lua-Harness-tests/105-string.t             |  2 +-
>  test/lua-Harness-tests/106-table.t              |  2 +-
>  test/lua-Harness-tests/107-thread.t             |  2 +-
>  test/lua-Harness-tests/108-userdata.t           |  2 +-
>  test/lua-Harness-tests/200-examples.t           |  2 +-
>  test/lua-Harness-tests/201-assign.t             |  2 +-
>  test/lua-Harness-tests/202-expr.t               |  2 +-
>  test/lua-Harness-tests/203-lexico.t             | 14 +++++++++-----
>  test/lua-Harness-tests/204-grammar.t            |  2 +-
>  test/lua-Harness-tests/211-scope.t              |  2 +-
>  test/lua-Harness-tests/212-function.t           |  2 +-
>  test/lua-Harness-tests/213-closure.t            |  2 +-
>  test/lua-Harness-tests/214-coroutine.t          |  2 +-
>  test/lua-Harness-tests/221-table.t              |  2 +-
>  test/lua-Harness-tests/222-constructor.t        |  2 +-
>  test/lua-Harness-tests/223-iterator.t           |  2 +-
>  test/lua-Harness-tests/231-metatable.t          |  2 +-
>  test/lua-Harness-tests/232-object.t             |  2 +-
>  test/lua-Harness-tests/241-standalone.t         | 10 +++++-----
>  test/lua-Harness-tests/242-luac.t               |  2 +-
>  test/lua-Harness-tests/301-basic.t              |  7 +++++--
>  test/lua-Harness-tests/303-package.t            |  6 +++---
>  test/lua-Harness-tests/304-string.t             |  2 +-
>  test/lua-Harness-tests/305-utf8.t               |  2 +-
>  test/lua-Harness-tests/306-table.t              |  2 +-
>  test/lua-Harness-tests/307-math.t               |  2 +-
>  test/lua-Harness-tests/308-io.t                 |  2 +-
>  test/lua-Harness-tests/309-os.t                 |  2 +-
>  test/lua-Harness-tests/310-debug.t              |  2 +-
>  test/lua-Harness-tests/311-bit32.t              |  2 +-
>  test/lua-Harness-tests/314-regex.t              |  2 +-
>  test/lua-Harness-tests/320-stdin.t              |  2 +-
>  test/lua-Harness-tests/401-bitop.t              |  2 +-
>  test/lua-Harness-tests/402-ffi.t                |  2 +-
>  test/lua-Harness-tests/403-jit.t                |  2 +-
>  test/lua-Harness-tests/404-ext.t                |  2 +-
>  test/lua-Harness-tests/411-luajit.t             |  2 +-
>  test/lua-Harness-tests/CMakeLists.txt           | 17 +++++++++++++++--
>  .../{tap.lua => tap_harness.lua}                |  0
>  46 files changed, 77 insertions(+), 56 deletions(-)
>  rename test/lua-Harness-tests/{tap.lua => tap_harness.lua} (100%)
> 

<snipped>

> diff --git a/test/lua-Harness-tests/241-standalone.t b/test/lua-Harness-tests/241-standalone.t
> index c5237ee..33d5159 100755
> --- a/test/lua-Harness-tests/241-standalone.t
> +++ b/test/lua-Harness-tests/241-standalone.t

<snipped>

> @@ -228,14 +228,14 @@ end
>  like(f:read'*l', "^usage: ", "no file")
>  f:close()
>  
> -cmd = lua .. [[ -ltap -e "print(type(ok))"]]
> +cmd = lua .. [[ -ltap_harness -e "print(type(ok))"]]

Side note: "Unloading" hack works here, since nothing tap-specific is
used in this test: it checks only third party module loading and nothing
more. BTW, this test is masked in the following patch.

>  f = io.popen(cmd)
> -is(f:read'*l', 'function', "-ltap")
> +is(f:read'*l', 'function', "-ltap_harness")
>  f:close()
>  
> -cmd = lua .. [[ -l tap -e "print(type(ok))"]]
> +cmd = lua .. [[ -l tap_harness -e "print(type(ok))"]]
>  f = io.popen(cmd)
> -is(f:read'*l', 'function', "-l tap")
> +is(f:read'*l', 'function', "-l tap_harness")
>  f:close()
>  
>  cmd = lua .. [[ -l lpeg -e "print(1)" 2>&1]]

<snipped>

> -- 
> 2.28.0

The incremental patch for LuaJIT reverting the renaming:

================================================================================

diff --git a/.gitignore b/.gitignore
index 1fb81bc9..2103a30f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,3 @@ compile_commands.json
 install_manifest.txt
 luajit-parse-memprof
 luajit.pc
-tests_list
diff --git a/test/lua-Harness-tests/090-tap.t b/test/lua-Harness-tests/090-tap.t
index 99932f2e..92f04d8e 100755
--- a/test/lua-Harness-tests/090-tap.t
+++ b/test/lua-Harness-tests/090-tap.t
@@ -22,7 +22,7 @@
 
 ]]
 
-require'tap_harness'
+require'tap'
 
 plan(3)
 ok( true, 'ok' )
diff --git a/test/lua-Harness-tests/091-profile.t b/test/lua-Harness-tests/091-profile.t
index ebc142da..db474384 100755
--- a/test/lua-Harness-tests/091-profile.t
+++ b/test/lua-Harness-tests/091-profile.t
@@ -22,7 +22,7 @@
 
 ]]
 
-require'tap_harness'
+require'tap'
 
 plan'no_plan'
 
diff --git a/test/lua-Harness-tests/101-boolean.t b/test/lua-Harness-tests/101-boolean.t
index 653509f0..0033eff0 100755
--- a/test/lua-Harness-tests/101-boolean.t
+++ b/test/lua-Harness-tests/101-boolean.t
@@ -22,7 +22,7 @@
 
 ]]
 
-require'tap_harness'
+require'tap'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/102-function.t b/test/lua-Harness-tests/102-function.t
index cb7e9d05..48ed814e 100755
--- a/test/lua-Harness-tests/102-function.t
+++ b/test/lua-Harness-tests/102-function.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/103-nil.t b/test/lua-Harness-tests/103-nil.t
index a74c491f..561b1018 100755
--- a/test/lua-Harness-tests/103-nil.t
+++ b/test/lua-Harness-tests/103-nil.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/104-number.t b/test/lua-Harness-tests/104-number.t
index 634d22a0..0d4d3fdb 100755
--- a/test/lua-Harness-tests/104-number.t
+++ b/test/lua-Harness-tests/104-number.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local profile = require'profile'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
diff --git a/test/lua-Harness-tests/105-string.t b/test/lua-Harness-tests/105-string.t
index f2ea067f..cd8c88bf 100755
--- a/test/lua-Harness-tests/105-string.t
+++ b/test/lua-Harness-tests/105-string.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local profile = require'profile'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
diff --git a/test/lua-Harness-tests/106-table.t b/test/lua-Harness-tests/106-table.t
index 4a66f694..0c0ba49b 100755
--- a/test/lua-Harness-tests/106-table.t
+++ b/test/lua-Harness-tests/106-table.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/107-thread.t b/test/lua-Harness-tests/107-thread.t
index e67ef363..3d4af18d 100755
--- a/test/lua-Harness-tests/107-thread.t
+++ b/test/lua-Harness-tests/107-thread.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/108-userdata.t b/test/lua-Harness-tests/108-userdata.t
index 687b1b81..b1e3641a 100755
--- a/test/lua-Harness-tests/108-userdata.t
+++ b/test/lua-Harness-tests/108-userdata.t
@@ -22,7 +22,7 @@
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_op53 = _VERSION >= 'Lua 5.3'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/200-examples.t b/test/lua-Harness-tests/200-examples.t
index cb06a80e..362aae3a 100755
--- a/test/lua-Harness-tests/200-examples.t
+++ b/test/lua-Harness-tests/200-examples.t
@@ -24,7 +24,7 @@ First tests in order to check infrastructure.
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(5)
 
diff --git a/test/lua-Harness-tests/201-assign.t b/test/lua-Harness-tests/201-assign.t
index f7ed4725..7d023d8e 100755
--- a/test/lua-Harness-tests/201-assign.t
+++ b/test/lua-Harness-tests/201-assign.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#3.3.3>
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_env = _VERSION >= 'Lua 5.2'
 
 plan'no_plan'
diff --git a/test/lua-Harness-tests/202-expr.t b/test/lua-Harness-tests/202-expr.t
index f03d5ea3..25767507 100755
--- a/test/lua-Harness-tests/202-expr.t
+++ b/test/lua-Harness-tests/202-expr.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#3.4>
 
 --]]
 
-require'tap_harness'
+require'tap'
 local profile = require'profile'
 local nocvtn2s = profile.nocvtn2s
 local nocvts2n = profile.nocvts2n
diff --git a/test/lua-Harness-tests/203-lexico.t b/test/lua-Harness-tests/203-lexico.t
index 0a73f8cf..be67a440 100755
--- a/test/lua-Harness-tests/203-lexico.t
+++ b/test/lua-Harness-tests/203-lexico.t
@@ -31,7 +31,7 @@ L<https://www.lua.org/manual/5.4/manual.html#3.1>
 
 --]]
 
-require'tap_harness'
+require'tap'
 local loadstring = loadstring or load
 local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
 
diff --git a/test/lua-Harness-tests/204-grammar.t b/test/lua-Harness-tests/204-grammar.t
index 03580f48..d9ae3a6f 100755
--- a/test/lua-Harness-tests/204-grammar.t
+++ b/test/lua-Harness-tests/204-grammar.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#9>
 
 --]]
 
-require'tap_harness'
+require'tap'
 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-tests/211-scope.t b/test/lua-Harness-tests/211-scope.t
index 8e26a6fe..64eed521 100755
--- a/test/lua-Harness-tests/211-scope.t
+++ b/test/lua-Harness-tests/211-scope.t
@@ -30,7 +30,7 @@ See section "Local Variables and Blocks" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(10)
 
diff --git a/test/lua-Harness-tests/212-function.t b/test/lua-Harness-tests/212-function.t
index 405035e2..28510537 100755
--- a/test/lua-Harness-tests/212-function.t
+++ b/test/lua-Harness-tests/212-function.t
@@ -30,7 +30,7 @@ See section "Functions" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 local loadstring = loadstring or load
 
 plan(68)
diff --git a/test/lua-Harness-tests/213-closure.t b/test/lua-Harness-tests/213-closure.t
index 16a8a215..fc3bd29c 100755
--- a/test/lua-Harness-tests/213-closure.t
+++ b/test/lua-Harness-tests/213-closure.t
@@ -24,7 +24,7 @@ See section "Closures" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(15)
 
diff --git a/test/lua-Harness-tests/214-coroutine.t b/test/lua-Harness-tests/214-coroutine.t
index 1ca1cb57..92929e1b 100755
--- a/test/lua-Harness-tests/214-coroutine.t
+++ b/test/lua-Harness-tests/214-coroutine.t
@@ -30,7 +30,7 @@ See section "Coroutines" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 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-tests/221-table.t b/test/lua-Harness-tests/221-table.t
index 07ac9521..c064a339 100755
--- a/test/lua-Harness-tests/221-table.t
+++ b/test/lua-Harness-tests/221-table.t
@@ -24,7 +24,7 @@ See section "Tables" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(25)
 
diff --git a/test/lua-Harness-tests/222-constructor.t b/test/lua-Harness-tests/222-constructor.t
index 28037bfc..a01be2ec 100755
--- a/test/lua-Harness-tests/222-constructor.t
+++ b/test/lua-Harness-tests/222-constructor.t
@@ -30,7 +30,7 @@ See section "Table Constructors" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(16)
 
diff --git a/test/lua-Harness-tests/223-iterator.t b/test/lua-Harness-tests/223-iterator.t
index 073f3cdc..777ad73d 100755
--- a/test/lua-Harness-tests/223-iterator.t
+++ b/test/lua-Harness-tests/223-iterator.t
@@ -25,7 +25,7 @@ section "Coroutines as Iterators" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(8)
 
diff --git a/test/lua-Harness-tests/231-metatable.t b/test/lua-Harness-tests/231-metatable.t
index b94f608a..a2c6499b 100755
--- a/test/lua-Harness-tests/231-metatable.t
+++ b/test/lua-Harness-tests/231-metatable.t
@@ -30,7 +30,7 @@ See section "Metatables and Metamethods" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 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-tests/232-object.t b/test/lua-Harness-tests/232-object.t
index 0d222324..0d875729 100755
--- a/test/lua-Harness-tests/232-object.t
+++ b/test/lua-Harness-tests/232-object.t
@@ -24,7 +24,7 @@ See section "Object-Oriented Programming" in "Programming in Lua".
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 plan(18)
 
diff --git a/test/lua-Harness-tests/241-standalone.t.disabled b/test/lua-Harness-tests/241-standalone.t.disabled
index 33d5159c..c5237eed 100755
--- a/test/lua-Harness-tests/241-standalone.t.disabled
+++ b/test/lua-Harness-tests/241-standalone.t.disabled
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#7>
 
 --]]
 
-require'tap_harness'
+require'tap'
 local has_bytecode = not ujit and not ravi
 local has_error52 = _VERSION >= 'Lua 5.2'
 local has_error53 = _VERSION >= 'Lua 5.3'
@@ -228,14 +228,14 @@ end
 like(f:read'*l', "^usage: ", "no file")
 f:close()
 
-cmd = lua .. [[ -ltap_harness -e "print(type(ok))"]]
+cmd = lua .. [[ -ltap -e "print(type(ok))"]]
 f = io.popen(cmd)
-is(f:read'*l', 'function', "-ltap_harness")
+is(f:read'*l', 'function', "-ltap")
 f:close()
 
-cmd = lua .. [[ -l tap_harness -e "print(type(ok))"]]
+cmd = lua .. [[ -l tap -e "print(type(ok))"]]
 f = io.popen(cmd)
-is(f:read'*l', 'function', "-l tap_harness")
+is(f:read'*l', 'function', "-l tap")
 f:close()
 
 cmd = lua .. [[ -l lpeg -e "print(1)" 2>&1]]
diff --git a/test/lua-Harness-tests/242-luac.t b/test/lua-Harness-tests/242-luac.t
index 9a3a3c3b..a95a334a 100755
--- a/test/lua-Harness-tests/242-luac.t
+++ b/test/lua-Harness-tests/242-luac.t
@@ -28,7 +28,7 @@ L<https://www.lua.org/manual/5.4/manual.html#7>
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 if jit then
     skip_all("LuaJIT")
diff --git a/test/lua-Harness-tests/301-basic.t b/test/lua-Harness-tests/301-basic.t
index 13472cd2..0489c707 100755
--- a/test/lua-Harness-tests/301-basic.t
+++ b/test/lua-Harness-tests/301-basic.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.1>
 
 --]]
 
-require'tap_harness'
+require'tap'
 local profile = require'profile'
 local has_error53 = _VERSION >= 'Lua 5.3'
 local has_gcinfo = _VERSION == 'Lua 5.1'
diff --git a/test/lua-Harness-tests/303-package.t b/test/lua-Harness-tests/303-package.t
index 996ce226..7e5216d8 100755
--- a/test/lua-Harness-tests/303-package.t
+++ b/test/lua-Harness-tests/303-package.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.3>
 
 --]]
 
-require'tap_harness'
+require'tap'
 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_harness', package.path)
+    local p = package.searchpath('tap', package.path)
     type_ok(p, 'string', "searchpath")
-    p = package.searchpath('tap_harness', 'bad path')
+    p = package.searchpath('tap', 'bad path')
     is(p, nil)
 else
     is(package.searchpath, nil, "no package.searchpath")
diff --git a/test/lua-Harness-tests/304-string.t b/test/lua-Harness-tests/304-string.t
index 293fd8e5..991600a7 100755
--- a/test/lua-Harness-tests/304-string.t
+++ b/test/lua-Harness-tests/304-string.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.4>
 
 ]]
 
-require'tap_harness'
+require'tap'
 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
diff --git a/test/lua-Harness-tests/305-utf8.t.disabled b/test/lua-Harness-tests/305-utf8.t.disabled
index 59a2e6bd..4304b6c5 100755
--- a/test/lua-Harness-tests/305-utf8.t.disabled
+++ b/test/lua-Harness-tests/305-utf8.t.disabled
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.5>
 
 --]]
 
-require'tap_harness'
+require 'tap'
 
 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-tests/306-table.t b/test/lua-Harness-tests/306-table.t
index 6e764922..98366556 100755
--- a/test/lua-Harness-tests/306-table.t
+++ b/test/lua-Harness-tests/306-table.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.6>
 
 --]]
 
-require'tap_harness'
+require'tap'
 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-tests/307-math.t b/test/lua-Harness-tests/307-math.t
index 762567fc..8b51ed16 100755
--- a/test/lua-Harness-tests/307-math.t
+++ b/test/lua-Harness-tests/307-math.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.7>
 
 --]]
 
-require'tap_harness'
+require'tap'
 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
diff --git a/test/lua-Harness-tests/308-io.t b/test/lua-Harness-tests/308-io.t
index 1945ce3e..35d39c02 100755
--- a/test/lua-Harness-tests/308-io.t
+++ b/test/lua-Harness-tests/308-io.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.8>
 
 --]]
 
-require'tap_harness'
+require'tap'
 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-tests/309-os.t b/test/lua-Harness-tests/309-os.t
index 6b3ea4d1..87b41ca5 100755
--- a/test/lua-Harness-tests/309-os.t
+++ b/test/lua-Harness-tests/309-os.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.9>
 
 --]]
 
-require'tap_harness'
+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)
diff --git a/test/lua-Harness-tests/310-debug.t b/test/lua-Harness-tests/310-debug.t
index 63194ac3..f78af03f 100755
--- a/test/lua-Harness-tests/310-debug.t
+++ b/test/lua-Harness-tests/310-debug.t
@@ -30,7 +30,7 @@ L<https://www.lua.org/manual/5.4/manual.html#6.10>
 
 ]]
 
-require'tap_harness'
+require 'tap'
 local profile = require'profile'
 local has_getfenv = _VERSION == 'Lua 5.1'
 local has_gethook54 = _VERSION >= 'Lua 5.4'
diff --git a/test/lua-Harness-tests/311-bit32.t b/test/lua-Harness-tests/311-bit32.t
index a314f479..7023906e 100755
--- a/test/lua-Harness-tests/311-bit32.t
+++ b/test/lua-Harness-tests/311-bit32.t
@@ -29,7 +29,7 @@ L<https://www.lua.org/manual/5.2/manual.html#6.7>
 
 --]]
 
-require'tap_harness'
+require 'tap'
 local profile = require'profile'
 local has_bit32 = _VERSION == 'Lua 5.2' or profile.compat52 or profile.has_bit32
 
diff --git a/test/lua-Harness-tests/314-regex.t b/test/lua-Harness-tests/314-regex.t
index ac7ad80e..ad4554cd 100755
--- a/test/lua-Harness-tests/314-regex.t
+++ b/test/lua-Harness-tests/314-regex.t
@@ -49,7 +49,7 @@ Description of the test.
 
 --]]
 
-require'tap_harness'
+require'tap'
 local loadstring = loadstring or load
 
 plan(162)
diff --git a/test/lua-Harness-tests/320-stdin.t b/test/lua-Harness-tests/320-stdin.t
index a0eabcb1..4828285d 100755
--- a/test/lua-Harness-tests/320-stdin.t
+++ b/test/lua-Harness-tests/320-stdin.t
@@ -24,7 +24,7 @@ Tests Lua Basic & IO Libraries with stdin
 
 --]]
 
-require'tap_harness'
+require'tap'
 
 local lua = get_lua_binary_name()
 
diff --git a/test/lua-Harness-tests/401-bitop.t b/test/lua-Harness-tests/401-bitop.t
index d1225bd0..f95aebf3 100755
--- a/test/lua-Harness-tests/401-bitop.t
+++ b/test/lua-Harness-tests/401-bitop.t
@@ -24,7 +24,7 @@ See L<http://bitop.luajit.org/>.
 
 --]]
 
-require'tap_harness'
+require 'tap'
 
 if not jit then
     skip_all("only with LuaJIT")
diff --git a/test/lua-Harness-tests/402-ffi.t b/test/lua-Harness-tests/402-ffi.t
index 2423b2ea..a2e32a54 100755
--- a/test/lua-Harness-tests/402-ffi.t
+++ b/test/lua-Harness-tests/402-ffi.t
@@ -24,7 +24,7 @@ See L<http://luajit.org/ext_ffi.html>.
 
 --]]
 
-require'tap_harness'
+require 'tap'
 
 if not jit then
     skip_all("only with LuaJIT")
diff --git a/test/lua-Harness-tests/403-jit.t b/test/lua-Harness-tests/403-jit.t
index 6c0870a2..0073c90d 100755
--- a/test/lua-Harness-tests/403-jit.t
+++ b/test/lua-Harness-tests/403-jit.t
@@ -24,7 +24,7 @@ See L<http://luajit.org/ext_jit.html>.
 
 --]]
 
-require'tap_harness'
+require 'tap'
 local profile = require'profile'
 
 if not jit then
diff --git a/test/lua-Harness-tests/404-ext.t b/test/lua-Harness-tests/404-ext.t
index 906ed512..22a52c72 100755
--- a/test/lua-Harness-tests/404-ext.t
+++ b/test/lua-Harness-tests/404-ext.t
@@ -24,7 +24,7 @@ See L<http://luajit.org/ext_jit.html>.
 
 --]]
 
-require'tap_harness'
+require 'tap'
 local profile = require'profile'
 
 local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT')
diff --git a/test/lua-Harness-tests/411-luajit.t.disabled b/test/lua-Harness-tests/411-luajit.t.disabled
index b8cb5475..feb752eb 100755
--- a/test/lua-Harness-tests/411-luajit.t.disabled
+++ b/test/lua-Harness-tests/411-luajit.t.disabled
@@ -24,7 +24,7 @@ See L<http://luajit.org/running.html>
 
 --]]
 
-require'tap_harness'
+require'tap'
 local profile = require'profile'
 
 if not jit or ujit then
diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt
index e28cadd9..e62f2d12 100644
--- a/test/lua-Harness-tests/CMakeLists.txt
+++ b/test/lua-Harness-tests/CMakeLists.txt
@@ -10,7 +10,10 @@ if(NOT PROVE)
   return()
 endif()
 
+set(LUA_TEST_SUFFIX .t)
 set(LUA_TEST_FLAGS --failures --shuffle)
+file(GLOB TEST_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/*${LUA_TEST_SUFFIX})
+
 if(CMAKE_VERBOSE_MAKEFILE)
   list(APPEND LUA_TEST_FLAGS --verbose)
 endif()
@@ -26,18 +29,7 @@ string(CONCAT LUA_CPATH
   "${LUAJIT_SOURCE_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;"
 )
 
-# FIXME: Until https://github.com/tarantool/tarantool/issues/5040
-# is resolved, Tarantool enters interactive mode if prove input
-# is not stdin. As a result test hungs and not run at all.
-# This part should be dropped, and argument to prove is passed
-# as directory.
-file(GLOB TESTS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/*.t)
-string(REPLACE ";" "\n" TESTS_LIST "${TESTS_LIST}")
-set(LIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/tests_list)
-file(WRITE ${LIST_FILE} ${TESTS_LIST})
-
-add_custom_target(lua-Harness-tests DEPENDS ${LUAJIT_TEST_BINARY} ${LIST_FILE})
-
+add_custom_target(lua-Harness-tests DEPENDS ${LUAJIT_TEST_BINARY} ${TEST_DEPS})
 add_custom_command(TARGET lua-Harness-tests
   COMMENT "Running lua-Harness tests"
   COMMAND
@@ -53,8 +45,9 @@ add_custom_command(TARGET lua-Harness-tests
     # XXX: Adapt to run test witht Tarantool on read-only
     # file systems with dofile(CUR_SOURCE_DIR..filename).
     CUR_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-    ${PROVE} - < ${LIST_FILE}
+    ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR}
       --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21'
+      --ext ${LUA_TEST_SUFFIX}
       ${LUA_TEST_FLAGS}
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 )
diff --git a/test/lua-Harness-tests/tap_harness.lua b/test/lua-Harness-tests/tap.lua
similarity index 100%
rename from test/lua-Harness-tests/tap_harness.lua
rename to test/lua-Harness-tests/tap.lua

================================================================================

The incremental patch for Tarantool "unloading" its tap:

================================================================================

diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index 1c05e085b..e00817a8f 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -40,16 +40,18 @@ set(LUAJIT_TEST_BINARY $<TARGET_FILE:tarantool> CACHE STRING
 set(LUAJIT_USE_TEST OFF CACHE BOOL
     "Generate <test> target" FORCE)
 
-# Enable internal LuaJIT assertions for Tarantool Debug build.
 # XXX: There is <strict> module enabled by default in Tarantool
 # built in Debug, so we need to tweak LuaJIT testing environment.
+# TODO: Drop a few words regarding TAP.
+set(LUAJIT_TEST_INIT "${PROJECT_SOURCE_DIR}/test/luajit-test-init.lua"
+    CACHE STRING "Lua code need to be run before tests are started" FORCE)
+
+# Enable internal LuaJIT assertions for Tarantool Debug build.
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(LUAJIT_USE_APICHECK ON CACHE BOOL
         "Assertions for the Lua/C API" FORCE)
     set(LUAJIT_USE_ASSERT ON CACHE BOOL
         "Assertions for the whole LuaJIT VM" FORCE)
-    set(LUAJIT_TEST_INIT "${PROJECT_SOURCE_DIR}/test/luajit-test-init.lua"
-        CACHE STRING "Lua code need to be run before tests are started" FORCE)
 endif()
 
 # Valgrind can be used only with the system allocator. For more
diff --git a/test/luajit-test-init.lua b/test/luajit-test-init.lua
index a529e9d8a..199d34f3f 100644
--- a/test/luajit-test-init.lua
+++ b/test/luajit-test-init.lua
@@ -1,6 +1,9 @@
 -- Disable strict for Tarantool.
 require("strict").off()
 
+-- TODO: Drop a few words regarding this.
+package.loaded.tap = nil
+
 -- Add `strict.off()` to `progname` command, that runs child tests
 -- in some LuaJIT test suites to disable strict there too.
 -- Quotes type is important.

================================================================================

> 

[1]: https://framagit.org/fperrad/lua-Harness
[2]: https://github.com/tarantool/tarantool/commit/b4f2911

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list