[Tarantool-patches] [PATCH 2/4] test: out-of-source testing

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


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

Part of tarantool/tarantool#5970

---
The patch `fperrad/lua-Harness at 60da289` is similar to the patch 
`tarantool/luajit at d11c5bb`, but `make_specific_checks()` was 
renamed to `_dofile()` by maintainer. Another difference is that 
it seems like there is no definition for `_dofile()` in mainline 
lua-Harness, so it should be user-defined somewhere. If it is not, 
then `_dofile()` will act like `dofile()`. Considering this, we 
should keep `make_specific_checks` implementation from 
`tarantool/luajit at d11c5bb`, but rename it to `_dofile` and move 
to `tap.lua`.

 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/203-lexico.t    | 8 ++++----
 test/lua-Harness-tests/231-metatable.t | 2 +-
 test/lua-Harness-tests/301-basic.t     | 2 +-
 test/lua-Harness-tests/305-utf8.t      | 2 +-
 test/lua-Harness-tests/404-ext.t       | 2 +-
 test/lua-Harness-tests/tap.lua         | 4 ++++
 14 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/test/lua-Harness-tests/101-boolean.t b/test/lua-Harness-tests/101-boolean.t
index c26b276e..b2014436 100755
--- a/test/lua-Harness-tests/101-boolean.t
+++ b/test/lua-Harness-tests/101-boolean.t
@@ -114,7 +114,7 @@ error_like(function () local a = true; a[1] = 1; end,
            "index")
 
 if has_op53 then
-    make_specific_checks'lexico53/boolean.t'
+    _dofile'lexico53/boolean.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/102-function.t b/test/lua-Harness-tests/102-function.t
index c49afc5e..214fcb71 100755
--- a/test/lua-Harness-tests/102-function.t
+++ b/test/lua-Harness-tests/102-function.t
@@ -193,7 +193,7 @@ t[print] = true
 ok(t[print])
 
 if has_op53 then
-    make_specific_checks'lexico53/function.t'
+    _dofile'lexico53/function.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/103-nil.t b/test/lua-Harness-tests/103-nil.t
index 87a1c3b1..55f89d0d 100755
--- a/test/lua-Harness-tests/103-nil.t
+++ b/test/lua-Harness-tests/103-nil.t
@@ -114,7 +114,7 @@ error_like(function () local a = nil; a[1] = 1; end,
            "index")
 
 if has_op53 then
-    make_specific_checks'lexico53/nil.t'
+    _dofile'lexico53/nil.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/104-number.t b/test/lua-Harness-tests/104-number.t
index f5b81e3d..b63f1eb0 100755
--- a/test/lua-Harness-tests/104-number.t
+++ b/test/lua-Harness-tests/104-number.t
@@ -233,7 +233,7 @@ error_like(function () local a = 3.14; a[1] = 1; end,
            "index")
 
 if has_op53 then
-    make_specific_checks'lexico53/number.t'
+    _dofile'lexico53/number.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/105-string.t b/test/lua-Harness-tests/105-string.t
index 184deaba..e24d3818 100755
--- a/test/lua-Harness-tests/105-string.t
+++ b/test/lua-Harness-tests/105-string.t
@@ -264,7 +264,7 @@ error_like(function () a = 'text'; a[1] = 1; end,
            "index")
 
 if has_op53 then
-    make_specific_checks'lexico53/string.t'
+    _dofile'lexico53/string.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/106-table.t b/test/lua-Harness-tests/106-table.t
index 667b9c8d..dac669fe 100755
--- a/test/lua-Harness-tests/106-table.t
+++ b/test/lua-Harness-tests/106-table.t
@@ -122,7 +122,7 @@ error_like(function () t = {}; t[0/0] = 42 end,
            "table index is NaN")
 
 if has_op53 then
-    make_specific_checks'lexico53/table.t'
+    _dofile'lexico53/table.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/107-thread.t b/test/lua-Harness-tests/107-thread.t
index 5c5bf22f..bc105ff1 100755
--- a/test/lua-Harness-tests/107-thread.t
+++ b/test/lua-Harness-tests/107-thread.t
@@ -122,7 +122,7 @@ t[co] = true
 ok(t[co])
 
 if has_op53 then
-    make_specific_checks'lexico53/thread.t'
+    _dofile'lexico53/thread.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/108-userdata.t b/test/lua-Harness-tests/108-userdata.t
index 48a5f60f..8c2918e8 100755
--- a/test/lua-Harness-tests/108-userdata.t
+++ b/test/lua-Harness-tests/108-userdata.t
@@ -119,7 +119,7 @@ t[u] = true
 ok(t[u])
 
 if has_op53 then
-    make_specific_checks'lexico53/userdata.t'
+    _dofile'lexico53/userdata.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/203-lexico.t b/test/lua-Harness-tests/203-lexico.t
index 7f554820..c4a95fa3 100755
--- a/test/lua-Harness-tests/203-lexico.t
+++ b/test/lua-Harness-tests/203-lexico.t
@@ -118,19 +118,19 @@ do
 end
 
 if _VERSION >= 'Lua 5.2' or jit then
-    make_specific_checks'lexico52/lexico.t'
+    _dofile'lexico52/lexico.t'
 end
 
 if _VERSION >= 'Lua 5.3' or luajit21 then
-    make_specific_checks'lexico53/lexico.t'
+    _dofile'lexico53/lexico.t'
 end
 
 if _VERSION >= 'Lua 5.4' then
-    make_specific_checks'lexico54/lexico.t'
+    _dofile'lexico54/lexico.t'
 end
 
 if jit and pcall(require, 'ffi') then
-    make_specific_checks'lexicojit/lexico.t'
+    _dofile'lexicojit/lexico.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/231-metatable.t b/test/lua-Harness-tests/231-metatable.t
index 97ac5420..c0b2344b 100755
--- a/test/lua-Harness-tests/231-metatable.t
+++ b/test/lua-Harness-tests/231-metatable.t
@@ -589,7 +589,7 @@ do
 end
 
 if has_anno_toclose then
-    make_specific_checks'lexico54/metatable.t'
+    _dofile'lexico54/metatable.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/301-basic.t b/test/lua-Harness-tests/301-basic.t
index a4fe6381..2390d694 100755
--- a/test/lua-Harness-tests/301-basic.t
+++ b/test/lua-Harness-tests/301-basic.t
@@ -843,7 +843,7 @@ do -- xpcall
 end
 
 if jit and pcall(require, 'ffi') then
-    make_specific_checks'lexicojit/basic.t'
+    _dofile'lexicojit/basic.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/305-utf8.t b/test/lua-Harness-tests/305-utf8.t
index 6c125388..1e975e6d 100755
--- a/test/lua-Harness-tests/305-utf8.t
+++ b/test/lua-Harness-tests/305-utf8.t
@@ -40,7 +40,7 @@ if not utf8 then
     nok(has_utf8, "no has_utf8")
 else
     plan'no_plan'
-    make_specific_checks'lexico53/utf8.t'
+    _dofile'lexico53/utf8.t'
     if _VERSION >= 'Lua 5.4' then
         make_specific_checks'lexico54/utf8.t'
     end
diff --git a/test/lua-Harness-tests/404-ext.t b/test/lua-Harness-tests/404-ext.t
index a799c750..4938ea3a 100755
--- a/test/lua-Harness-tests/404-ext.t
+++ b/test/lua-Harness-tests/404-ext.t
@@ -158,7 +158,7 @@ end
 
 -- thread.exdata
 if pcall(require, 'ffi') and (profile.openresty or jit.version:match'moonjit') then
-    make_specific_checks'lexicojit/ext.t'
+    _dofile'lexicojit/ext.t'
 end
 
 done_testing()
diff --git a/test/lua-Harness-tests/tap.lua b/test/lua-Harness-tests/tap.lua
index 86cca4e0..b17709e5 100644
--- a/test/lua-Harness-tests/tap.lua
+++ b/test/lua-Harness-tests/tap.lua
@@ -9,6 +9,10 @@
 
 ]]
 
+function _dofile (filename)
+    return dofile(arg[0]:gsub('([^/]+)%.t$', '') .. filename)
+end
+
 function _retrieve_progname ()
     local i = 0
     while arg[i] do
-- 
2.31.1



More information about the Tarantool-patches mailing list