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 662C06F154; Mon, 15 Aug 2022 15:09:01 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 662C06F154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1660565341; bh=/OOBUsVEDHJKT4bOIRnURzbuQguMOpC+PXgbyNK7ZgM=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=NSKVdWLM0hDn2VNElwXuAJkV5VXw65SS4yQjHruBj9MbPiC6rCoAhHtjcedXJuLFB cdfIkJ9bsWHX902LwZCLrh/Ce3RsEf+QWK+Qa84v0a9UI1Iu8W/jBvFT90PfgPuHon ZTSrMrr+lvjQRfgHjRqYIsLTl/m1zzevc/J1yWIc= Received: from smtp57.i.mail.ru (smtp57.i.mail.ru [217.69.128.37]) (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 4675C6F154 for ; Mon, 15 Aug 2022 15:08:59 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4675C6F154 Received: by smtp57.i.mail.ru with esmtpa (envelope-from ) id 1oNYtu-0007Jw-Ef; Mon, 15 Aug 2022 15:08:58 +0300 Content-Type: multipart/alternative; boundary="------------CpoPAtfIBph6vjlP9MKG0KKN" Message-ID: <43afa059-82e9-422e-2636-f063bba9f847@tarantool.org> Date: Mon, 15 Aug 2022 15:08:58 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: Igor Munkin , Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <1d05bbecc9c9ae57250ec563e202a8e103f86fa4.1660216002.git.imun@tarantool.org> In-Reply-To: <1d05bbecc9c9ae57250ec563e202a8e103f86fa4.1660216002.git.imun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD999D8F08CF16C6CA79689DFCD3191088E20666E5EE319E7FF00894C459B0CD1B9A78DFD1D7756471378D5A66028EFD59569C2C31D955D3D95EB7B4B1AEBBE2F88 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7956F10FFCC7409BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F1F2DD05CDE7D3F9EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38B8859CA687ABA27BAD6C5AC7A3F1415E9578841F26AB3BAA4CC7F00164DA146DAFE8445B8C89999728AA50765F790063707A1F3761B83B09E389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8B861051D4BA689FCF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C8C83961949B2167B302FCEF25BFAB3454AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C39415BE9523AAFE76BA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE73D2653439DE09960731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E142185AC9E3593CE4B31AB1881A6453793CE9274300E5CE05BD4401A9E91200F654B0AB21DE2C0F4064F9627B9FD0EE8BFE981ACCA56BFFD05CA19B9343DE9D5B5A479C2B6934AE262D3EE7EAB7254005DCED8DA55E71E02F9FC08E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D343536C6A4332D8B8ABF44D1BC5227E141A2779505B1C332C9E6E186AB9AFE8823BB197495FFF4482E1D7E09C32AA3244C271E15D91B1F9700E854DE41521340951DD47778AE04E04DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojKOC4OzB6pCPYjOq0DGi8Eg== X-Mailru-Sender: 11C2EC085EDE56FAC71737E9F694C0DEE60425BA3FC3CAD868927BEDAF105AB1A113713AFEC9C5D5645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/8] test: introduce MakeLuaPath.cmake helper 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------CpoPAtfIBph6vjlP9MKG0KKN Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Igor, thanks for the patch! See my comments inline. On 11.08.2022 14:17, Igor Munkin wrote: > While extending test suites it is often required to append additional > path where Lua or Lua-C auxiliary modules are located to LUA_PATH or > LUA_CPATH environment variables. Due to insane semicolon interpolation > in CMake strings (that converts such string to a list as a result), we > need to escape semicolon in LUA_PATH/LUA_CPATH strings while building > the resulting value. > > After the years of struggling MakeLuaPath.cmake module is introduced to > make LUA_PATH and LUA_CPATH definition convenient with > helper. This function takes all paths given as a variable list argument, > joins them in a reverse order by a semicolon and yields the resulting > string to a specified CMake variable. > > Signed-off-by: Igor Munkin > --- > cmake/MakeLuaPath.cmake | 46 +++++++++++++++++++++++ > test/CMakeLists.txt | 2 + > test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt | 8 +++- > test/lua-Harness-tests/CMakeLists.txt | 16 +++++--- > test/tarantool-tests/CMakeLists.txt | 28 ++++++++------ > 5 files changed, 81 insertions(+), 19 deletions(-) > create mode 100644 cmake/MakeLuaPath.cmake > > diff --git a/cmake/MakeLuaPath.cmake b/cmake/MakeLuaPath.cmake > new file mode 100644 > index 00000000..9a5a3bb8 > --- /dev/null > +++ b/cmake/MakeLuaPath.cmake > @@ -0,0 +1,46 @@ > +# make_lua_path provides a convenient way to define LUA_PATH and > +# LUA_CPATH variables. > +# > +# Example usage: > +# > +# make_lua_path(LUA_PATH > +# PATH > +# ${CMAKE_CURRENT_SOURCE_DIR}/?.lua > +# ${CMAKE_BINARY_DIR}/?.lua > +# ./?.lua > +# ) > +# > +# This will give you the string: > +# "./?.lua;${CMAKE_BINARY_DIR}/?.lua;${CMAKE_CURRENT_SOURCE_DIR}/?.lua;;" > +# XXX: Mind the reverse order of the entries in the result string. > + > +function(make_lua_path path) > + set(prefix ARG) > + set(noValues) > + set(singleValues) > + set(multiValues PATHS) > + > + # FIXME: if we update to CMake >= 3.5, can remove this line. I would replace comment with condition that will check CMake version and will fail when CMake >= 3.5: |if (CMAKE_VERSION VERSION_GREATER_EQUAL 35) |    message(FATAL_ERROR "Please remove snippet for CMake < 3.5") endif() > + include(CMakeParseArguments) > + cmake_parse_arguments(${prefix} > + "${noValues}" > + "${singleValues}" > + "${multiValues}" > + ${ARGN}) > + > + # XXX: This is the sentinel semicolon having special meaning > + # for LUA_PATH and LUA_CPATH variables. For more info, see the > + # link below: > + #https://www.lua.org/manual/5.1/manual.html#pdf-LUA_PATH > + set(result "\;") > + > + foreach(inc ${ARG_PATHS}) > + # XXX: If one joins two strings with semicolon, the value > + # automatically becomes a list. I found a single working > + # solution to make result variable be a string via "escaping" > + # the semicolon right in string interpolation. > + set(result "${inc}\;${result}") > + endforeach() > + > + set(${path} "${result}" PARENT_SCOPE) > +endfunction() > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt > index ba25af54..a8262b12 100644 > --- a/test/CMakeLists.txt > +++ b/test/CMakeLists.txt > @@ -3,6 +3,8 @@ > # See the rationale in the root CMakeLists.txt. > cmake_minimum_required(VERSION 3.1 FATAL_ERROR) > > +include(MakeLuaPath) > + > find_program(LUACHECK luacheck) > if(LUACHECK) > # XXX: The tweak below relates to luacheck problem with paths. > diff --git a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt > index 8e825f55..b95e7852 100644 > --- a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt > +++ b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt > @@ -14,7 +14,11 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) > #https://github.com/tarantool/tarantool/issues/5744 > # Hence, there is no way other than set LUA_PATH environment > # variable as proposed in the first case. > -set(LUA_PATH "?\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua") > +make_lua_path(LUA_PATH > + PATHS > + ${CMAKE_CURRENT_SOURCE_DIR}/?.lua > + "?" > +) > > # Establish PUC-Rio-Lua-5.1-tests-prepare target that contains > # rules for libraries compilation and creates > @@ -38,7 +42,7 @@ add_custom_command(TARGET PUC-Rio-Lua-5.1-tests > COMMENT "Running PUC-Rio Lua 5.1 tests" > COMMAND > env > - LUA_PATH="${LUA_PATH}\;\;" > + LUA_PATH="${LUA_PATH}" > ${LUAJIT_TEST_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/all.lua > WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} > ) > diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tests/CMakeLists.txt > index 12476171..a57104a5 100644 > --- a/test/lua-Harness-tests/CMakeLists.txt > +++ b/test/lua-Harness-tests/CMakeLists.txt > @@ -10,10 +10,16 @@ if(NOT PROVE) > return() > endif() > > -# Tests create temporary files (see 303-package.t and 411-luajit.t for > -# example) to require. Also, they require some files from original test > -# source directory. > -set(LUA_PATH "./?.lua\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;${LUAJIT_SOURCE_DIR}/?.lua\;${LUAJIT_BINARY_DIR}/?.lua") > +# Tests create temporary files (see 303-package.t and 411-luajit.t > +# for example) to be required. Also, they require some files from > +# the original test source directory. > +make_lua_path(LUA_PATH > + PATHS > + ${CMAKE_CURRENT_SOURCE_DIR}/?.lua > + ${LUAJIT_BINARY_DIR}/?.lua > + ${LUAJIT_SOURCE_DIR}/?.lua > + ./?.lua > +) > set(LUA_TEST_FLAGS --failures --shuffle) > > if(CMAKE_VERBOSE_MAKEFILE) > @@ -25,7 +31,7 @@ add_custom_command(TARGET lua-Harness-tests > COMMENT "Running lua-Harness tests" > COMMAND > env > - LUA_PATH="${LUA_PATH}\;" > + LUA_PATH="${LUA_PATH}" > ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} > --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21' > --jobs ${CMAKE_BUILD_PARALLEL_LEVEL} > diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/CMakeLists.txt > index ecda2e63..27866869 100644 > --- a/test/tarantool-tests/CMakeLists.txt > +++ b/test/tarantool-tests/CMakeLists.txt > @@ -43,14 +43,11 @@ macro(BuildTestCLib lib sources) > # semicolon. If one finds the normal way to make it work, feel > # free to reach me. > set(TESTLIBS "${lib};${TESTLIBS}" PARENT_SCOPE) > - # Add the directory where the lib is built to the LUA_CPATH > - # environment variable, so LuaJIT can find and load it. > - # XXX: Here we see the other side of the coin. If one joins two > - # strings with semicolon, the value automatically becomes a > - # list. I found a single working solution to make LUA_CPATH be > - # a string via "escaping" the semicolon right in string > - # interpolation. > - set(LUA_CPATH "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;${LUA_CPATH}" PARENT_SCOPE) > + # Add the directory where the lib is built to the list with > + # entries for LUA_CPATH environment variable, so LuaJIT can find > + # and load it. See the comment about extending the list in the > + # parent scope few lines above. > + set(LUA_CPATHS "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX};${LUA_CPATHS}" PARENT_SCOPE) > # Also add this directory to LD_LIBRARY_PATH environment > # variable, so FFI machinery can find and load it. > set(LD_LIBRARY_PATH "${CMAKE_CURRENT_BINARY_DIR}:${LD_LIBRARY_PATH}" PARENT_SCOPE) > @@ -76,14 +73,21 @@ add_subdirectory(misclib-sysprof-capi) > # in src/ directory and auxiliary tests-related modules are > # located in the current directory (but tests are run in the > # binary directory), so LUA_PATH need to be updated. > -set(LUA_PATH > - "${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;${PROJECT_SOURCE_DIR}/tools/?.lua\;${PROJECT_SOURCE_DIR}/src/?.lua" > +make_lua_path(LUA_PATH > + PATHS > + ${CMAKE_CURRENT_SOURCE_DIR}/?.lua > + ${PROJECT_SOURCE_DIR}/tools/?.lua > + ${PROJECT_SOURCE_DIR}/src/?.lua > ) > +# Update LUA_CPATH with the library paths collected within > +# macro. > +make_lua_path(LUA_CPATH PATHS ${LUA_CPATHS}) > + > set(LUA_TEST_SUFFIX .test.lua) > set(LUA_TEST_FLAGS --failures --shuffle) > set(LUA_TEST_ENV > - "LUA_PATH=\"${LUA_PATH}\;\;\"" > - "LUA_CPATH=\"${LUA_CPATH}\;\;\"" > + "LUA_PATH=\"${LUA_PATH}\"" > + "LUA_CPATH=\"${LUA_CPATH}\"" > ) > > if(CMAKE_VERBOSE_MAKEFILE) --------------CpoPAtfIBph6vjlP9MKG0KKN Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Igor, thanks for the patch! See my comments inline.

On 11.08.2022 14:17, Igor Munkin wrote= :
While extending test suites =
it is often required to append additional
path where Lua or Lua-C auxiliary modules are located to LUA_PATH or
LUA_CPATH environment variables. Due to insane semicolon interpolation
in CMake strings (that converts such string to a list as a result), we
need to escape semicolon in LUA_PATH/LUA_CPATH strings while building
the resulting value.

After the years of struggling MakeLuaPath.cmake module is introduced to
make LUA_PATH and LUA_CPATH definition convenient with <make_lua_path&=
gt;
helper. This function takes all paths given as a variable list argument,
joins them in a reverse order by a semicolon and yields the resulting
string to a specified CMake variable.

Signed-off-by: Igor Munkin <imun@tarantool.org>
---
 cmake/MakeLuaPath.cmake                   | 46 +++++++++++++++++++++++
 test/CMakeLists.txt                       |  2 +
 test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt |  8 +++-
 test/lua-Harness-tests/CMakeLists.txt     | 16 +++++---
 test/tarantool-tests/CMakeLists.txt       | 28 ++++++++------
 5 files changed, 81 insertions(+), 19 deletions(-)
 create mode 100644 cmake/MakeLuaPath.cmake

diff --git a/cmake/MakeLuaPath.cmake b/cmake/MakeLuaPath.cmake
new file mode 100644
index 00000000..9a5a3bb8
--- /dev/null
+++ b/cmake/MakeLuaPath.cmake
@@ -0,0 +1,46 @@
+# make_lua_path provides a convenient way to define LUA_PATH and
+# LUA_CPATH variables.
+#
+# Example usage:
+#
+#   make_lua_path(LUA_PATH
+#     PATH
+#       ${CMAKE_CURRENT_SOURCE_DIR}/?.lua
+#       ${CMAKE_BINARY_DIR}/?.lua
+#       ./?.lua
+#   )
+#
+# This will give you the string:
+#    "./?.lua;${CMAKE_BINARY_DIR}/?.lua;${CMAKE_CURRENT_SOURCE_DIR}/?.lu=
a;;"
+# XXX: Mind the reverse order of the entries in the result string.
+
+function(make_lua_path path)
+  set(prefix ARG)
+  set(noValues)
+  set(singleValues)
+  set(multiValues PATHS)
+
+  # FIXME: if we update to CMake >=3D 3.5, can remove this line.
    

I would replace comment with condition that will check CMake version

and will fail when CMake >=3D 3.5:

if (CMAKE_VERSION VERSION_GREATER_EQUAL 35=
)

=C2=A0=C2=A0 message(FATAL_ERROR "Please remove snippet for CMake = < 3.5")

endif()


+  include(CMakeParseArguments)
+  cmake_parse_arguments(${prefix}
+                        "${noValues}"
+                        "${singleValues}"
+                        "${multiValues}"
+                        ${ARGN})
+
+  # XXX: This is the sentinel semicolon having special meaning
+  # for LUA_PATH and LUA_CPATH variables. For more info, see the
+  # link below:
+  # https://www.lua.org/manual/5.1/manual.htm=
l#pdf-LUA_PATH
+  set(result "\;")
+
+  foreach(inc ${ARG_PATHS})
+    # XXX: If one joins two strings with semicolon, the value
+    # automatically becomes a list. I found a single working
+    # solution to make result variable be a string via "escaping"
+    # the semicolon right in string interpolation.
+    set(result "${inc}\;${result}")
+  endforeach()
+
+  set(${path} "${result}" PARENT_SCOPE)
+endfunction()
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ba25af54..a8262b12 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,6 +3,8 @@
 # See the rationale in the root CMakeLists.txt.
 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
=20
+include(MakeLuaPath)
+
 find_program(LUACHECK luacheck)
 if(LUACHECK)
   # XXX: The tweak below relates to luacheck problem with paths.
diff --git a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Rio-Lua=
-5.1-tests/CMakeLists.txt
index 8e825f55..b95e7852 100644
--- a/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
+++ b/test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
@@ -14,7 +14,11 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
 # https://github.com/tarantool/tarantool/issues/57=
44
 # Hence, there is no way other than set LUA_PATH environment
 # variable as proposed in the first case.
-set(LUA_PATH "?\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua")
+make_lua_path(LUA_PATH
+  PATHS
+    ${CMAKE_CURRENT_SOURCE_DIR}/?.lua
+    "?"
+)
=20
 # Establish PUC-Rio-Lua-5.1-tests-prepare target that contains
 # rules for <libs/*> libraries compilation and creates <libs/P1=
>
@@ -38,7 +42,7 @@ add_custom_command(TARGET PUC-Rio-Lua-5.1-tests
   COMMENT "Running PUC-Rio Lua 5.1 tests"
   COMMAND
   env
-    LUA_PATH=3D"${LUA_PATH}\;\;"
+    LUA_PATH=3D"${LUA_PATH}"
     ${LUAJIT_TEST_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/all.lua
   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 )
diff --git a/test/lua-Harness-tests/CMakeLists.txt b/test/lua-Harness-tes=
ts/CMakeLists.txt
index 12476171..a57104a5 100644
--- a/test/lua-Harness-tests/CMakeLists.txt
+++ b/test/lua-Harness-tests/CMakeLists.txt
@@ -10,10 +10,16 @@ if(NOT PROVE)
   return()
 endif()
=20
-# Tests create temporary files (see 303-package.t and 411-luajit.t for
-# example) to require. Also, they require some files from original test =

-# source directory.
-set(LUA_PATH "./?.lua\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;${LUAJIT_SOURC=
E_DIR}/?.lua\;${LUAJIT_BINARY_DIR}/?.lua")
+# Tests create temporary files (see 303-package.t and 411-luajit.t
+# for example) to be required. Also, they require some files from
+# the original test source directory.
+make_lua_path(LUA_PATH
+  PATHS
+    ${CMAKE_CURRENT_SOURCE_DIR}/?.lua
+    ${LUAJIT_BINARY_DIR}/?.lua
+    ${LUAJIT_SOURCE_DIR}/?.lua
+    ./?.lua
+)
 set(LUA_TEST_FLAGS --failures --shuffle)
=20
 if(CMAKE_VERBOSE_MAKEFILE)
@@ -25,7 +31,7 @@ add_custom_command(TARGET lua-Harness-tests
   COMMENT "Running lua-Harness tests"
   COMMAND
   env
-    LUA_PATH=3D"${LUA_PATH}\;"
+    LUA_PATH=3D"${LUA_PATH}"
     ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR}
       --exec '${LUAJIT_TEST_COMMAND} -l profile_luajit21'
       --jobs ${CMAKE_BUILD_PARALLEL_LEVEL}
diff --git a/test/tarantool-tests/CMakeLists.txt b/test/tarantool-tests/C=
MakeLists.txt
index ecda2e63..27866869 100644
--- a/test/tarantool-tests/CMakeLists.txt
+++ b/test/tarantool-tests/CMakeLists.txt
@@ -43,14 +43,11 @@ macro(BuildTestCLib lib sources)
   # semicolon. If one finds the normal way to make it work, feel
   # free to reach me.
   set(TESTLIBS "${lib};${TESTLIBS}" PARENT_SCOPE)
-  # Add the directory where the lib is built to the LUA_CPATH
-  # environment variable, so LuaJIT can find and load it.
-  # XXX: Here we see the other side of the coin. If one joins two
-  # strings with semicolon, the value automatically becomes a
-  # list. I found a single working solution to make LUA_CPATH be
-  # a string via "escaping" the semicolon right in string
-  # interpolation.
-  set(LUA_CPATH "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SUF=
FIX}\;${LUA_CPATH}" PARENT_SCOPE)
+  # Add the directory where the lib is built to the list with
+  # entries for LUA_CPATH environment variable, so LuaJIT can find
+  # and load it. See the comment about extending the list in the
+  # parent scope few lines above.
+  set(LUA_CPATHS "${CMAKE_CURRENT_BINARY_DIR}/?${CMAKE_SHARED_LIBRARY_SU=
FFIX};${LUA_CPATHS}" PARENT_SCOPE)
   # Also add this directory to LD_LIBRARY_PATH environment
   # variable, so FFI machinery can find and load it.
   set(LD_LIBRARY_PATH "${CMAKE_CURRENT_BINARY_DIR}:${LD_LIBRARY_PATH}" P=
ARENT_SCOPE)
@@ -76,14 +73,21 @@ add_subdirectory(misclib-sysprof-capi)
 # in src/ directory and auxiliary tests-related modules are
 # located in the current directory (but tests are run in the
 # binary directory), so LUA_PATH need to be updated.
-set(LUA_PATH
-  "${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;${PROJECT_SOURCE_DIR}/tools/?.lua\=
;${PROJECT_SOURCE_DIR}/src/?.lua"
+make_lua_path(LUA_PATH
+  PATHS
+    ${CMAKE_CURRENT_SOURCE_DIR}/?.lua
+    ${PROJECT_SOURCE_DIR}/tools/?.lua
+    ${PROJECT_SOURCE_DIR}/src/?.lua
 )
+# Update LUA_CPATH with the library paths collected within
+# <BuildTestLib> macro.
+make_lua_path(LUA_CPATH PATHS ${LUA_CPATHS})
+
 set(LUA_TEST_SUFFIX .test.lua)
 set(LUA_TEST_FLAGS --failures --shuffle)
 set(LUA_TEST_ENV
-  "LUA_PATH=3D\"${LUA_PATH}\;\;\""
-  "LUA_CPATH=3D\"${LUA_CPATH}\;\;\""
+  "LUA_PATH=3D\"${LUA_PATH}\""
+  "LUA_CPATH=3D\"${LUA_CPATH}\""
 )
=20
 if(CMAKE_VERBOSE_MAKEFILE)
--------------CpoPAtfIBph6vjlP9MKG0KKN--