diff --git a/test/module/net_sql.common.result b/test/module/net_sql.common.result index 2ac6a13cf1b9e68753def97a8267fcca25f26b3d..fcb0f13763fd0d9cfac492b5e53b19cd49128ade 100644 --- a/test/module/net_sql.common.result +++ b/test/module/net_sql.common.result @@ -1,4 +1,4 @@ -package.path = "../../src/module/sql/?.lua" +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" --- ... package.cpath = "?.so" diff --git a/test/module/net_sql.common.test.lua b/test/module/net_sql.common.test.lua index 6354cdaf68e787a13df9444973e272d460cbc7d0..8a730b54ee934e3cfea83ce35d9c13d8ad89252b 100644 --- a/test/module/net_sql.common.test.lua +++ b/test/module/net_sql.common.test.lua @@ -1,4 +1,4 @@ -package.path = "../../src/module/sql/?.lua" +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" package.cpath = "?.so" require("sql") diff --git a/test/module/net_sql.mysql.result b/test/module/net_sql.mysql.result index c19dd46de6b6c07ad995d35f69d81c217227092b..046e06737c3ec235f4d7b0fc378b648e73a42ce5 100644 --- a/test/module/net_sql.mysql.result +++ b/test/module/net_sql.mysql.result @@ -1,4 +1,5 @@ -package.path = "../../src/module/sql/?.lua" +--# push filter 'error: .*/src/module/sql/sql.lua' to 'error: src/module/sql/sql.lua' +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" --- ... package.cpath = "?.so" @@ -25,12 +26,12 @@ require("box.net.mysql") ... c = box.net.sql.connect('abcd') --- -- error: '../../src/module/sql/sql.lua:29: Unknown driver ''abcd''' +- error: src/module/sql/sql.lua:29: Unknown driver ''abcd''' ... c = box.net.sql.connect('mysql') --- -- error: '../../src/module/sql/sql.lua:64: Usage: box.net.sql.connect(''mysql'', host, - port, user, password, db, ...)' +- error: src/module/sql/sql.lua:64: Usage: box.net.sql.connect(''mysql'', + host, port, user, password, db, ...)' ... function dump(v) return box.cjson.encode(v) end --- @@ -50,9 +51,9 @@ for k, v in pairs(c) do print(k, ': ', type(v)) end ... c:execute('SEL ECT 1') --- -- error: '../../src/module/sql/sql.lua:105: You have an error in your SQL syntax; - check the manual that corresponds to your MySQL server version for the right syntax - to use near ''SEL ECT 1'' at line 1' +- error: src/module/sql/sql.lua:105: You have an error in your + SQL syntax; check the manual that corresponds to your MySQL server version for + the right syntax to use near ''SEL ECT 1'' at line 1' ... dump({c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')}) --- @@ -106,3 +107,4 @@ os.execute("rm -rf box/net/") --- - 0 ... +--# clear filter diff --git a/test/module/net_sql.mysql.skipcond b/test/module/net_sql.mysql.skipcond index 1ca4e47baff2e2e35b4d0628077e091c39ca5b1b..c3e469919b43829e75fa703fd74bd19fb178b9dc 100644 --- a/test/module/net_sql.mysql.skipcond +++ b/test/module/net_sql.mysql.skipcond @@ -1,6 +1,9 @@ import os +import os.path try: - (host, port, user, password, db) = os.getenv('MYSQL').split(':') + (host, port, user, password, db) = os.getenv('MYSQL').split(':') + if not os.path.exists(os.path.join(server.builddir, 'src/module/mysql/mysql.so')): + raise RuntimeError('No MySQL module found') except (RuntimeError, TypeError, NameError, AttributeError, ValueError): - self.skip = 1 + self.skip = 1 diff --git a/test/module/net_sql.mysql.test.lua b/test/module/net_sql.mysql.test.lua index 9b5539575c831c7dd82457785dd60996f7873eed..af690469ba931e3ba1982cfb71d875edd03a2478 100644 --- a/test/module/net_sql.mysql.test.lua +++ b/test/module/net_sql.mysql.test.lua @@ -1,4 +1,5 @@ -package.path = "../../src/module/sql/?.lua" +--# push filter 'error: .*/src/module/sql/sql.lua' to 'error: src/module/sql/sql.lua' +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" package.cpath = "?.so" require("sql") @@ -38,3 +39,4 @@ c:begin_work() c:commit() os.execute("rm -rf box/net/") +--# clear filter diff --git a/test/module/net_sql.pg.result b/test/module/net_sql.pg.result index d503dd6a9238eef3b7440b97c3f56e5417349a43..b9e722c36b84bb90d136f999a1a01d1c39e10760 100644 --- a/test/module/net_sql.pg.result +++ b/test/module/net_sql.pg.result @@ -1,4 +1,5 @@ -package.path = "../../src/module/sql/?.lua" +--# push filter 'error: .*/src/module/sql/sql.lua' to 'error: src/module/sql/sql.lua' +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" --- ... package.cpath = "?.so" @@ -25,7 +26,7 @@ require("box.net.pg") ... c = box.net.sql.connect('abcd') --- -- error: '../../src/module/sql/sql.lua:29: Unknown driver ''abcd''' +- error: src/module/sql/sql.lua:29: Unknown driver ''abcd''' ... dump = function(v) return box.cjson.encode(v) end --- @@ -94,7 +95,8 @@ dump({c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')}) ... dump({c:single('SELECT * FROM (VALUES (1,2), (2,3)) t')}) --- -- error: '../../src/module/sql/sql.lua:156: SQL request returned multiply rows' +- error: src/module/sql/sql.lua:156: SQL request returned multiply + rows' ... dump({c:single('SELECT * FROM (VALUES (1,2)) t')}) --- @@ -106,12 +108,12 @@ dump({c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')}) ... c:execute('SELEC T') --- -- error: "../../src/module/sql/sql.lua:105: ERROR: syntax error at or near \"SELEC\"\nLINE - 1: SELEC T\n ^\n" +- error: src/module/sql/sql.lua:105: ERROR: syntax error at + or near \"SELEC\"\nLINE 1: SELEC T\n ^\n" ... c = box.net.sql.connect('abcd') --- -- error: '../../src/module/sql/sql.lua:29: Unknown driver ''abcd''' +- error: src/module/sql/sql.lua:29: Unknown driver ''abcd''' ... c:quote('abc\"cde\"def') --- @@ -141,3 +143,4 @@ os.execute("rm -rf box/net/") --- - 0 ... +--# clear filter diff --git a/test/module/net_sql.pg.skipcond b/test/module/net_sql.pg.skipcond index e4648c24173eeadd008a8bc4fd12e73417be7d14..c8da9d2ff57ae5cafed10c116389d5482a5b6ceb 100644 --- a/test/module/net_sql.pg.skipcond +++ b/test/module/net_sql.pg.skipcond @@ -1,6 +1,9 @@ import os +import os.path try: - (host, port, user, password, db) = os.getenv('PG').split(':') + (host, port, user, password, db) = os.getenv('PG').split(':') + if not os.path.exists(os.path.join(server.builddir, 'src/module/pg/pg.so')): + raise RuntimeError('No PG module found') except (RuntimeError, TypeError, NameError, AttributeError, ValueError): - self.skip = 1 + self.skip = 1 diff --git a/test/module/net_sql.pg.test.lua b/test/module/net_sql.pg.test.lua index d888808e60ac753d63899849405402c6b69c0376..6ef277ee829ab722dea3304b5d0006ed47755ab2 100644 --- a/test/module/net_sql.pg.test.lua +++ b/test/module/net_sql.pg.test.lua @@ -1,4 +1,5 @@ -package.path = "../../src/module/sql/?.lua" +--# push filter 'error: .*/src/module/sql/sql.lua' to 'error: src/module/sql/sql.lua' +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" package.cpath = "?.so" require("sql") @@ -47,3 +48,4 @@ c:commit() c:txn(function(dbi) dbi:single('SELECT 1') end) os.execute("rm -rf box/net/") +--# clear filter diff --git a/test/test-run.py b/test/test-run.py index 47a9743ee30c57d84cce200f06f44800d5b53dcf..0f15bf095a9ba1b9ee92227a965ec23205d54b1a 100755 --- a/test/test-run.py +++ b/test/test-run.py @@ -130,13 +130,8 @@ class Options: exit(-1) -def setenv(args): - os.putenv("TARANTOOL_PLUGIN_DIR", - ':'.join( - (os.path.join(os.getcwd(), '../src/plugin/mysql'), - os.path.join(os.getcwd(), '../src/plugin/pg')) - ) - ) +def setenv(): + os.putenv("TARANTOOL_SRC_DIR", os.path.abspath('..')) ####################################################################### # Program body @@ -144,7 +139,6 @@ def setenv(args): def main(): options = Options() - setenv(options.args) oldcwd = os.getcwd() # Change the current working directory to where all test # collections are supposed to reside @@ -154,6 +148,7 @@ def main(): if not path: path = '.' os.chdir(path) + setenv() failed_tests = []