From: Maxim Kokryashkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, imun@tarantool.org,
skaplun@tarantool.org
Subject: [Tarantool-patches] [PATCH v2 05/10] test: refactor with _dofile
Date: Tue, 20 Jul 2021 19:26:53 +0300 [thread overview]
Message-ID: <34c2c2f332776613a3fd456ea62d00e892ad6369.1626797225.git.m.kokryashkin@tarantool.org> (raw)
In-Reply-To: <cover.1626797225.git.m.kokryashkin@tarantool.org>
The patch[1] from lua-Harness suite is quite similar to commit
d11c5bbc08a118b11167c5d455d4024607dab662 ('test: adjust lua-Harness
tests that use dofile'), with the one difference (except the naming):
`make_specific_checks()` provides the particular behaviour to run the
tests for out-of-source build, however `_dofile()` allows user to
overload this function considering his purposes. If user leave
`_dofile()` untouched, it defaults to `dofile()` Lua standard library
function.
It's worth to mention, that LuaJIT testing machinery has been using
such approach since commit 734cc0f1d508429c2c3c46bd1860398db0051060
('test: adapt PUC-Rio suite for out-of-source build') and `_dofile()`
behaviour for running tests when out of source build is used is
already defined in luajit-test-init.lua.
[1]: https://framagit.org/fperrad/lua-Harness/-/commit/60da289
Part of tarantool/tarantool#5970
Part of tarantool/tarantool#4473
---
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 | 4 ++--
test/lua-Harness-tests/404-ext.t | 2 +-
test/lua-Harness-tests/test_assertion.lua | 10 ++--------
test/luajit-test-init.lua | 2 ++
15 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/test/lua-Harness-tests/101-boolean.t b/test/lua-Harness-tests/101-boolean.t
index eb8b6bbd..9b36174f 100755
--- a/test/lua-Harness-tests/101-boolean.t
+++ b/test/lua-Harness-tests/101-boolean.t
@@ -114,7 +114,7 @@ error_matches(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 a0a3ad33..f144f702 100755
--- a/test/lua-Harness-tests/102-function.t
+++ b/test/lua-Harness-tests/102-function.t
@@ -193,7 +193,7 @@ t[print] = true
truthy(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 718fde16..d7cab0da 100755
--- a/test/lua-Harness-tests/103-nil.t
+++ b/test/lua-Harness-tests/103-nil.t
@@ -114,7 +114,7 @@ error_matches(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 872042c0..9dd3ffa0 100755
--- a/test/lua-Harness-tests/104-number.t
+++ b/test/lua-Harness-tests/104-number.t
@@ -233,7 +233,7 @@ error_matches(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 22e6cfa6..3d167840 100755
--- a/test/lua-Harness-tests/105-string.t
+++ b/test/lua-Harness-tests/105-string.t
@@ -264,7 +264,7 @@ error_matches(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 ecb761d2..6beb2a5e 100755
--- a/test/lua-Harness-tests/106-table.t
+++ b/test/lua-Harness-tests/106-table.t
@@ -122,7 +122,7 @@ error_matches(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 33ebf769..e9b17139 100755
--- a/test/lua-Harness-tests/107-thread.t
+++ b/test/lua-Harness-tests/107-thread.t
@@ -122,7 +122,7 @@ t[co] = true
truthy(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 314a60e7..0c7f0c24 100755
--- a/test/lua-Harness-tests/108-userdata.t
+++ b/test/lua-Harness-tests/108-userdata.t
@@ -119,7 +119,7 @@ t[u] = true
truthy(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 c9345c71..396a167f 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 15625c11..06cc902c 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 c45b2558..01e187d9 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 e448a448..2ba48c08 100755
--- a/test/lua-Harness-tests/305-utf8.t
+++ b/test/lua-Harness-tests/305-utf8.t
@@ -40,9 +40,9 @@ if not utf8 then
falsy(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'
+ _dofile'lexico54/utf8.t'
end
done_testing()
end
diff --git a/test/lua-Harness-tests/404-ext.t b/test/lua-Harness-tests/404-ext.t
index 7239e5df..45701671 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/test_assertion.lua b/test/lua-Harness-tests/test_assertion.lua
index f126eab1..67cf37f9 100644
--- a/test/lua-Harness-tests/test_assertion.lua
+++ b/test/lua-Harness-tests/test_assertion.lua
@@ -9,6 +9,8 @@
]]
+_dofile = _dofile or dofile -- could be defined in profile
+
function _retrieve_progname ()
local i = 0
while arg[i] do
@@ -227,14 +229,6 @@ function todo (reason, count)
todo_reason = reason
end
--- XXX: If tests 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.
-function make_specific_checks (filename)
- return dofile(arg[0]:gsub('([^/]+)%.t$', '') .. filename)
-end
-
--
-- Copyright (c) 2009-2021 Francois Perrad
--
diff --git a/test/luajit-test-init.lua b/test/luajit-test-init.lua
index 54a1f815..feec17cf 100644
--- a/test/luajit-test-init.lua
+++ b/test/luajit-test-init.lua
@@ -2,6 +2,8 @@
-- `_loadfile()` exists and uses it for code loading from test
-- files. If the variable is not defined then suite uses
-- `loadfile()` as default. Same for the `_dofile()`.
+-- Lua-Harness also uses the same implementation of `dofile()`
+-- fot he same reason
-- XXX: Some tests in PUC Rio Lua 5.1 test suite clean `arg`
-- variable, so evaluate this once and use later.
--
2.32.0
next prev parent reply other threads:[~2021-07-20 16:30 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-20 16:26 [Tarantool-patches] [PATCH v2 00/10] test: lua-Harness suite patch bump Maxim Kokryashkin via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 01/10] test: port lua-Harness to Test.Assertion Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:08 ` Igor Munkin via Tarantool-patches
2021-07-26 10:38 ` Максим Корякшин via Tarantool-patches
2021-07-27 6:41 ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:18 ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 02/10] test: rename lua-Harness tap to test_assertion Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:08 ` Igor Munkin via Tarantool-patches
2021-07-27 6:27 ` Sergey Kaplun via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 03/10] test: use CI friendly variables in lua-Harness Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:09 ` Igor Munkin via Tarantool-patches
2021-07-27 9:01 ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:23 ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 04/10] test: refactor with _retrieve_progname Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:09 ` Igor Munkin via Tarantool-patches
2021-07-27 9:27 ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:28 ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` Maxim Kokryashkin via Tarantool-patches [this message]
2021-07-25 21:10 ` [Tarantool-patches] [PATCH v2 05/10] test: refactor with _dofile Igor Munkin via Tarantool-patches
2021-07-26 12:11 ` Максим Корякшин via Tarantool-patches
2021-07-27 9:34 ` Sergey Kaplun via Tarantool-patches
2021-07-27 22:36 ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 06/10] test: support tarantool in lua-Harness Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:11 ` Igor Munkin via Tarantool-patches
2021-07-26 11:07 ` Максим Корякшин via Tarantool-patches
2021-07-26 19:46 ` Igor Munkin via Tarantool-patches
2021-07-27 10:04 ` Sergey Kaplun via Tarantool-patches
2021-07-28 17:40 ` Максим Корякшин via Tarantool-patches
2021-07-28 17:42 ` Максим Корякшин via Tarantool-patches
2021-07-28 18:34 ` Sergey Kaplun via Tarantool-patches
2021-07-29 9:19 ` Максим Корякшин via Tarantool-patches
2021-07-29 9:22 ` Igor Munkin via Tarantool-patches
2021-07-29 10:12 ` Максим Корякшин via Tarantool-patches
2021-07-29 9:47 ` Sergey Kaplun via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 07/10] test: backport lua-Harness directory detection Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:12 ` Igor Munkin via Tarantool-patches
2021-07-26 11:13 ` Максим Корякшин via Tarantool-patches
2021-07-28 18:37 ` Sergey Kaplun via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 08/10] test: support tarantool cli in lua-Harness Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:13 ` Igor Munkin via Tarantool-patches
2021-07-26 11:17 ` Максим Корякшин via Tarantool-patches
2021-07-26 19:53 ` Igor Munkin via Tarantool-patches
2021-07-28 18:44 ` Sergey Kaplun via Tarantool-patches
2021-07-28 18:50 ` Sergey Kaplun via Tarantool-patches
2021-07-29 9:23 ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 09/10] test: update lua-Harness to b7b1a9a2 Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:14 ` Igor Munkin via Tarantool-patches
2021-07-26 12:21 ` Максим Корякшин via Tarantool-patches
2021-07-26 20:04 ` Igor Munkin via Tarantool-patches
2021-07-28 18:48 ` Sergey Kaplun via Tarantool-patches
2021-07-29 9:27 ` Максим Корякшин via Tarantool-patches
2021-07-20 16:26 ` [Tarantool-patches] [PATCH v2 10/10] test: disable test/lua-Harness-tests/241-standalone.t on FreeBSD Maxim Kokryashkin via Tarantool-patches
2021-07-25 21:17 ` Igor Munkin via Tarantool-patches
2021-07-26 12:31 ` Максим Корякшин via Tarantool-patches
2021-07-26 12:32 ` Максим Корякшин via Tarantool-patches
2021-07-26 12:36 ` Максим Корякшин via Tarantool-patches
2021-07-26 20:13 ` Igor Munkin via Tarantool-patches
2021-07-27 6:21 ` Sergey Kaplun via Tarantool-patches
2021-07-29 9:41 ` Максим Корякшин via Tarantool-patches
2021-07-29 9:45 ` Sergey Kaplun via Tarantool-patches
2021-07-29 9:57 ` Максим Корякшин via Tarantool-patches
2021-07-30 17:09 ` Igor Munkin via Tarantool-patches
2021-07-25 21:03 ` [Tarantool-patches] [PATCH v2 00/10] test: lua-Harness suite patch bump Igor Munkin via Tarantool-patches
2021-07-30 19:19 ` Igor Munkin via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34c2c2f332776613a3fd456ea62d00e892ad6369.1626797225.git.m.kokryashkin@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=imun@tarantool.org \
--cc=max.kokryashkin@gmail.com \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 05/10] test: refactor with _dofile' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox