diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua index 04138154bc322034dd6698b97fbd533f0f56aa5d..8751ef82074a63b09ee733514c1f1c5892c428e6 100644 --- a/test/sql-tap/lua/sqltester.lua +++ b/test/sql-tap/lua/sqltester.lua @@ -3,6 +3,12 @@ local json = require('json') local test = tap.test("errno") local sql_tokenizer = require('sql_tokenizer') +-- pcall here, because we allow to run a test w/o test-run; use: +-- LUA_PATH='test/sql-tap/lua/?.lua;test/sql/lua/?.lua;;' \ +-- ./test/sql-tap/xxx.test.lua +local ok, test_run = pcall(require, 'test_run') +test_run = ok and test_run.new() or nil + local function flatten(arr) local result = { } @@ -411,8 +417,12 @@ test.do_eqp_test = function (self, label, sql, result) end setmetatable(_G, nil) -os.execute("rm -rf $(ls -d */)") -os.execute("rm -f *.snap *.xlog* *.vylog* *.run*") + +-- perform clean up only under test-run +if test_run then + os.execute("rm -rf $(ls -d */)") + os.execute("rm -f *.snap *.xlog* *.vylog* *.run*") +end -- start the database box.cfg{ @@ -421,8 +431,11 @@ box.cfg{ log="tarantool.log"; } -test_run = require('test_run').new() -engine = test_run:get_cfg('engine') +local engine = test_run and test_run:get_cfg('engine') or 'memtx' box.sql.execute('pragma sql_default_engine=\''..engine..'\'') +function test.engine(self) + return engine +end + return test diff --git a/test/sql-tap/selectG.test.lua b/test/sql-tap/selectG.test.lua index f9732658e762ca26dda71d1fe8abf51d8bb35199..d83b790f112319f054dd64f47b2a5a36dd82057c 100755 --- a/test/sql-tap/selectG.test.lua +++ b/test/sql-tap/selectG.test.lua @@ -27,6 +27,10 @@ testprefix = "selectG" -- for an O(N*N) inefficiency that was once in the code and that would make -- the insert run for over a minute. -- +local engine = test:engine() +local time_quota = + engine == 'memtx' and 25 or ( + engine == 'vinyl' and 50 or 0) -- seconds test:do_test( 100, function() @@ -42,7 +46,8 @@ test:do_test( test:execsql(sql) local end_time = os.time() -- max run time was increased because of parallel test run - return test:execsql( "SELECT count(x), sum(x), avg(x), "..(end_time - start_time).."<25 FROM t1;") + return test:execsql(("SELECT count(x), sum(x), avg(x), %d<%d FROM t1;") + :format(end_time - start_time, time_quota)) end, { -- <100> 100000, 5000050000, 50000.5, 1