[Tarantool-patches] [PATCH luajit] test: fix directory detection in lua-Harness suite

Sergey Kaplun skaplun at tarantool.org
Fri Apr 16 21:21:00 MSK 2021


<314-regex.t> uses `arg[0]:find'314'` to determine the name of the
directory where rx_* files are located. This leads to the test
failure, when lua-Harness suite run in the directory containing
"314" in its name, because the found path doesn't contain the required
files.

This patch fixes directory name detection.

Follows up tarantool/tarantool#5844
---

I tested it locally on branch in directory containing "314" in the name.
Also, I grepped the test suites with "find", "match", "sub" patterns,
but didn't see other places with such bug like that.

Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-harness-314-find-bug
Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-noticket-harness-314-find-bug

 test/lua-Harness-tests/314-regex.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/lua-Harness-tests/314-regex.t b/test/lua-Harness-tests/314-regex.t
index ad4554cd..58cdb66e 100755
--- a/test/lua-Harness-tests/314-regex.t
+++ b/test/lua-Harness-tests/314-regex.t
@@ -164,7 +164,7 @@ local function split (line)
 end
 
 local test_number = 0
-local dirname = arg[0]:sub(1, arg[0]:find'314' -1)
+local dirname = arg[0]:gsub('([^/]+)%.t$', '')
 for _, filename in ipairs(test_files) do
     local f, msg = io.open(dirname .. filename, 'r')
     if f == nil then
-- 
2.31.0



More information about the Tarantool-patches mailing list