Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/8] test: introduce MakeLuaPath.cmake helper
Date: Thu, 1 Sep 2022 13:16:19 +0300	[thread overview]
Message-ID: <YxCGc0HD9i9G6Noc@root> (raw)
In-Reply-To: <Yw98By/evKt6iy8U@tarantool.org>

Hi, Igor!

Thanks for the fixes!

On 31.08.22, Igor Munkin wrote:
> Sergey,
> 
> Thanks for your review!
> 
> On 18.08.22, Sergey Kaplun wrote:

<snipped>

> > > +# XXX: Mind the reverse order of the entries in the result string.
> > 
> > Why do we need this behaviour? May be it is better to save strict order
> > of entries?
> 
> The code will become more complex as a result and in the 99.999% of the
> cases the order of LUA_PATH entries doesn't bother you.

But it bothers me for the lua-Harness tests already. We get the
following snippet from <303-package.t>:

|   f = io.open('syntax.lua', 'w')
|   f:write [[?syntax error?]]
|   f:close()
|   local r, e = pcall(require, 'syntax')
|   error_matches(function () require('syntax') end,
|           "^error loading module 'syntax' from file '%.[/\\]syntax%.lua':",
|           "function require (syntax error)")

As we can see `error_matches()` expects "file './syntax.lua'" string
from the output, but if "./.?lua" path isn't the first one, this test
will fail due to the whole path in the output.

>                                                         So I don't see
> we should make the code more complex to save the order of the entries.

As far as I don't usually read from bottom to top (except mcode encoding)
it is more convenient to me to use strict order.

Also, as for me the following patch (feel free to modify it as you want)
doesn't make the code too complex:

===================================================================
diff --git a/cmake/MakeLuaPath.cmake b/cmake/MakeLuaPath.cmake
index 9a5a3bb8..f92bdb19 100644
--- a/cmake/MakeLuaPath.cmake
+++ b/cmake/MakeLuaPath.cmake
@@ -28,19 +28,23 @@ function(make_lua_path path)
                         "${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}")
+    if(result)
+      set(result "${result}\;${inc}")
+    else()
+      set(result "${inc}")
+    endif()
   endforeach()
 
+  # 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 "${result}\;\;")
+
   set(${path} "${result}" PARENT_SCOPE)
 endfunction()
===================================================================

> 
> > 
> > > +
> > > +function(make_lua_path path)

<snipped>

> > 
> > -- 
> > Best regards,
> > Sergey Kaplun
> 
> -- 
> Best regards,
> IM

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2022-09-01 10:18 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 11:17 [Tarantool-patches] [PATCH luajit 0/8] LuaJIT tests and CI enhancements Igor Munkin via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 1/8] test: introduce LUAJIT_TEST_VARDIR variable Igor Munkin via Tarantool-patches
2022-08-15 12:08   ` Sergey Bronnikov via Tarantool-patches
2022-08-18  8:27     ` Sergey Kaplun via Tarantool-patches
2022-08-31 14:53     ` Igor Munkin via Tarantool-patches
2022-09-02 12:06       ` Sergey Bronnikov via Tarantool-patches
2022-10-05 19:51         ` Igor Munkin via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 2/8] test: introduce MakeLuaPath.cmake helper Igor Munkin via Tarantool-patches
2022-08-15 12:08   ` Sergey Bronnikov via Tarantool-patches
2022-08-31 15:07     ` Igor Munkin via Tarantool-patches
2022-09-02 12:09       ` Sergey Bronnikov via Tarantool-patches
2022-08-18  9:37   ` Sergey Kaplun via Tarantool-patches
2022-08-31 15:19     ` Igor Munkin via Tarantool-patches
2022-09-01 10:16       ` Sergey Kaplun via Tarantool-patches [this message]
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 3/8] test: fix tarantool suite for out of source build Igor Munkin via Tarantool-patches
2022-08-15 12:10   ` Sergey Bronnikov via Tarantool-patches
2022-08-18  9:49   ` Sergey Kaplun via Tarantool-patches
2022-08-31 17:20     ` Igor Munkin via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 4/8] ci: use out of source build in GitHub Actions Igor Munkin via Tarantool-patches
2022-08-15 12:13   ` Sergey Bronnikov via Tarantool-patches
2022-08-18  9:58     ` Sergey Kaplun via Tarantool-patches
2022-08-31 15:34       ` Igor Munkin via Tarantool-patches
2022-08-31 15:33     ` Igor Munkin via Tarantool-patches
2022-09-02 12:09       ` Sergey Bronnikov via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 5/8] ci: remove excess parallel level setup Igor Munkin via Tarantool-patches
2022-08-15 12:14   ` Sergey Bronnikov via Tarantool-patches
2022-08-18 10:09   ` Sergey Kaplun via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 6/8] ci: remove arch prefix for macOS M1 workflow Igor Munkin via Tarantool-patches
2022-08-15 12:17   ` Sergey Bronnikov via Tarantool-patches
2022-08-18 10:14   ` Sergey Kaplun via Tarantool-patches
2022-08-31 15:55     ` Igor Munkin via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 7/8] ci: merge x86_64 and ARM64 workflows Igor Munkin via Tarantool-patches
2022-08-15 12:22   ` Sergey Bronnikov via Tarantool-patches
2022-08-18 10:21   ` Sergey Kaplun via Tarantool-patches
2022-08-31 16:02     ` Igor Munkin via Tarantool-patches
2022-08-11 11:17 ` [Tarantool-patches] [PATCH luajit 8/8] ci: merge Linux and macOS workflows Igor Munkin via Tarantool-patches
2022-08-15 12:27   ` Sergey Bronnikov via Tarantool-patches
2022-08-18 10:32   ` Sergey Kaplun via Tarantool-patches
2022-11-11  8:56 ` [Tarantool-patches] [PATCH luajit 0/8] LuaJIT tests and CI enhancements 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=YxCGc0HD9i9G6Noc@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/8] test: introduce MakeLuaPath.cmake helper' \
    /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