diff --git a/test/module/net_sql.common.lua b/test/module/net_sql.common.lua index 715defa4329f047bde96bf188d89845fb69d2c5f..22f4ea4aed135c0a8d1bcbc6cabc35c8a60ac27a 100644 --- a/test/module/net_sql.common.lua +++ b/test/module/net_sql.common.lua @@ -1,4 +1,6 @@ -package.path = "../../src/module/sql/?.lua;"..package.path +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" +package.cpath = "?.so" + require("sql") if type(box.net.sql) ~= "table" then error("net.sql load failed") diff --git a/test/module/net_sql.common.result b/test/module/net_sql.common.result index 2d077342608b7be479ad3ca5c7a9e20d95954ee0..4f6b6e6b3b08605355b0703ab83a11d7b64077a3 100644 --- a/test/module/net_sql.common.result +++ b/test/module/net_sql.common.result @@ -4,5 +4,5 @@ lua type(box.net.sql) ... lua 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''' ... diff --git a/test/module/net_sql.common.test b/test/module/net_sql.common.test index b7e5db3a07237e6b1fa6d5338640ea4bb9299035..f4c6e5759e7debf4b1d3d17f6e7456f79e6e9be8 100644 --- a/test/module/net_sql.common.test +++ b/test/module/net_sql.common.test @@ -1,8 +1,12 @@ # encoding: tarantool +import sys server.stop() server.deploy(init_lua="module/net_sql.common.lua") +sys.stdout.push_filter("error: .*/src/module/sql/sql.lua", "error: src/module/sql/sql.lua") + exec admin "lua type(box.net.sql)" exec admin "lua c = box.net.sql.connect('abcd')" +sys.stdout.clear_all_filters() diff --git a/test/module/net_sql.mysql.lua b/test/module/net_sql.mysql.lua index d3ff697f2492ed4360d0aef96ffcf1df9c45f27d..fff78eeca2e327a1b2d903dee4ebd5eac59ddc1c 100644 --- a/test/module/net_sql.mysql.lua +++ b/test/module/net_sql.mysql.lua @@ -1,4 +1,6 @@ -package.path = "../../src/module/sql/?.lua;"..package.path +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" +package.cpath = "?.so" + require("sql") if type(box.net.sql) ~= "table" then error("net.sql load failed") diff --git a/test/module/net_sql.mysql.result b/test/module/net_sql.mysql.result index 4c32f11aa20e88f82f26a085fb99b83cfb48cd4c..38e854a3f8c4f21683c49350687ffb8e8162bf13 100644 --- a/test/module/net_sql.mysql.result +++ b/test/module/net_sql.mysql.result @@ -1,10 +1,10 @@ lua 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''' ... lua 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, ...)' ... lua dump = function(v) return box.cjson.encode(v) end --- @@ -33,7 +33,7 @@ port: string ... lua 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' ... lua dump({c:execute('SELECT ? AS bool1, ? AS bool2, ? AS nil, ? AS num, ? AS str', true, false, nil, 123, 'abc')}) --- diff --git a/test/module/net_sql.mysql.skipcond b/test/module/net_sql.mysql.skipcond index a9ba5af05bd19cc68238d4ec74fbd10767384998..1ea7c51207cf2084e01f4b02d11e1b9dddb07e67 100644 --- a/test/module/net_sql.mysql.skipcond +++ b/test/module/net_sql.mysql.skipcond @@ -3,7 +3,8 @@ import os 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(self.args.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 b/test/module/net_sql.mysql.test index 8f879eae50a6c25000786d4e7be29b6bb26de6a8..df5856a3adc6588966ea687e4276c813dd9f5edd 100644 --- a/test/module/net_sql.mysql.test +++ b/test/module/net_sql.mysql.test @@ -1,15 +1,22 @@ # encoding: tarantool import os import shutil +import sys module_path = os.path.join(vardir, "box/net") module_path_so = module_path + "/mysql.so" -os.makedirs(module_path) -shutil.copy("../src/module/mysql/mysql.so", module_path_so) +try: + os.makedirs(module_path) +except OSError: + pass + +shutil.copy(os.path.join(self.args.builddir, "src/module/mysql/mysql.so"), module_path_so) server.stop() server.deploy(init_lua="module/net_sql.mysql.lua") +sys.stdout.push_filter("error: .*/src/module/sql/sql.lua", "error: src/module/sql/sql.lua") + exec admin "lua c = box.net.sql.connect('abcd')" exec admin "lua c = box.net.sql.connect('mysql')" exec admin "lua dump = function(v) return box.cjson.encode(v) end" @@ -39,3 +46,6 @@ exec admin "lua c:commit()" os.unlink(module_path_so) os.removedirs(module_path) + +sys.stdout.clear_all_filters() + diff --git a/test/module/net_sql.pg.lua b/test/module/net_sql.pg.lua index 6711d955d3d5ee4d9146eaf87c16ae3d5a205773..9db3a2097c08d193b1ccb01a0204ff248e241168 100644 --- a/test/module/net_sql.pg.lua +++ b/test/module/net_sql.pg.lua @@ -1,4 +1,6 @@ -package.path = "../../src/module/sql/?.lua;"..package.path +package.path = os.getenv("TARANTOOL_SRC_DIR").."/src/module/sql/?.lua" +package.cpath = "?.so" + require("sql") if type(box.net.sql) ~= "table" then error("net.sql load failed") diff --git a/test/module/net_sql.pg.result b/test/module/net_sql.pg.result index c0477b13e5d67834d2aad464014cc9ac0cc34f82..d5231f0eacb6858b338957d8b91ce6ea3f7b17e7 100644 --- a/test/module/net_sql.pg.result +++ b/test/module/net_sql.pg.result @@ -1,10 +1,10 @@ lua 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''' ... lua c = box.net.sql.connect('pg') --- -error: '../../src/module/sql/sql.lua:64: Usage: box.net.sql.connect(''pg'', host, port, user, password, db, ...)' +error: src/module/sql/sql.lua:64: Usage: box.net.sql.connect(''pg'', host, port, user, password, db, ...)' ... lua dump = function(v) return box.cjson.encode(v) end --- @@ -72,7 +72,7 @@ lua dump({c:select('SELECT * FROM (VALUES (1,2), (2,3)) t')}) ... lua 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' ... lua dump({c:single('SELECT * FROM (VALUES (1,2)) t')}) --- @@ -84,14 +84,14 @@ lua dump({c:perform('SELECT * FROM (VALUES (1,2), (2,3)) t')}) ... lua c:execute('SELEC T') --- -error: '../../src/module/sql/sql.lua:105: ERROR: syntax error at or near "SELEC" +error: src/module/sql/sql.lua:105: ERROR: syntax error at or near "SELEC" LINE 1: SELEC T ^ ' ... lua 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''' ... lua c:quote('abc"cde"def') --- diff --git a/test/module/net_sql.pg.skipcond b/test/module/net_sql.pg.skipcond index 2eef42415dfcb494795503bf9226cd8b283eff85..b50d8f86eadf4d30bac34b2f65102025c33dacf1 100644 --- a/test/module/net_sql.pg.skipcond +++ b/test/module/net_sql.pg.skipcond @@ -3,7 +3,8 @@ import os 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(self.args.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 b/test/module/net_sql.pg.test index 3d1144824fec57ba49594828de32fbbbf7b650fb..a8ecf9a89017b2c4a9f3bae7a2f2d9bb12023cc4 100644 --- a/test/module/net_sql.pg.test +++ b/test/module/net_sql.pg.test @@ -1,15 +1,22 @@ # encoding: tarantool import os import shutil +import sys module_path = os.path.join(vardir, "box/net") module_path_so = module_path + "/pg.so" -os.makedirs(module_path) -shutil.copy("../src/module/pg/pg.so", module_path_so) +try: + os.makedirs(module_path) +except OSError: + pass + +shutil.copy(os.path.join(self.args.builddir,"src/module/pg/pg.so"), module_path_so) server.stop() server.deploy(init_lua="module/net_sql.pg.lua") +sys.stdout.push_filter("error: .*/src/module/sql/sql.lua", "error: src/module/sql/sql.lua") + exec admin "lua c = box.net.sql.connect('abcd')" exec admin "lua c = box.net.sql.connect('pg')" @@ -53,3 +60,6 @@ exec admin "lua c:txn(function(dbi) dbi:single('SELECT 1') end)" os.unlink(module_path_so) os.removedirs(module_path) + +sys.stdout.clear_all_filters() + diff --git a/test/module/sophia.test b/test/module/sophia.test index 2bb26137470d487da3fcb5f8c02578863d6cfe80..25a4c6fb95b900c868ada295cb799f1807c8eea1 100644 --- a/test/module/sophia.test +++ b/test/module/sophia.test @@ -4,8 +4,11 @@ import shutil module_path = os.path.join(vardir, "box") module_path_so = module_path + "/sophia.so" -os.makedirs(module_path) -shutil.copy("../src/module/sophia/sophia.so", module_path_so) +try: + os.makedirs(module_path) +except OSError: + pass +shutil.copy(os.path.join(self.args.builddir, "src/module/sophia/sophia.so"), module_path_so) server.stop() server.deploy(init_lua="module/sophia.lua") diff --git a/test/test-run.py b/test/test-run.py index 143b402277bbbb35e21913ea8ab27d05de716262..ed8759e072f77bd67b86b0ec9c87c92af932a43e 100755 --- a/test/test-run.py +++ b/test/test-run.py @@ -137,22 +137,13 @@ class Options: def setenv(): - os.putenv("TARANTOOL_PLUGIN_DIR", - string.join( - ( - os.path.join(os.getcwd(), '../src/plugin/mysql'), - os.path.join(os.getcwd(), '../src/plugin/pg') - ), - ':' - ) - ) + os.putenv("TARANTOOL_SRC_DIR", os.path.abspath('..')) ####################################################################### # Program body ####################################################################### def main(): - setenv() options = Options() oldcwd = os.getcwd() # Change the current working directory to where all test @@ -163,7 +154,8 @@ def main(): if not path: path = '.' os.chdir(path) - + setenv() + failed_tests = 0 try: