<HTML><BODY><div>Hi, Sergey!</div><div>Thanks for the review!</div><div> </div><div>New commit message with your comments in mind:</div><div>=========================================================</div><div>test: adapt disabled tests from PUC-Rio</div><div><div> </div><div>Version and status are printed in stdout instead of stderr</div><div>since LuaJIT-2.0.0-beta11 (as it is not an error message). This behavior</div><div>is the same as in Lua 5.2, so necessary changes in tests can be</div><div>adapted from PUC-Rio Lua 5.2 test suite.</div><div> </div><div>However, those tests are disabled for Tarantool since its interactive</div><div>shell doesn't support '=' at the beginning of statements.</div><div>Here is an example:</div><div>|$ luajit</div><div>|> = (6*2-6) -- ===</div><div><div>|6</div><div>|</div><div>|$ tarantool</div><div>|tarantool> = (6*2-6) -- ===</div><div>|---</div><div>|- error: ' (6*2-6) -- ===:1: unexpected symbol near ''='''</div><div>|...</div></div><div> </div><div>Part of tarantool/tarantool#5870</div><div><div>Resolves tarantool/tarantool#5687</div></div></div><div>=========================================================</div><div> </div><div>And here is the diff:</div><div>=========================================================</div><div><div><div>diff --git a/test/PUC-Rio-Lua-5.1-tests/main.lua b/test/PUC-Rio-Lua-5.1-tests/main.lua</div><div>index 38111560..9c1e5fa4 100644</div><div>--- a/test/PUC-Rio-Lua-5.1-tests/main.lua</div><div>+++ b/test/PUC-Rio-Lua-5.1-tests/main.lua</div><div>@@ -139,8 +139,9 @@ prepfile[[</div><div> RUN("lua - < %s > %s", prog, out)</div><div> checkout("1\tnil\n")</div></div><div> </div><div><div>--- FIXME: The following chunk is disabled for Tarantool since its interactive</div><div>--- shell doesn't support '=' at the beginning of statements.</div><div>+-- FIXME: The following chunk is disabled for Tarantool since</div><div>+-- its interactive shell doesn't support '=' at the beginning</div><div>+-- of statements.</div><div> -- Here is an example:</div><div> -- $ luajit</div><div> -- LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/</div><div>@@ -202,7 +203,7 @@ assert( a == b )</div><div>   prepfile(s)</div><div>   RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)</div><div>   checkprogout("11\n1\t2\n\n")</div><div>-end</div><div>+end -- not _TARANTOOL</div></div><div> </div><div><div> prepfile[[#comment in 1st line without \n at the end]]</div><div> RUN("lua %s", prog)</div><div>=========================================================</div><div> </div><div>New CI branch: <a href="https://github.com/tarantool/tarantool/tree/fckxorg/gh-5687-adapt-disabled-tests-from-PUC-Rio-full-ci">https://github.com/tarantool/tarantool/tree/fckxorg/gh-5687-adapt-disabled-tests-from-PUC-Rio-full-ci</a></div><div> </div><div>Best regards,</div><div>Maxim Kokryashkin</div><div> </div></div></div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div> <blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;"><div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16396671751260057203_BODY">Hi, Maxim!<br><br>Thanks for the fixes!<br><br>LGTM, except a few nits below.<br><br>On 13.10.21, Maxim Kokryashkin wrote:<br>> Version and status are printed in stdout instead stderr<br>> since LuaJIT-2.0.0-beta11 (as it is not an error message). This behavior<br>> is the same as in Lua 5.2, so necessary changes in tests can be<br>> adapted from PUC-Rio Lua 5.2 test suite.<br>><br>> However, those tests are disabled for Tarantool since its interactive<br>> shell doesn't support '=' at the beginning of statements.<br>> Here is an example:<br><br>OK, so maybe we should create a ticket for that (and _PROMPT feature)?<br>At least to mention it and wait for thumbs up.<br>Igor, thoughts?<br><br>> ========================================================================<br><br>Nit: it's better to use "|" for quoting in commit messages (I use "==="<br>only for separate iterative diff from the rest part of the mail). See<br>git log 77c4a0747693a2a27745616894943746548df875 for example.<br>But it's just my recommendation.:)<br>Feel free to ignore.<br><br>> $ luajit<br>> > = (6*2-6) -- ===<br>> 6<br>><br>> $ tarantool<br>> tarantool> = (6*2-6) -- ===<br>> ---<br>> - error: ' (6*2-6) -- ===:1: unexpected symbol near ''='''<br>> ...<br>> ========================================================================<br>><br>> Part of tarantool/tarantool#5870<br>> ---<br>> Changes in v2:<br>> - Fixed comments as per review by Sergey<br>> - Disabled some tests for Tarantool<br>> - Added link to CI jobs<br>><br>> Issue: <a href="https://github.com/tarantool/tarantool/issues/5687" target="_blank">https://github.com/tarantool/tarantool/issues/5687</a><br>> Branch: <a href="https://github.com/tarantool/luajit/tree/fckxorg/gh-5687-adapt-tests-output-PUC-Rio" target="_blank">https://github.com/tarantool/luajit/tree/fckxorg/gh-5687-adapt-tests-output-PUC-Rio</a><br>> CI: <a href="https://github.com/tarantool/tarantool/tree/fckxorg/gh-5687-adapt-disabled-tests-from-PUC-Rio" target="_blank">https://github.com/tarantool/tarantool/tree/fckxorg/gh-5687-adapt-disabled-tests-from-PUC-Rio</a><br>><br>> test/PUC-Rio-Lua-5.1-tests/main.lua | 97 ++++++++++++++++++++---------<br>> 1 file changed, 66 insertions(+), 31 deletions(-)<br>><br>> diff --git a/test/PUC-Rio-Lua-5.1-tests/main.lua b/test/PUC-Rio-Lua-5.1-tests/main.lua<br>> index 07facc4c..38111560 100644<br>> --- a/test/PUC-Rio-Lua-5.1-tests/main.lua<br>> +++ b/test/PUC-Rio-Lua-5.1-tests/main.lua<br>> @@ -24,11 +24,33 @@ local prepfile = function (s, p)<br>> assert(io.close())<br>> end<br>><br>> -function checkout (s)<br>> +-- Taken from PUC-Rio Lua 5.2 test suite.<br>> +-- See comment for checkprogout().<br>> +function getoutput ()<br>> io.input(out)<br>> local t = io.read("*a")<br>> io.input():close()<br>> assert(os.remove(out))<br>> + return t<br>> +end<br>> +<br>> +-- Version and status are printed in stdout instead stderr since<br>> +-- LuaJIT-2.0.0-beta11 (as it is not an error message).<br>> +-- See commit 0bd1a66f2f055211ef55834ccebca3b82d03c735<br>> +-- (Print version and JIT status to stdout, not stderr.).<br>> +-- This behavior is the same as in Lua 5.2.<br>> +-- See also <a href="https://github.com/tarantool/tarantool/issues/5687" target="_blank">https://github.com/tarantool/tarantool/issues/5687</a>.<br>> +-- This function is adapted from PUC-Rio Lua 5.2 test suite.<br>> +-- It is used for test commands with -i flag.<br>> +function checkprogout (s)<br>> + local t = getoutput()<br>> + for line in string.gmatch(s, ".-\n") do<br>> + assert(string.find(t, line, 1, true))<br>> + end<br>> +end<br>> +<br>> +function checkout (s)<br>> + local t = getoutput()<br>> if s ~= t then print(string.format("'%s' - '%s'\n", s, t)) end<br>> assert(s == t)<br>> return t<br>> @@ -117,39 +139,52 @@ prepfile[[<br>> RUN("lua - < %s > %s", prog, out)<br>> checkout("1\tnil\n")<br>><br>> --- FIXME: Version and status are printed to stdout instead of<br>> --- stderr since LuaJIT-2.0.0-beta11 (as it is not an error<br>> --- message). See commit 0bd1a66f2f055211ef55834ccebca3b82d03c735<br>> --- (Print version and JIT status to stdout, not stderr.).<br>> --- This behavior is the same as in Lua 5.2.<br>> --- In Lua 5.2 this feature was introduced via commit<br>> --- 9e7de9473c65baee1f567852a778f2d33a47ea83.<br>> --- See also <a href="https://github.com/tarantool/tarantool/issues/5687" target="_blank">https://github.com/tarantool/tarantool/issues/5687</a>.<br>> -prepfile[[<br>> +-- FIXME: The following chunk is disabled for Tarantool since its interactive<br>> +-- shell doesn't support '=' at the beginning of statements.<br>> +-- Here is an example:<br><br>Minor: linewidth for comments is 66 symbols. (Ignorable for comment with<br>word-for-word quotes below.)<br><br>> +-- $ luajit<br>> +-- LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. <a href="http://luajit.org/" target="_blank">http://luajit.org/</a><br>> +-- JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse<br>> +-- > = (6*2-6) -- ===<br>> +-- 6<br>> +<br>> +-- $ tarantool<br>> +-- Tarantool 2.10.0-beta1-80-g201905544<br>> +-- type 'help' for interactive help<br>> +-- tarantool> = (6*2-6) -- ===<br>> +-- ---<br>> +-- - error: ' (6*2-6) -- ===:1: unexpected symbol near ''='''<br>> +-- ...<br>> +if not _TARANTOOL then<br><br>Side note: like this solution much more than just comment out this<br>chunk!<br><br>> +-- Test is adapted from PUC-Rio Lua 5.2 test suite.<br>> +-- See comment for checkprogout().<br>> + prepfile[[<br>> = (6*2-6) -- ===<br>> a<br>> = 10<br>> print(a)<br>> = a]]<br>> --- FIXME: Behavior is different for LuaJIT. See the comment above.<br>> --- RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)<br>> --- checkout("6\n10\n10\n\n")<br>> -<br>> -prepfile("a = [[b\nc\nd\ne]]\n=a")<br>> -print(prog)<br>> --- FIXME: Behavior is different for LuaJIT. See the comment above.<br>> --- RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)<br>> --- checkout("b\nc\nd\ne\n\n")<br>> -<br>> -prompt = "alo"<br>> -prepfile[[ --<br>> + RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)<br>> + checkprogout("6\n10\n10\n\n")<br>> +<br>> +-- Test is adapted from PUC-Rio Lua 5.2 test suite.<br>> +-- See comment for checkprogout().<br>> + prepfile("a = [[b\nc\nd\ne]]\n=a")<br>> + print(prog)<br>> + RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)<br>> + checkprogout("b\nc\nd\ne\n\n")<br>> +<br>> +-- Test is adapted from PUC-Rio Lua 5.2 test suite.<br>> +-- See comment for checkprogout().<br>> + prompt = "alo"<br>> + prepfile[[ --<br>> a = 2<br>> ]]<br>> --- FIXME: Behavior is different for LuaJIT. See the comment above.<br>> --- RUN([[lua "-e_PROMPT='%s'" -i < %s > %s]], prompt, prog, out)<br>> --- checkout(string.rep(prompt, 3).."\n")<br>> + RUN([[lua "-e_PROMPT='%s'" -i < %s > %s]], prompt, prog, out)<br>> + local t = getoutput()<br>> + assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt))<br>><br>> -s = [=[ --<br>> + s = [=[ --<br>> function f ( x )<br>> local a = [[<br>> xuxu<br>> @@ -163,11 +198,11 @@ end<br>> =( f( 10 ) )<br>> assert( a == b )<br>> =f( 11 ) ]=]<br>> -s = string.gsub(s, ' ', '\n\n')<br>> -prepfile(s)<br>> --- FIXME: Behavior is different for LuaJIT. See the comment above.<br>> --- RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)<br>> --- checkout("11\n1\t2\n\n")<br>> + s = string.gsub(s, ' ', '\n\n')<br>> + prepfile(s)<br>> + RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)<br>> + checkprogout("11\n1\t2\n\n")<br>> +end<br><br>It's nothing bad in commenting "-- not _TARANTOOL" for this `end`.<br>Feel free to ignore.<br><br>><br>> prepfile[[#comment in 1st line without \n at the end]]<br>> RUN("lua %s", prog)<br>> --<br>> 2.33.0<br>><br><br>--<br>Best regards,<br>Sergey Kaplun</div></div></div></div></blockquote><div> </div></div></blockquote></BODY></HTML>