From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 2C2846EC56; Tue, 16 Mar 2021 18:00:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2C2846EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1615906822; bh=643EDtFsNDf06iUq/giz0Qb2YEIWUclGeGI27hwBB8o=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Gq+DGI2bvnS/EKRFLjL7FXXMvuvx3nZCZFJGRnGCgdizbqxggHSa62SEiMzA4yD0P n3hdxxlcbgKkzP0XunVweJkwugU+uKJy9AUAfPLLTnLzQBW/tRFEO7mXPpytM/0qIW swJlvjYSLlGfFVz8i9poeA0aRfV1LcMNrJC11UC8= Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2AFC26EC56 for ; Tue, 16 Mar 2021 18:00:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2AFC26EC56 Received: by smtp55.i.mail.ru with esmtpa (envelope-from ) id 1lMBBE-0007pN-89; Tue, 16 Mar 2021 18:00:20 +0300 Date: Tue, 16 Mar 2021 17:59:30 +0300 To: Igor Munkin Message-ID: <20210316145930.GC1155@root> References: <31d2b8f880693c4af3d47d7c6693acfd79459052.1615819534.git.skaplun@tarantool.org> <20210315174421.GG9042@tarantool.org> <20210316060142.GD16737@root> <20210316105142.GK9042@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316105142.GK9042@tarantool.org> X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD96485A7A9FC1318934FEBC8F0BC2797F6B85C225F6ECFBC4F182A05F53808504058140D7AC796C4EFF1663153CA9C00F75B7E3382FFF1590382C709D2D7FED044 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE766DBE83FD69AB645EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374FA524FBD8B89EAA8638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CF89CA98302ED496F9A6AB5E40F9BD2DDB17AA294D9CD7C06A471835C12D1D9774AD6D5ED66289B5259CC434672EE6371117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23DF004C9065253843057739F23D657EF2B13377AFFFEAFD26923F8577A6DFFEA7C0BF7CEC3D2FC0D9C93EC92FD9297F6715571747095F342E857739F23D657EF2BD5E8D9A59859A8B677084C381D43A98D089D37D7C0E48F6C5571747095F342E857739F23D657EF2B6825BDBE14D8E7028C9DFF55498CEFB0BD9CCCA9EDD067B1EDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A52BDFC522C168AC4AB6C482A807C85A98448AAA790CCB3B8BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75F04B387B5D7535DE410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349A949488F6BF46DD1C5454007CDB3C9280DDFA53527C7EB8507F520C4F0EFDE2B74F2F5A2FB933DE1D7E09C32AA3244CE4F4DD22F2D2DC7C3BA2FE5DE52B745D5595C85A795C7BAEFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojwV/GgY7Z4vXuJ6vHuKwFCA== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4A794473C57E862D749CD022903F080EC96C236757D6432D5F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 3/5] test: adjust lua-Harness test suite for Tarantool X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Igor, On 16.03.21, Igor Munkin wrote: > Sergey, > > On 16.03.21, Sergey Kaplun wrote: > > Igor, > > > > Thanks for the review! > > > > On 15.03.21, Igor Munkin wrote: > > > Sergey, > > > OK, thanks for clarification! > > > > Patch for test directory tweak. Adjusted considering [2]. > > > > =================================================================== > > commit a84980334dce27243a25508e3bb8fd491689e552 > > Author: Sergey Kaplun > > Date: Mon Mar 15 16:24:07 2021 +0300 > > > > test: adjust lua-Harness tests that using dofile > > > > This patch makes out-of-source execution lua-Harness suite tests that > > using `dofile()` correct. > > Minor: There are other tests using , but they are fine. The root > problem relates to the approach used in the patched tests: the .t files > are kinda wrapper, containing the basic checks (or not, e.g. UTF-8 test > chunk), and some specific checks are moved to the auxiliary chunks > "dofiled" in .t script. Reformulate like the following: | This patch makes out-of-source execution lua-Harness suite tests that | using `dofile()` for specific checks mentioned in corresponding | *.t files correct. > > > > > There are the following files that used `dofile()` function > > on file in test sources directory: > > * 101-boolean.t > > * 102-function.t > > * 103-nil.t > > * 104-number.t > > * 105-string.t > > * 106-table.t > > * 107-thread.t > > * 108-userdata.t > > * 203-lexico.t > > * 231-metatable.t > > * 301-basic.t > > * 305-utf8.t > > * 404-ext.t > > > > `dofile()` looks for files to execute in the current working directory, > > that might be not the same as the test source directory. > > > > This patch introduces the new function `dofile_fullpath()` that > > What does "fullpath" mean? If this is absolute path, then naming is > ambiguous; and I guess nothing stops one from using relative paths (but > not symlink, I think) here. Furthermore, the naming doesn't represent > the purpose: as I mentioned above this dofile is needed to implement > specific checks, so you can adjust the naming to more verbose one: > or . Thoughts? `make_specific_checks()` is good for me. See the iterative patch below: =================================================================== diff --git a/test/lua-Harness-tests/101-boolean.t b/test/lua-Harness-tests/101-boolean.t index b9a769f..c26b276 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 - dofile_fullpath'lexico53/boolean.t' + make_specific_checks'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 2858640..c49afc5 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 - dofile_fullpath'lexico53/function.t' + make_specific_checks'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 1e7c134..87a1c3b 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 - dofile_fullpath'lexico53/nil.t' + make_specific_checks'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 affd1a4..f5b81e3 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 - dofile_fullpath'lexico53/number.t' + make_specific_checks'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 f571520..184deab 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 - dofile_fullpath'lexico53/string.t' + make_specific_checks'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 b1a1027..667b9c8 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 - dofile_fullpath'lexico53/table.t' + make_specific_checks'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 2f332d7..5c5bf22 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 - dofile_fullpath'lexico53/thread.t' + make_specific_checks'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 cc4134b..48a5f60 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 - dofile_fullpath'lexico53/userdata.t' + make_specific_checks'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 e5e89ed..a4f06a3 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 - dofile_fullpath('lexico52/lexico.t') + make_specific_checks('lexico52/lexico.t') end if _VERSION >= 'Lua 5.3' or luajit21 then - dofile_fullpath('lexico53/lexico.t') + make_specific_checks('lexico53/lexico.t') end if _VERSION >= 'Lua 5.4' then - dofile_fullpath('lexico54/lexico.t') + make_specific_checks('lexico54/lexico.t') end if jit and pcall(require, 'ffi') then - dofile_fullpath('lexicojit/lexico.t') + make_specific_checks('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 c5684d2..97ac542 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 - dofile_fullpath'lexico54/metatable.t' + make_specific_checks'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 460a02f..f92d744 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 - dofile_fullpath('lexicojit/basic.t') + make_specific_checks('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 18c57d8..6c12538 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 nok(has_utf8, "no has_utf8") else plan'no_plan' - dofile_fullpath'lexico53/utf8.t' + make_specific_checks'lexico53/utf8.t' if _VERSION >= 'Lua 5.4' then - dofile_fullpath'lexico54/utf8.t' + make_specific_checks'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 e48d91a..a799c75 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 - dofile_fullpath'lexicojit/ext.t' + make_specific_checks'lexicojit/ext.t' end done_testing() diff --git a/test/lua-Harness-tests/tap.lua b/test/lua-Harness-tests/tap.lua index 37b9df7..a8454ae 100644 --- a/test/lua-Harness-tests/tap.lua +++ b/test/lua-Harness-tests/tap.lua @@ -209,7 +209,7 @@ end -- 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 dofile_fullpath (filename) +function make_specific_checks (filename) return dofile(arg[0]:gsub('([^/]+)%.t$', '') .. filename) end =================================================================== > > > evaluates full path to file considering arg[0] (i.e. test filename) > > It's worth to check and mention the caveat with symlinks. If the issue > exists, then the paths should be resolved in CMake the way similar to > the one used for luacheck target. Looks like all is fine: | $ pwd | /home/burii/builds_workspace/luajit/gh-5844-adapt-lua-harness-test-suite | $ rm -rf third_party/luajit/ | $ cd third_party/ | $ ln -s $HOME/builds_workspace/luajit/gh-5844-adapt-lua-harness-test-suite/ ~/builds_workspace/tarantool/gh-5844-adapt-lua-harness-test-suite/third_party/luajit | $ cd ../build/ | $ cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_BACKTRACE=ON .. && make -j && make LuaJIT-test | | All tests successful. > > > value. > > > > Part of tarantool/tarantool#5844 > > Part of tarantool/tarantool#4473 > > > > > > > =================================================================== > > > > Patch for mocking environment variable in CMake. > > > > =================================================================== > > commit 483508b0a7863efabcde6d232ab9af2033e0011f > > Author: Sergey Kaplun > > Date: Mon Mar 15 22:08:07 2021 +0300 > > > > test: forcify set USERNAME env var for lua-Harness > > Strictly saying, you do not force, but just set. Furthermore, I doubt > about word formation you applied to "force". Removed confusing "forcify". See the whole patch below. > > > > > 309-os.t checks `os.getenv()` function by examining of > > Typo: examine , not examine of [2]. Fixed. > > > USERNAME or LOGNAME environment variable. > > These variables might not be set in the environment, that leads to test > > failure. > > > > This patchs sets manually USERNAME environment variable for > > Typo: s/manually/explicitly/. Fixed. > > > lua-Harness-tests target. > > > > Part of tarantool/tarantool#5844 > > Part of tarantool/tarantool#4473 > > > > diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt > > index f8611ce..b844788 100644 > > --- a/test/lua-Harness-tests/CMakeLists.txt > > +++ b/test/lua-Harness-tests/CMakeLists.txt > > @@ -34,6 +34,11 @@ add_custom_command(TARGET lua-Harness-tests > > env > > LUA_PATH="${LUA_PATH}\;" > > LUA_CPATH="${LUA_CPATH}\;" > > + # XXX: 309-os.t checks os.getenv() function by examining of > > Typo: examine , not examine of [2]. Fixed. See the full commit below: =================================================================== commit 6f42397be1bd1a4d96a639d92da658180f270091 (HEAD) Author: Sergey Kaplun Date: Mon Mar 15 22:08:07 2021 +0300 test: set USERNAME env var for lua-Harness 309-os.t checks `os.getenv()` function by examining USERNAME or LOGNAME environment variable. These variables might not be set in the environment, that leads to test failure. This patchs sets explicitly USERNAME environment variable for lua-Harness-tests target. Part of tarantool/tarantool#5844 Part of tarantool/tarantool#4473 diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt index 336dc03..1061c79 100644 --- a/test/lua-Harness-tests/CMakeLists.txt +++ b/test/lua-Harness-tests/CMakeLists.txt @@ -27,6 +27,11 @@ add_custom_command(TARGET lua-Harness-tests COMMAND env LUA_PATH="${LUA_PATH}\;" + # XXX: 309-os.t checks os.getenv() function by examining + # USERNAME or LOGNAME environment variable. + # These variables might not be set in the environment, so + # set one of them manually. + USERNAME="fperrad" ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21' ${LUA_TEST_FLAGS} =================================================================== > > > + # USERNAME or LOGNAME environment variable. > > + # These variables might not be set in the environment, so > > + # set one of them manually. > > + USERNAME="fperrad" > > ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} > > --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21' > > ${LUA_TEST_FLAGS} > > =================================================================== > > > > [1]: https://lists.tarantool.org/pipermail/tarantool-patches/2021-March/022563.html > > [2]: https://lists.tarantool.org/pipermail/tarantool-patches/2021-March/022710.html > > > > -- > > Best regards, > > Sergey Kaplun > > [1]: https://lists.tarantool.org/tarantool-patches/16E39C08-397B-4A38-953A-B9EB85CD9C8B@tarantool.org/T/#m9de07af72e06ac22b7540741b9e1c4ac485688bb > [2]: https://dictionary.cambridge.org/dictionary/english/examine > > -- > Best regards, > IM -- Best regards, Sergey Kaplun