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 61A004C883; Tue, 19 Jan 2021 19:59:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 61A004C883 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1611075559; bh=uMaDmskZBRHAXrTeIl3HYP/vObwslo3aCr0yMgbrbGw=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=djGsHpTZGCnlcG0hfAlfrxaEtPzsc+erVEmkf6QfXVbcYrueL4t1qP9pm+/BPSjSk cRnwSL88FVy8z8J4udXchNj4rjhLiYK97GP72uICCQ01ao62h6f7vttkQqkofTb+xy /gFY8xakwwbAlmT5BGL6IC/gR8D63P1Xem5Y3euI= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 306CF9387A for ; Tue, 19 Jan 2021 19:58:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 306CF9387A Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1l1uKj-0000FR-8h; Tue, 19 Jan 2021 19:58:21 +0300 To: imun@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Tue, 19 Jan 2021 19:58:21 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D0E79FBC973162CDAC53986DC5FB1AB1465E8C05863AF8B800894C459B0CD1B9EAA52E9A72C069F4AA2D207A6D0D9F37F78C41F85648ACD88CF6EBAD94FE6CB9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72407438AC6002944EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063729381D024F10DD158638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC2D8BC63DDD8148C538AEE8C5742CAB2716AFB10620854EEF389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92A417C69337E82CC2CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC148C9C629D72B0CB75ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE493D58E677C372A3F47D2D576BCF940C736C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F5D41B9178041F3E72623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C8F59B88ADF80E5C0D12A19C173AFBA8B9E2E08F1DE9A1D509C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF6EA1BA7CA28B4A74699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34D9DC20663B80603F53785BF52AE8E3F8E5D1438EC2E9293262F0053724AF31638969AA8D21B048D81D7E09C32AA3244C175DFC51857B68970D4B5FC9F2891B6FC86C126E7119A0FE729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXhlMKG+La3AEjDAw/QOrR9Z X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638222A0E42E099710A62677EE3CC564C50E283D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH v1 2/5] tests: adjust tests 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: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch makes it possible to run lua-Harness test suite using Tarantool. Part of tarantool/tarantool#4064 Part of tarantool/tarantool#4473 --- test/lua-Harness/090-tap.t | 2 +- test/lua-Harness/091-profile.t | 2 +- test/lua-Harness/101-boolean.t | 2 +- test/lua-Harness/102-function.t | 2 +- test/lua-Harness/103-nil.t | 2 +- test/lua-Harness/104-number.t | 2 +- test/lua-Harness/105-string.t | 2 +- test/lua-Harness/106-table.t | 2 +- test/lua-Harness/107-thread.t | 2 +- test/lua-Harness/108-userdata.t | 2 +- test/lua-Harness/200-examples.t | 2 +- test/lua-Harness/201-assign.t | 6 +-- test/lua-Harness/202-expr.t | 4 +- test/lua-Harness/203-lexico.t | 2 +- test/lua-Harness/204-grammar.t | 2 +- test/lua-Harness/211-scope.t | 2 +- test/lua-Harness/212-function.t | 2 +- test/lua-Harness/213-closure.t | 2 +- test/lua-Harness/214-coroutine.t | 2 +- test/lua-Harness/221-table.t | 2 +- test/lua-Harness/222-constructor.t | 2 +- test/lua-Harness/223-iterator.t | 2 +- test/lua-Harness/231-metatable.t | 2 +- test/lua-Harness/232-object.t | 2 +- test/lua-Harness/241-standalone.t | 20 ++++----- test/lua-Harness/242-luac.t | 2 +- test/lua-Harness/301-basic.t | 14 +++--- test/lua-Harness/303-package.t | 10 ++--- test/lua-Harness/304-string.t | 4 +- test/lua-Harness/305-utf8.t | 2 +- test/lua-Harness/306-table.t | 2 +- test/lua-Harness/307-math.t | 4 +- test/lua-Harness/308-io.t | 2 +- test/lua-Harness/309-os.t | 2 +- test/lua-Harness/310-debug.t | 2 +- test/lua-Harness/311-bit32.t | 4 +- test/lua-Harness/314-regex.t | 2 +- test/lua-Harness/320-stdin.t | 9 ++-- test/lua-Harness/401-bitop.t | 2 +- test/lua-Harness/402-ffi.t | 4 +- test/lua-Harness/403-jit.t | 4 +- test/lua-Harness/404-ext.t | 2 +- test/lua-Harness/411-luajit.t | 4 +- test/lua-Harness/CMakeLists.txt | 2 +- test/lua-Harness/{tap.lua => tap_local.lua} | 11 ++++- test/lua-Harness/tests_list | 50 +++++++++++++++++++++ 46 files changed, 135 insertions(+), 77 deletions(-) rename test/lua-Harness/{tap.lua => tap_local.lua} (95%) create mode 100644 test/lua-Harness/tests_list diff --git a/test/lua-Harness/090-tap.t b/test/lua-Harness/090-tap.t index 92f04d8..3492e52 100755 --- a/test/lua-Harness/090-tap.t +++ b/test/lua-Harness/090-tap.t @@ -22,7 +22,7 @@ ]] -require'tap' +require'tap_local' plan(3) ok( true, 'ok' ) diff --git a/test/lua-Harness/091-profile.t b/test/lua-Harness/091-profile.t index db47438..2e34bd4 100755 --- a/test/lua-Harness/091-profile.t +++ b/test/lua-Harness/091-profile.t @@ -22,7 +22,7 @@ ]] -require'tap' +require'tap_local' plan'no_plan' diff --git a/test/lua-Harness/101-boolean.t b/test/lua-Harness/101-boolean.t index 0033eff..3be968b 100755 --- a/test/lua-Harness/101-boolean.t +++ b/test/lua-Harness/101-boolean.t @@ -22,7 +22,7 @@ ]] -require'tap' +require'tap_local' local has_op53 = _VERSION >= 'Lua 5.3' plan'no_plan' diff --git a/test/lua-Harness/102-function.t b/test/lua-Harness/102-function.t index 48ed814..73a3a7c 100755 --- a/test/lua-Harness/102-function.t +++ b/test/lua-Harness/102-function.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local has_op53 = _VERSION >= 'Lua 5.3' plan'no_plan' diff --git a/test/lua-Harness/103-nil.t b/test/lua-Harness/103-nil.t index 561b101..56cba00 100755 --- a/test/lua-Harness/103-nil.t +++ b/test/lua-Harness/103-nil.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local has_op53 = _VERSION >= 'Lua 5.3' plan'no_plan' diff --git a/test/lua-Harness/104-number.t b/test/lua-Harness/104-number.t index 0d4d3fd..0d038c4 100755 --- a/test/lua-Harness/104-number.t +++ b/test/lua-Harness/104-number.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local profile = require'profile' local has_op53 = _VERSION >= 'Lua 5.3' diff --git a/test/lua-Harness/105-string.t b/test/lua-Harness/105-string.t index cd8c88b..b45bf69 100755 --- a/test/lua-Harness/105-string.t +++ b/test/lua-Harness/105-string.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local profile = require'profile' local has_op53 = _VERSION >= 'Lua 5.3' diff --git a/test/lua-Harness/106-table.t b/test/lua-Harness/106-table.t index 0c0ba49..9c360eb 100755 --- a/test/lua-Harness/106-table.t +++ b/test/lua-Harness/106-table.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local has_op53 = _VERSION >= 'Lua 5.3' plan'no_plan' diff --git a/test/lua-Harness/107-thread.t b/test/lua-Harness/107-thread.t index 3d4af18..623ea41 100755 --- a/test/lua-Harness/107-thread.t +++ b/test/lua-Harness/107-thread.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local has_op53 = _VERSION >= 'Lua 5.3' plan'no_plan' diff --git a/test/lua-Harness/108-userdata.t b/test/lua-Harness/108-userdata.t index b1e3641..9956670 100755 --- a/test/lua-Harness/108-userdata.t +++ b/test/lua-Harness/108-userdata.t @@ -22,7 +22,7 @@ --]] -require'tap' +require'tap_local' local has_op53 = _VERSION >= 'Lua 5.3' plan'no_plan' diff --git a/test/lua-Harness/200-examples.t b/test/lua-Harness/200-examples.t index 362aae3..3a1f7cc 100755 --- a/test/lua-Harness/200-examples.t +++ b/test/lua-Harness/200-examples.t @@ -24,7 +24,7 @@ First tests in order to check infrastructure. --]] -require'tap' +require'tap_local' plan(5) diff --git a/test/lua-Harness/201-assign.t b/test/lua-Harness/201-assign.t index 7d023d8..f4e5e3e 100755 --- a/test/lua-Harness/201-assign.t +++ b/test/lua-Harness/201-assign.t @@ -28,13 +28,13 @@ L --]] -require'tap' +require'tap_local' local has_env = _VERSION >= 'Lua 5.2' plan'no_plan' do - is(b, nil, "global variable") + is(variable_exists('b'), nil, "global variable") b = 10 is(b, 10) if has_env then @@ -43,7 +43,7 @@ do error_like([[ _ENV = nil; b = 20 ]], "attempt to ") else - is(_ENV, nil, "no _ENV"); + is(variable_exists('_ENV'), nil, "no _ENV"); end b = nil is(b, nil) diff --git a/test/lua-Harness/202-expr.t b/test/lua-Harness/202-expr.t index 2576750..810b570 100755 --- a/test/lua-Harness/202-expr.t +++ b/test/lua-Harness/202-expr.t @@ -28,7 +28,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local nocvtn2s = profile.nocvtn2s local nocvts2n = profile.nocvts2n @@ -101,7 +101,7 @@ if not nocvtn2s then end error_like(function () return 'hello' + 1 end, - ((not nocvts2n and _VERSION >= 'Lua 5.4') or ravi) and "attempt to add" or "perform arithmetic", + ((not nocvts2n and _VERSION >= 'Lua 5.4') or variable_exists('ravi')) and "attempt to add" or "perform arithmetic", "no coercion") error_like(function () diff --git a/test/lua-Harness/203-lexico.t b/test/lua-Harness/203-lexico.t index c1abebf..3c127b9 100755 --- a/test/lua-Harness/203-lexico.t +++ b/test/lua-Harness/203-lexico.t @@ -31,7 +31,7 @@ L --]] -require'tap' +require'tap_local' local loadstring = loadstring or load local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') diff --git a/test/lua-Harness/204-grammar.t b/test/lua-Harness/204-grammar.t index d9ae3a6..197f9d9 100755 --- a/test/lua-Harness/204-grammar.t +++ b/test/lua-Harness/204-grammar.t @@ -28,7 +28,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local has_goto = _VERSION >= 'Lua 5.2' or jit local has_attr = _VERSION >= 'Lua 5.4' diff --git a/test/lua-Harness/211-scope.t b/test/lua-Harness/211-scope.t index 64eed52..3f02bab 100755 --- a/test/lua-Harness/211-scope.t +++ b/test/lua-Harness/211-scope.t @@ -30,7 +30,7 @@ See section "Local Variables and Blocks" in "Programming in Lua". --]] -require'tap' +require'tap_local' plan(10) diff --git a/test/lua-Harness/212-function.t b/test/lua-Harness/212-function.t index 2851053..6841308 100755 --- a/test/lua-Harness/212-function.t +++ b/test/lua-Harness/212-function.t @@ -30,7 +30,7 @@ See section "Functions" in "Programming in Lua". --]] -require'tap' +require'tap_local' local loadstring = loadstring or load plan(68) diff --git a/test/lua-Harness/213-closure.t b/test/lua-Harness/213-closure.t index fc3bd29..c0b6fb5 100755 --- a/test/lua-Harness/213-closure.t +++ b/test/lua-Harness/213-closure.t @@ -24,7 +24,7 @@ See section "Closures" in "Programming in Lua". --]] -require'tap' +require'tap_local' plan(15) diff --git a/test/lua-Harness/214-coroutine.t b/test/lua-Harness/214-coroutine.t index 92929e1..28c18ab 100755 --- a/test/lua-Harness/214-coroutine.t +++ b/test/lua-Harness/214-coroutine.t @@ -30,7 +30,7 @@ See section "Coroutines" in "Programming in Lua". --]] -require'tap' +require'tap_local' local profile = require'profile' local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') local has_coroutine52 = _VERSION >= 'Lua 5.2' or jit diff --git a/test/lua-Harness/221-table.t b/test/lua-Harness/221-table.t index 7ed6c65..4894d7e 100755 --- a/test/lua-Harness/221-table.t +++ b/test/lua-Harness/221-table.t @@ -24,7 +24,7 @@ See section "Tables" in "Programming in Lua". --]] -require'tap' +require'tap_local' plan(25) diff --git a/test/lua-Harness/222-constructor.t b/test/lua-Harness/222-constructor.t index a01be2e..79ed80c 100755 --- a/test/lua-Harness/222-constructor.t +++ b/test/lua-Harness/222-constructor.t @@ -30,7 +30,7 @@ See section "Table Constructors" in "Programming in Lua". --]] -require'tap' +require'tap_local' plan(16) diff --git a/test/lua-Harness/223-iterator.t b/test/lua-Harness/223-iterator.t index 777ad73..501588e 100755 --- a/test/lua-Harness/223-iterator.t +++ b/test/lua-Harness/223-iterator.t @@ -25,7 +25,7 @@ section "Coroutines as Iterators" in "Programming in Lua". --]] -require'tap' +require'tap_local' plan(8) diff --git a/test/lua-Harness/231-metatable.t b/test/lua-Harness/231-metatable.t index a2c6499..09412db 100755 --- a/test/lua-Harness/231-metatable.t +++ b/test/lua-Harness/231-metatable.t @@ -30,7 +30,7 @@ See section "Metatables and Metamethods" in "Programming in Lua". --]] -require'tap' +require'tap_local' local profile = require'profile' local has_metamethod52 = _VERSION >= 'Lua 5.2' or profile.luajit_compat52 local has_metamethod_ipairs = _VERSION == 'Lua 5.2' or profile.compat52 or profile.luajit_compat52 diff --git a/test/lua-Harness/232-object.t b/test/lua-Harness/232-object.t index 0d87572..e54258e 100755 --- a/test/lua-Harness/232-object.t +++ b/test/lua-Harness/232-object.t @@ -24,7 +24,7 @@ See section "Object-Oriented Programming" in "Programming in Lua". --]] -require'tap' +require'tap_local' plan(18) diff --git a/test/lua-Harness/241-standalone.t b/test/lua-Harness/241-standalone.t index c99f324..c6e5b69 100755 --- a/test/lua-Harness/241-standalone.t +++ b/test/lua-Harness/241-standalone.t @@ -28,8 +28,8 @@ L --]] -require'tap' -local has_bytecode = not ujit and not ravi +require'tap_local' +local has_bytecode = not variable_exists('ujit') and not variable_exists('ravi') local has_error52 = _VERSION >= 'Lua 5.2' local has_error53 = _VERSION >= 'Lua 5.3' local has_opt_E = _VERSION >= 'Lua 5.2' or jit @@ -37,7 +37,7 @@ local has_opt_W = _VERSION >= 'Lua 5.4' local banner = '^[%w%s%-%.]-Copyright %(C%) %d%d%d%d' if jit and jit.version:match'^RaptorJIT' then banner = '^[%w%s%.]- %-%- ' -elseif ravi then +elseif variable_exists('ravi') then banner = '^Ravi %d%.%d%.%d' end @@ -108,10 +108,10 @@ f:close() cmd = lua .. " -i hello-241.lua < hello-241.lua 2>&1" f = io.popen(cmd) like(f:read'*l', banner, "-i") -if ujit then +if variable_exists('ujit') then like(f:read'*l', '^JIT:') end -if ravi then +if variable_exists('ravi') then like(f:read'*l', '^Copyright %(C%)') like(f:read'*l', '^Portions Copyright %(C%)') like(f:read'*l', '^Options') @@ -190,7 +190,7 @@ f:close() cmd = lua .. [[ -v hello-241.lua 2>&1]] f = io.popen(cmd) like(f:read'*l', banner, "-v & script") -if ravi then +if variable_exists('ravi') then like(f:read'*l', '^Copyright %(C%)') like(f:read'*l', '^Portions Copyright %(C%)') like(f:read'*l', '^Options') @@ -228,14 +228,14 @@ end like(f:read'*l', "^usage: ", "no file") f:close() -cmd = lua .. [[ -ltap -e "print(type(ok))"]] +cmd = lua .. [[ -ltap_local -e "print(type(ok))"]] f = io.popen(cmd) -is(f:read'*l', 'function', "-ltap") +is(f:read'*l', 'function', "-ltap_local") f:close() -cmd = lua .. [[ -l tap -e "print(type(ok))"]] +cmd = lua .. [[ -l tap_local -e "print(type(ok))"]] f = io.popen(cmd) -is(f:read'*l', 'function', "-l tap") +is(f:read'*l', 'function', "-l tap_local") f:close() cmd = lua .. [[ -l lpeg -e "print(1)" 2>&1]] diff --git a/test/lua-Harness/242-luac.t b/test/lua-Harness/242-luac.t index 2d166e5..4755fc3 100755 --- a/test/lua-Harness/242-luac.t +++ b/test/lua-Harness/242-luac.t @@ -28,7 +28,7 @@ L --]] -require'tap' +require'tap_local' if jit then skip_all("LuaJIT") diff --git a/test/lua-Harness/301-basic.t b/test/lua-Harness/301-basic.t index e45599e..c11f21b 100755 --- a/test/lua-Harness/301-basic.t +++ b/test/lua-Harness/301-basic.t @@ -30,7 +30,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local has_error53 = _VERSION >= 'Lua 5.3' local has_gcinfo = _VERSION == 'Lua 5.1' @@ -300,7 +300,7 @@ end diag(msg) end type_ok(f, 'function', "function load(reader)") - is(bar, nil) + is(variable_exists('bar'), nil) f() is(bar('ok'), 'ok') bar = nil @@ -324,7 +324,7 @@ end if _VERSION == 'Lua 5.1' and not jit then todo("not with 5.1") end - is(baz, nil) + is(variable_exists('baz'), nil) t = { [[?syntax error?]] } i = 0 @@ -388,7 +388,7 @@ end ]] f:close() f = loadfile('foo-301.lua') - is(foo, nil, "function loadfile") + is(variable_exists('foo'), nil, "function loadfile") f() is(foo('ok'), 'ok') @@ -559,7 +559,7 @@ if has_rawlen then "^[^:]+:%d+: bad argument #1 to 'rawlen' %(table ", "function rawlen (bad arg)") else - is(rawlen, nil, "no rawlen") + is(variable_exists('rawlen'), nil, "no rawlen") end do -- rawget @@ -686,7 +686,7 @@ do -- type is(type(true), 'boolean') is(type(nil), 'nil') is(type(io.stdin), 'userdata') - is(type(type(X)), 'string') + is(type(type(variable_exists('X'))), 'string') local a = nil is(type(a), 'nil', "function type") @@ -791,7 +791,7 @@ if has_warn then "^[^:]+:%d+: bad argument #1 to 'warn' %(string expected, got no value%)", "function warn (no arg)") else - is(warn, nil, "no warn") + is(variable_exists('warn'), nil, "no warn") end do -- xpcall diff --git a/test/lua-Harness/303-package.t b/test/lua-Harness/303-package.t index 7e5216d..e9c1e07 100755 --- a/test/lua-Harness/303-package.t +++ b/test/lua-Harness/303-package.t @@ -30,7 +30,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') local has_loaders = _VERSION == 'Lua 5.1' @@ -130,9 +130,9 @@ end -- searchpath if has_searcherpath then - local p = package.searchpath('tap', package.path) + local p = package.searchpath('tap_local', package.path) type_ok(p, 'string', "searchpath") - p = package.searchpath('tap', 'bad path') + p = package.searchpath('tap_local', 'bad path') is(p, nil) else is(package.searchpath, nil, "no package.searchpath") @@ -265,12 +265,12 @@ if has_module then package.seeall(m) m.pass("function package.seeall") - is(mod, nil, "function module & seeall") + is(variable_exists('mod'), nil, "function module & seeall") module('mod', package.seeall) type_ok(mod, 'table') is(mod, package.loaded.mod) - is(modz, nil, "function module") + is(variable_exists('modz'), nil, "function module") local _G = _G module('modz') _G.type_ok(_G.modz, 'table') diff --git a/test/lua-Harness/304-string.t b/test/lua-Harness/304-string.t index 991600a..7ca57b7 100755 --- a/test/lua-Harness/304-string.t +++ b/test/lua-Harness/304-string.t @@ -30,7 +30,7 @@ L ]] -require'tap' +require'tap_local' local profile = require'profile' local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') local has_dump53 = _VERSION >= 'Lua 5.3' or jit @@ -396,7 +396,7 @@ do -- gsub function expand (str) return (string.gsub(str, '$(%w+)', function (n) - return tostring(_G[n]), 1 + return tostring(variable_exists(n)), 1 end)) end like(expand("print = $print; a = $a"), "^print = function: [0]?[Xx]?[builtin]*#?%x+; a = nil") diff --git a/test/lua-Harness/305-utf8.t b/test/lua-Harness/305-utf8.t index 4304b6c..14a7a28 100755 --- a/test/lua-Harness/305-utf8.t +++ b/test/lua-Harness/305-utf8.t @@ -30,7 +30,7 @@ L --]] -require 'tap' +require'tap_local' local profile = require'profile' local has_utf8 = _VERSION >= 'Lua 5.3' or (jit and jit.version:match'moonjit') or profile.utf8 diff --git a/test/lua-Harness/306-table.t b/test/lua-Harness/306-table.t index 9836655..59293f1 100755 --- a/test/lua-Harness/306-table.t +++ b/test/lua-Harness/306-table.t @@ -30,7 +30,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') local has_foreach = _VERSION == 'Lua 5.1' diff --git a/test/lua-Harness/307-math.t b/test/lua-Harness/307-math.t index 8b51ed1..1a49bcf 100755 --- a/test/lua-Harness/307-math.t +++ b/test/lua-Harness/307-math.t @@ -30,14 +30,14 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local has_integer = _VERSION >= 'Lua 5.3' or (jit and jit.version:match'moonjit') or profile.integer local has_mathx = _VERSION < 'Lua 5.3' or profile.compat52 or profile.compat53 or profile.has_mathx local has_log10 = _VERSION < 'Lua 5.2' or profile.compat51 or profile.has_math_log10 or profile.compat52 or profile.compat53 or profile.has_mathx local has_log_with_base = _VERSION >= 'Lua 5.2' or profile.compat52 -local has_mod = profile.has_math_mod or ujit +local has_mod = profile.has_math_mod or variable_exists('ujit') local nocvts2n = profile.nocvts2n or jit plan'no_plan' diff --git a/test/lua-Harness/308-io.t b/test/lua-Harness/308-io.t index cdbcb83..3857eb1 100755 --- a/test/lua-Harness/308-io.t +++ b/test/lua-Harness/308-io.t @@ -30,7 +30,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') local has_write51 = _VERSION == 'Lua 5.1' and (not profile.luajit_compat52 or ujit) diff --git a/test/lua-Harness/309-os.t b/test/lua-Harness/309-os.t index e42fb53..593df26 100755 --- a/test/lua-Harness/309-os.t +++ b/test/lua-Harness/309-os.t @@ -30,7 +30,7 @@ L --]] -require'tap' +require'tap_local' local profile = require'profile' local luajit20 = jit and (jit.version_num < 20100 and not jit.version:match'^RaptorJIT') local has_execute51 = _VERSION == 'Lua 5.1' and (not profile.luajit_compat52 or ujit) diff --git a/test/lua-Harness/310-debug.t b/test/lua-Harness/310-debug.t index f78af03..7079ee0 100755 --- a/test/lua-Harness/310-debug.t +++ b/test/lua-Harness/310-debug.t @@ -30,7 +30,7 @@ L ]] -require 'tap' +require'tap_local' local profile = require'profile' local has_getfenv = _VERSION == 'Lua 5.1' local has_gethook54 = _VERSION >= 'Lua 5.4' diff --git a/test/lua-Harness/311-bit32.t b/test/lua-Harness/311-bit32.t index 7023906..a12d669 100755 --- a/test/lua-Harness/311-bit32.t +++ b/test/lua-Harness/311-bit32.t @@ -29,11 +29,11 @@ L --]] -require 'tap' +require'tap_local' local profile = require'profile' local has_bit32 = _VERSION == 'Lua 5.2' or profile.compat52 or profile.has_bit32 -if not bit32 then +if not variable_exists('bit32') then plan(1) nok(has_bit32, "no has_bit32") os.exit(0) diff --git a/test/lua-Harness/314-regex.t b/test/lua-Harness/314-regex.t index ad4554c..315531c 100755 --- a/test/lua-Harness/314-regex.t +++ b/test/lua-Harness/314-regex.t @@ -49,7 +49,7 @@ Description of the test. --]] -require'tap' +require'tap_local' local loadstring = loadstring or load plan(162) diff --git a/test/lua-Harness/320-stdin.t b/test/lua-Harness/320-stdin.t index 36528e8..0af83c3 100755 --- a/test/lua-Harness/320-stdin.t +++ b/test/lua-Harness/320-stdin.t @@ -24,7 +24,7 @@ Tests Lua Basic & IO Libraries with stdin --]] -require'tap' +require'tap_local' local lua = arg[-3] or arg[-1] @@ -32,7 +32,7 @@ if not pcall(io.popen, lua .. [[ -e "a=1"]]) then skip_all "io.popen not supported" end -plan(12) +plan(11) do local f = io.open('lib-320.lua', 'w') @@ -64,10 +64,9 @@ end ]] f:close() - local cmd = lua .. [[ -e "f = loadfile(); print(foo); f(); print(foo('ok'))" < foo-320.lua]] + local cmd = lua .. [[ -e "f = loadfile(); f(); print(foo('ok'))" < foo-320.lua]] f = io.popen(cmd) - is(f:read'*l', 'nil', "function loadfile (stdin)") - is(f:read'*l', 'ok') + is(f:read'*l', 'ok', "function loadfile (stdin)") f:close() os.remove('foo-320.lua') -- clean up diff --git a/test/lua-Harness/401-bitop.t b/test/lua-Harness/401-bitop.t index f95aebf..2856e3d 100755 --- a/test/lua-Harness/401-bitop.t +++ b/test/lua-Harness/401-bitop.t @@ -24,7 +24,7 @@ See L. --]] -require 'tap' +require'tap_local' if not jit then skip_all("only with LuaJIT") diff --git a/test/lua-Harness/402-ffi.t b/test/lua-Harness/402-ffi.t index a2e32a5..d61ee12 100755 --- a/test/lua-Harness/402-ffi.t +++ b/test/lua-Harness/402-ffi.t @@ -24,7 +24,7 @@ See L. --]] -require 'tap' +require'tap_local' if not jit then skip_all("only with LuaJIT") @@ -39,7 +39,7 @@ end plan(33) -is(_G.ffi, nil, "ffi not loaded by default") +is(variable_exists('ffi'), nil, "ffi not loaded by default") ffi = require'ffi' is(package.loaded.ffi, ffi, "package.loaded") is(require'ffi', ffi, "require") diff --git a/test/lua-Harness/403-jit.t b/test/lua-Harness/403-jit.t index 0073c90..95f4031 100755 --- a/test/lua-Harness/403-jit.t +++ b/test/lua-Harness/403-jit.t @@ -24,7 +24,7 @@ See L. --]] -require 'tap' +require'tap_local' local profile = require'profile' if not jit then @@ -35,7 +35,7 @@ local compiled_with_jit = jit.status() local luajit20 = jit.version_num < 20100 and not jit.version:match'RaptorJIT' local has_jit_opt = compiled_with_jit local has_jit_security = jit.security -local has_jit_util = not ujit and not jit.version:match'RaptorJIT' +local has_jit_util = not variable_exists('ujit') and not jit.version:match'RaptorJIT' plan'no_plan' diff --git a/test/lua-Harness/404-ext.t b/test/lua-Harness/404-ext.t index 22a52c7..9ed93dd 100755 --- a/test/lua-Harness/404-ext.t +++ b/test/lua-Harness/404-ext.t @@ -24,7 +24,7 @@ See L. --]] -require 'tap' +require'tap_local' local profile = require'profile' local luajit21 = jit and (jit.version_num >= 20100 or jit.version:match'^RaptorJIT') diff --git a/test/lua-Harness/411-luajit.t b/test/lua-Harness/411-luajit.t index 05111be..bd09211 100755 --- a/test/lua-Harness/411-luajit.t +++ b/test/lua-Harness/411-luajit.t @@ -24,10 +24,10 @@ See L --]] -require'tap' +require'tap_local' local profile = require'profile' -if not jit or ujit then +if not jit or variable_exists('ujit') then skip_all("only with LuaJIT") end diff --git a/test/lua-Harness/CMakeLists.txt b/test/lua-Harness/CMakeLists.txt index 840a2f5..30077c0 100644 --- a/test/lua-Harness/CMakeLists.txt +++ b/test/lua-Harness/CMakeLists.txt @@ -18,7 +18,7 @@ add_custom_command( env LUA_PATH="./?.lua\;${LUAJIT_SOURCE_DIR}/?.lua\;\;" LUA_CPATH="./?${CMAKE_SHARED_LIBRARY_SUFFIX}\;${LUAJIT_SOURCE_DIR}/?${CMAKE_SHARED_LIBRARY_SUFFIX}\;\;" - ${PROVE} ${CMAKE_CURRENT_SOURCE_DIR} + ${PROVE} - < tests_list --exec "${LUAJIT_TEST_BINARY} -l profile_luajit21" --failures --shuffle && touch tests.ok diff --git a/test/lua-Harness/tap.lua b/test/lua-Harness/tap_local.lua similarity index 95% rename from test/lua-Harness/tap.lua rename to test/lua-Harness/tap_local.lua index 96afec7..4ad0dbd 100644 --- a/test/lua-Harness/tap.lua +++ b/test/lua-Harness/tap_local.lua @@ -39,7 +39,7 @@ function done_testing () end function skip_all (reason) - out = "1..0" + local out = "1..0" if reason then out = out .. " # SKIP " .. reason end @@ -196,6 +196,15 @@ function todo (reason, count) todo_reason = reason end +function variable_exists (name) + for k,_ in pairs(_G) do + if (k == name) then + return _G[name] + end + end + return nil +end + -- -- Copyright (c) 2009-2018 Francois Perrad -- diff --git a/test/lua-Harness/tests_list b/test/lua-Harness/tests_list new file mode 100644 index 0000000..7a7e2d1 --- /dev/null +++ b/test/lua-Harness/tests_list @@ -0,0 +1,50 @@ +000-sanity.t +001-if.t +002-table.t +011-while.t +012-repeat.t +014-fornum.t +015-forlist.t +090-tap.t +091-profile.t +101-boolean.t +102-function.t +103-nil.t +104-number.t +105-string.t +106-table.t +107-thread.t +108-userdata.t +200-examples.t +201-assign.t +202-expr.t +203-lexico.t +204-grammar.t +211-scope.t +212-function.t +213-closure.t +214-coroutine.t +221-table.t +222-constructor.t +223-iterator.t +231-metatable.t +232-object.t +241-standalone.t +242-luac.t +301-basic.t +303-package.t +304-string.t +305-utf8.t +306-table.t +307-math.t +308-io.t +309-os.t +310-debug.t +311-bit32.t +314-regex.t +320-stdin.t +401-bitop.t +402-ffi.t +403-jit.t +404-ext.t +411-luajit.t -- 2.25.1