[Tarantool-patches] [PATCH v2 luajit 3/5] test: adjust lua-Harness test suite for Tarantool

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


Sergey,

On 15.03.21, Sergey Kaplun wrote:
> This patch makes it possible to run lua-Harness test suite using
> Tarantool.
> 
> 203-lexico.t and 301-basic.t is adjusted to valid working with
> out-of-source build in Tarantool CI.
> 
> Inside Tarantool's GitHub-CI there is no defined variable LOGNAME nor
> USERNAME. This leads to test failure inside CI, because a string is
> expected. So, now USERNAME is set manually via CMake.
> 
> Part of tarantool/tarantool#5844
> Part of tarantool/tarantool#4473
> ---
>  test/lua-Harness-tests/203-lexico.t   | 14 ++++++++++----
>  test/lua-Harness-tests/301-basic.t    |  6 +++++-
>  test/lua-Harness-tests/CMakeLists.txt |  4 ++++
>  3 files changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/test/lua-Harness-tests/203-lexico.t b/test/lua-Harness-tests/203-lexico.t
> index c1abebf..5f79b3f 100755
> --- a/test/lua-Harness-tests/203-lexico.t
> +++ b/test/lua-Harness-tests/203-lexico.t
> @@ -117,20 +117,26 @@ do
>      like(msg, "^[^:]+:%d+: unfinished long comment .-near")
>  end
>  
> +-- 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.

On the second thought, my fix is bad and inconvenient, considering you
have missed a couple of other occurrences (just grep <dofile> in
lua-Harness-tests directory). Hence, I propose to introduce a new
routine in tap.lua implementing kinda Perlish "goto &" to the Lua file
in lua-Harness source tree to enclose this hack within the new function.

> +local test_srcdir = arg[0]:gsub('([^/]+)%.t$', '')
> +
>  if _VERSION >= 'Lua 5.2' or jit then
> -    dofile'lexico52/lexico.t'
> +    dofile(test_srcdir .. 'lexico52/lexico.t')
>  end
>  
>  if _VERSION >= 'Lua 5.3' or luajit21 then
> -    dofile'lexico53/lexico.t'
> +    dofile(test_srcdir .. 'lexico53/lexico.t')
>  end
>  
>  if _VERSION >= 'Lua 5.4' then
> -    dofile'lexico54/lexico.t'
> +    dofile(test_srcdir .. 'lexico54/lexico.t')
>  end
>  
>  if jit and pcall(require, 'ffi') then
> -    dofile'lexicojit/lexico.t'
> +    dofile(test_srcdir .. 'lexicojit/lexico.t')
>  end
>  
>  done_testing()

<snipped>

> -- 
> 2.28.0
> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list