From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maxim Kokryashkin <m.kokryashkin@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit 3/7] test: stop using utils.selfrun in tests Date: Mon, 27 Feb 2023 09:16:26 +0000 [thread overview] Message-ID: <Y/x06uZnBwXpqUol@tarantool.org> (raw) In-Reply-To: <1676497395.939233553@f714.i.mail.ru> Max, Thanks for your review! See my answers below. On 16.02.23, Maxim Kokryashkin wrote: > > Hi, Igor! > LGTM, except for a few nits below. > <snipped> > >>diff --git a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua > >>index dd02130c..f4795db0 100644 > >>--- a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua > >>+++ b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua > >>@@ -3,52 +3,43 @@ local utils = require('utils') > ><snipped> > >>+ -- TODO: Leave another toxic comment regarding SIP on macOS. > >That comment is unnecessary. Here and below. ================================================================================ diff --git a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua index ff3eaf01..ad06c329 100644 --- a/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua +++ b/test/tarantool-tests/gh-4427-ffi-sandwich.test.lua @@ -6,8 +6,23 @@ local test = tap.test('gh-4427-ffi-sandwich'):skipcond({ test:plan(2) +-- <makecmd> runs %testname%/script.lua by <LUAJIT_TEST_BINARY> +-- with the given environment, launch options and CLI arguments. local script = require('utils').makecmd(arg, { - -- TODO: Leave another toxic comment regarding SIP on macOS. + -- XXX: Apple tries their best to "protect their users from + -- malware". As a result SIP (see the link[1] below) has been + -- designed and released. Now, Apple developers are so + -- protected, that they can load nothing being not installed in + -- the system, since the environment is sanitized before the + -- child process is launched. In particular, environment + -- variables starting with DYLD_ and LD_ are unset for child + -- process. For more info, see the docs[2] below. + -- + -- The environment variable below is used by FFI machinery to + -- find the proper shared library. + -- + -- [1]: https://support.apple.com/en-us/HT204899 + -- [2]: https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/RuntimeProtections/RuntimeProtections.html env = { DYLD_LIBRARY_PATH = os.getenv('DYLD_LIBRARY_PATH') }, redirect = '2>&1', }) ================================================================================ > > > ><snipped> > >> > >>diff --git a/test/tarantool-tests/utils.lua b/test/tarantool-tests/utils.lua > >>index eb11d40d..41a7c22a 100644 > >>--- a/test/tarantool-tests/utils.lua > >>+++ b/test/tarantool-tests/utils.lua <snipped> > >>+ }, { > >>+ __call = function(self, ...) > >>+ local cmd = ('<ENV> <LUABIN> <REDIRECT> <SCRIPT>'):gsub('%<(%w+)>', self) > >>+ .. (' %s'):rep(select('#', ...)):format(...) > >>+ return io.popen(cmd):read('*all'):gsub('^%s+', ''):gsub('%s+$', '') > >>+ end > >>+ }) > >That part is barely readable, so I think you should either drop > >a comment with explanation, or rewrite it in a more readable way. Well, yeah... my Perl background is coming out ;) Anyway, here is the comment: ================================================================================ diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua index ac04c01d..f5e08043 100644 --- a/test/tarantool-tests/tap.lua +++ b/test/tarantool-tests/tap.lua @@ -60,8 +65,17 @@ function M.makecmd(arg, opts) REDIRECT = opts and opts.redirect or '', }, { __call = function(self, ...) + -- This line just makes the command for <io.popen> by the + -- following steps: + -- 1. Replace the placeholders with the corresponding values + -- given to the command constructor (e.g. script, env) + -- 2. Join all CLI arguments given to the __call metamethod + -- 3. Concatenate the results of step 1 and step 2 to obtain + -- the resulting command. local cmd = ('<ENV> <LUABIN> <REDIRECT> <SCRIPT>'):gsub('%<(%w+)>', self) .. (' %s'):rep(select('#', ...)):format(...) + -- Trim both leading and trailing whitespace from the output + -- produced by the child process. return io.popen(cmd):read('*all'):gsub('^%s+', ''):gsub('%s+$', '') end }) ================================================================================ > >> end > >> > >> function M.skipcond(condition, message) > >>-- > >>2.30.2 > >-- > >Best regards, > >Maxim Kokryashkin > > -- Best regards, IM
next prev parent reply other threads:[~2023-02-27 9:19 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-13 17:02 [Tarantool-patches] [PATCH luajit 0/7] Adjust tests to be run when JIT is disabled Igor Munkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 1/7] Minor fixes Igor Munkin via Tarantool-patches 2023-02-13 18:47 ` Sergey Kaplun via Tarantool-patches 2023-02-14 13:51 ` Maxim Kokryashkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 2/7] build: fix build with JIT disabled Igor Munkin via Tarantool-patches 2023-02-13 18:53 ` Sergey Kaplun via Tarantool-patches 2023-02-27 9:15 ` Igor Munkin via Tarantool-patches 2023-02-28 8:16 ` Maxim Kokryashkin via Tarantool-patches 2023-02-14 13:53 ` Maxim Kokryashkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 3/7] test: stop using utils.selfrun in tests Igor Munkin via Tarantool-patches 2023-02-15 8:08 ` Sergey Kaplun via Tarantool-patches 2023-02-27 9:16 ` Igor Munkin via Tarantool-patches 2023-02-27 9:28 ` Sergey Kaplun via Tarantool-patches 2023-02-15 21:43 ` Maxim Kokryashkin via Tarantool-patches 2023-02-27 9:16 ` Igor Munkin via Tarantool-patches [this message] 2023-02-28 8:18 ` Maxim Kokryashkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 4/7] test: make skipcond helper more convenient Igor Munkin via Tarantool-patches 2023-02-15 8:46 ` Sergey Kaplun via Tarantool-patches 2023-02-27 9:18 ` Igor Munkin via Tarantool-patches 2023-02-27 10:09 ` Sergey Kaplun via Tarantool-patches 2023-02-28 8:27 ` Maxim Kokryashkin via Tarantool-patches 2023-02-15 22:08 ` Maxim Kokryashkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 5/7] test: add skipcond for all JIT-related tests Igor Munkin via Tarantool-patches 2023-02-14 13:50 ` Sergey Kaplun via Tarantool-patches 2023-02-15 22:31 ` Maxim Kokryashkin via Tarantool-patches 2023-02-28 19:02 ` Igor Munkin via Tarantool-patches 2023-03-01 19:31 ` Maxim Kokryashkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 6/7] test: fix lua-Harness " Igor Munkin via Tarantool-patches 2023-02-14 12:42 ` Sergey Kaplun via Tarantool-patches 2023-02-28 19:01 ` Igor Munkin via Tarantool-patches 2023-02-15 22:35 ` Maxim Kokryashkin via Tarantool-patches 2023-02-28 19:02 ` Igor Munkin via Tarantool-patches 2023-03-01 19:31 ` Maxim Kokryashkin via Tarantool-patches 2023-02-13 17:02 ` [Tarantool-patches] [PATCH luajit 7/7] ci: add nojit flavor for exotic builds Igor Munkin via Tarantool-patches 2023-02-13 19:14 ` Sergey Kaplun via Tarantool-patches 2023-02-15 21:18 ` Maxim Kokryashkin via Tarantool-patches 2023-02-27 9:36 ` [Tarantool-patches] [PATCH luajit 0/7] Adjust tests to be run when JIT is disabled Igor Munkin via Tarantool-patches 2023-02-28 19:05 ` 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=Y/x06uZnBwXpqUol@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imun@tarantool.org \ --cc=m.kokryashkin@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 3/7] test: stop using utils.selfrun in tests' \ /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