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 57F0B71862; Thu, 4 Mar 2021 13:26:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 57F0B71862 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614853588; bh=tA4C7wFEs6/436uAXuyneHgVrkBpkTsbg1mRd21iiZQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=IFF0TXgGaDb8JZUoNvojomZn/sAgMmC9gzqwmL69Cgd1Ksog15VGDmsOKZkG/8TCj 4xNGvZl00HLJh5NrbCRxa5ULvN6C2J2nn+wMAm/LZqmSmjgoHvajygqAKzjL6vsUiS pt7sPfCpI+8yZuyEjmyy6dcd3ycFZhgCrzP100qo= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 CAAF86B463 for ; Thu, 4 Mar 2021 13:24:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CAAF86B463 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1lHlA7-0000fx-My; Thu, 04 Mar 2021 13:24:56 +0300 To: Sergey Ostanevich , Igor Munkin Date: Thu, 4 Mar 2021 13:23:50 +0300 Message-Id: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92A98208ECBDD29F5BCF62610559114B730DD7337B29CB406182A05F5380850409F39048942F2700C13E7938E41A9564CF71CAF0FD97CA47AB3BD9AD2DDAB7D7B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74FC7AD0AD96C1577EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637956E96668349D4418638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CDB1C6D2319E1F1674359E2100C604B84972B82F81A58CE1EA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3E478A468B35FE767117882F4460429728AD0CFFFB425014E868A13BD56FB6657A7F4EDE966BC389F9E8FC8737B5C2249D0C9BB9AE6BD5D69089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A39223F8577A6DFFEA7CCB4B9D7E49E0773B43847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148FBC2A4A7A8370ED8B3C9F3DD0FB1AF5EB4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CDB1C6D2319E1F1674359E2100C604B84972B82F81A58CE1E9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF31C0090ACECF247D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3498EF79680EE3725C4347F1FDC0866B4EB1F0AA18F28C1649F4A70DA5F8E66D0C935294CEBB79DA871D7E09C32AA3244CEE753706086AE47DDF8CF1D928D8B8E3D08D48398F32B4A6927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojSsmoOoMLSh1DIsHRs+0VCA== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB43ED66D791259DA68ABF93359CF19A829CDB1805CC3BD8532F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [Tarantool-patches] [WIP luajit 03/15] test: adapt Lua 5.1 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" In some insignificant details Tarantool's behaviour is not the same as the behaviour of Lua 5.1. This patch adds special LUAJIT_TEST_COMMAND variable to extend `progname` from main.lua with ` -e require"strict".off()` to disable strict for debug Tarantool build. Also, `progname` is not edged by '"' to be able run other test suites. Tests in the following files are disabled with corresponding comments: * gc.lua * main.lua * pm.lua Tests in the following files are adapted for testing with Tarantool's out-of-source build: * all.lua * verybig.lua Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 --- CMakeLists.txt | 8 ++++++++ test/PUC-Lua-5.1-tests/CMakeLists.txt | 5 ++++- test/PUC-Lua-5.1-tests/all.lua | 16 ++++++++++++---- test/PUC-Lua-5.1-tests/gc.lua | 9 ++++++--- test/PUC-Lua-5.1-tests/main.lua | 24 +++++++++++++++++------- test/PUC-Lua-5.1-tests/pm.lua | 6 +++++- test/PUC-Lua-5.1-tests/verybig.lua | 4 +++- 7 files changed, 55 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9486ca6..9917b50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,6 +288,14 @@ set(LUAJIT_TEST_BINARY ${LUAJIT_BINARY} CACHE STRING "Lua implementation to be used for tests. Default is 'luajit'." ) +# Unfortunately we can't just use LUA_INIT enviroment variable. +# See https://github.com/tarantool/tarantool/issues/5744 for +# the details. This variable includes -e 'require"strict".off()' +# for the Tarantool. +set(LUAJIT_TEST_COMMAND ${LUAJIT_BINARY} CACHE STRING + "Lua implementation with -e command to be used for tests. Default is 'luajit'." +) + add_subdirectory(test) # --- Misc rules --------------------------------------------------------------- diff --git a/test/PUC-Lua-5.1-tests/CMakeLists.txt b/test/PUC-Lua-5.1-tests/CMakeLists.txt index ed32a84..1249cab 100644 --- a/test/PUC-Lua-5.1-tests/CMakeLists.txt +++ b/test/PUC-Lua-5.1-tests/CMakeLists.txt @@ -82,7 +82,10 @@ add_custom_command(TARGET PUC-Lua-5.1-tests # LUA_INIT="package.path='?\;'..package.path" # So use less preferable way for tests. LUA_PATH="${LUA_PATH}\;\;" - ${LUAJIT_TEST_BINARY} ${TEST_RUNNER} + # XXX: Adapt to run test on readonly file systems + # with loadfile(CUR_SOURCE_DIR..filename). + CUR_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} + ${LUAJIT_TEST_COMMAND} ${TEST_RUNNER} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/test/PUC-Lua-5.1-tests/all.lua b/test/PUC-Lua-5.1-tests/all.lua index 8c4afac..52a6235 100755 --- a/test/PUC-Lua-5.1-tests/all.lua +++ b/test/PUC-Lua-5.1-tests/all.lua @@ -58,9 +58,13 @@ end -- -- redefine dofile to run files through dump/undump -- -dofile = function (n) +-- Adapt test for testing with Tarantool's out-of-source build +-- on read only file system. CUR_SOURCE_DIR is set via CMake. +local path_to_sources = os.getenv('CUR_SOURCE_DIR')..'/' +dofile = function (n, prefix) + local pr = prefix or path_to_sources showmem() - local f = assert(loadfile(n)) + local f = assert(loadfile(pr..n)) local b = string.dump(f) f = assert(loadstring(b)) return f() @@ -77,7 +81,9 @@ do end end -local f = assert(loadfile('gc.lua')) +-- Adapt test for testing with Tarantool's out-of-source build +-- on read only file system. +local f = assert(loadfile(path_to_sources..'gc.lua')) f() dofile('db.lua') assert(dofile('calls.lua') == deep and deep) @@ -88,7 +94,9 @@ assert(dofile('locals.lua') == 5) dofile('constructs.lua') dofile('code.lua') do - local f = coroutine.wrap(assert(loadfile('big.lua'))) + -- Adapt test for testing with Tarantool's out-of-source build + -- on read only file system. + local f = coroutine.wrap(assert(loadfile(path_to_sources..'big.lua'))) assert(f() == 'b') assert(f() == 'a') end diff --git a/test/PUC-Lua-5.1-tests/gc.lua b/test/PUC-Lua-5.1-tests/gc.lua index b767104..6c4097a 100644 --- a/test/PUC-Lua-5.1-tests/gc.lua +++ b/test/PUC-Lua-5.1-tests/gc.lua @@ -128,9 +128,12 @@ do local a = {} until gcinfo() > 1000 collectgarbage"restart" - repeat - local a = {} - until gcinfo() < 1000 + -- Tarantool has too much objects at start. + -- gcinfo() is always greater than 1000. + -- Test is disabled for Tarantool binary. + -- repeat + -- local a = {} + -- until gcinfo() < 1000 end lim = 15 diff --git a/test/PUC-Lua-5.1-tests/main.lua b/test/PUC-Lua-5.1-tests/main.lua index 12f3981..69eb5db 100644 --- a/test/PUC-Lua-5.1-tests/main.lua +++ b/test/PUC-Lua-5.1-tests/main.lua @@ -11,7 +11,7 @@ out = os.tmpname() do local i = 0 while arg[i] do i=i-1 end - progname = '"'..arg[i+1]..'"' + progname = arg[i+1] end print(progname) @@ -50,8 +50,10 @@ end -- test 2 files prepfile("print(1); a=2") prepfile("print(a)", otherprog) -RUN("lua -l %s -l%s -lstring -l io %s > %s", prog, otherprog, otherprog, out) -checkout("1\n2\n2\n") +-- Test is disabled for Tarantool binary. +-- See https://github.com/tarantool/tarantool/issues/5747. +-- RUN("lua -l %s -l%s -lstring -l io %s > %s", prog, otherprog, otherprog, out) +-- checkout("1\n2\n2\n") local a = [[ assert(table.getn(arg) == 3 and arg[1] == 'a' and @@ -63,7 +65,10 @@ local a = [[ ]] a = string.format(a, progname) prepfile(a) -RUN('lua "-e " -- %s a b c', prog) +-- Tarantool has different command line argument parsing. +-- For example it always set itself as arg[-1]. +-- Test is disabled for Tarantool binary. +-- RUN('lua "-e " -- %s a b c', prog) -- test 'arg' availability in libraries -- LuaJIT v2.1.0-beta3 has extension from Lua 5.3: @@ -85,8 +90,10 @@ prepfile[[print(({...})[30])]] RUN("lua %s %s > %s", prog, string.rep(" a", 30), out) checkout("a\n") -RUN([[lua "-eprint(1)" -ea=3 -e "print(a)" > %s]], out) -checkout("1\n3\n") +-- Test is disabled for Tarantool binary. +-- See https://github.com/tarantool/tarantool/issues/5747. +-- RUN([[lua "-eprint(1)" -ea=3 -e "print(a)" > %s]], out) +-- checkout("1\n3\n") prepfile[[ print( @@ -177,7 +184,10 @@ assert(not os.remove(out)) RUN("lua -v") -NoRun("lua -h") +-- Tarantool returns zero status at exit with -h option, unlike +-- Lua does. +-- Test is disabled for Tarantool binary. +-- NoRun("lua -h") NoRun("lua -e") NoRun("lua -e a") NoRun("lua -f") diff --git a/test/PUC-Lua-5.1-tests/pm.lua b/test/PUC-Lua-5.1-tests/pm.lua index 366a31c..6e1b403 100644 --- a/test/PUC-Lua-5.1-tests/pm.lua +++ b/test/PUC-Lua-5.1-tests/pm.lua @@ -207,7 +207,11 @@ function rev (s) end local x = string.rep('012345', 10) -assert(rev(rev(x)) == x) +-- The first Tarantool's fiber has only 512Kb of stack. +-- It is not enough for this recursive call. +-- See also https://github.com/tarantool/tarantool/issues/5782. +-- Test is disabled for Tarantool binary. +-- assert(rev(rev(x)) == x) -- gsub with tables diff --git a/test/PUC-Lua-5.1-tests/verybig.lua b/test/PUC-Lua-5.1-tests/verybig.lua index 59e0142..bfb95df 100644 --- a/test/PUC-Lua-5.1-tests/verybig.lua +++ b/test/PUC-Lua-5.1-tests/verybig.lua @@ -93,7 +93,9 @@ for s in string.gmatch(prog, "$([^$]+)") do if not n then io.write(s) else F[n]() end end io.close() -result = dofile(file) +-- Adapt test for testing with Tarantool's out-of-source build +-- on read only file system. +result = dofile(file, "") assert(os.remove(file)) print'OK' return result -- 2.28.0