diff --git a/test/box/box_fiber.lua b/test/box/box_fiber.lua index 9d1ed63ce57fb25e4b6c53b4e5aa056de995c86b..55cc1be1bbc8927a2c6cd58e52fe50523dd74099 100644 --- a/test/box/box_fiber.lua +++ b/test/box/box_fiber.lua @@ -8,6 +8,8 @@ local printer_task -- tester task fiber local tester_task +-- test log +local result = {} -- -------------------------------------------------------------------------- -- -- printer task routines @@ -15,24 +17,24 @@ local tester_task -- odd printer local function odd(x) - print('A: odd ', x) + table.insert(result,'A: odd '..tostring(x)) box.fiber.yield(x) - print('B: odd ', x) + table.insert(result,'B: odd '..tostring(x)) end -- even printer local function even(x) - print('C: even ', x) + table.insert(result,'C: event '..tostring(x)) if x == 2 then return x end - print('D: even ', x) + table.insert(result,'D: event '..tostring(x)) end -- printer task routine main function local function printer_task_routine(x) - print("printer: tester status = ", box.fiber.status(tester_task)) - print("printer: printer status = ", box.fiber.status(printer_task)) + table.insert(result, "printer: tester status = " .. box.fiber.status(tester_task)) + table.insert(result, "printer: printer status = " .. box.fiber.status(printer_task)) for i = 1, x do if i == 3 then box.fiber.yield(-1) @@ -53,14 +55,13 @@ end -- tester task routine main function local function tester_task_routine() printer_task = box.fiber.create(printer_task_routine) - print("tester: status(tester) = ", box.fiber.status(tester_task)) - print("tester: status(printer) = ", box.fiber.status(printer_task)) - + table.insert(result, "tester: status(tester) = " .. box.fiber.status(tester_task)) + table.insert(result, "tester: status(printer) = " .. box.fiber.status(printer_task)) count = 1 while box.fiber.status(printer_task) ~= "dead" do - print("count: ", count) + table.insert(result, "count: " .. tostring(count)) box.fiber.resume(printer_task, 5) - print("status: ", box.fiber.status(printer_task)) + table.insert(result, "status: " .. box.fiber.status(printer_task)) count = count + 1 end end @@ -75,4 +76,5 @@ function box_fiber_run_test() -- run tester tester_task = box.fiber.create(tester_task_routine) box.fiber.resume(tester_task) + return result end diff --git a/test/box/lua.result b/test/box/lua.result index 1c5b2b114fd66a185c88df9a79994541727b7fd6..66fdf24a46c481611798294c1de8625a6df17684 100644 --- a/test/box/lua.result +++ b/test/box/lua.result @@ -1,199 +1,215 @@ -lua ---- -unknown command. try typing help. -... -lua 1 ---- - - 1 -... -print(' lua says: hello') ---- - lua says: hello -... -local t = {} for n in pairs(box) do table.insert(t, ' - box.' .. tostring(n)) end table.sort(t) for i = 1, #t do print(t[i]) end t = nil ---- - - box.auto_increment - - box.bless_space - - box.call_loadproc - - box.cfg - - box.cjson - - box.counter - - box.delete - - box.dostring - - box.error - - box.fiber - - box.flags - - box.index - - box.info - - box.insert - - box.ipc - - box.net - - box.on_reload_configuration - - box.pack - - box.process - - box.raise - - box.replace - - box.select - - box.select_limit - - box.select_range - - box.select_reverse_range - - box.session - - box.slab - - box.socket - - box.space - - box.stat - - box.time - - box.time64 - - box.tuple - - box.unpack - - box.update - - box.uuid - - box.uuid_hex +box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum') +--- +- [0, 0, 'tweedledum'] +... +box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num') +--- +- [0, 0, 'primary', 1752392040, 1, 1, 0, 'num'] +... +' lua says: hello' +--- +- ' lua says: hello' +... +t = {} for n in pairs(box) do table.insert(t, tostring(n)) end table.sort(t) +--- +... +t +--- +- - auto_increment + - call_loadproc + - cfg + - cfg_reload + - cjson + - coredump + - counter + - delete + - dostring + - error + - fiber + - flags + - index + - info + - insert + - ipc + - net + - on_reload_configuration + - pack + - plugin + - process + - raise + - replace + - replace_if_exists + - schema + - select + - select_limit + - select_range + - select_reverse_range + - session + - set_injection + - show_injections + - slab + - snapshot + - socket + - space + - stat + - time + - time64 + - tuple + - unpack + - update + - uuid + - uuid_hex +... +t = nil +--- ... box.pack() --- -error: 'bad argument #1 to ''?'' (string expected, got no value)' +- error: 'bad argument #1 to ''?'' (string expected, got no value)' ... box.pack(1) --- -error: 'box.pack: argument count does not match the format' +- error: 'box.pack: argument count does not match the format' ... box.pack('abc') --- -error: 'box.pack: argument count does not match the format' +- error: 'box.pack: argument count does not match the format' ... -print(box.pack('a', ' - hello')) +box.pack('a', ' - hello') --- - - hello +- ' - hello' ... -print(box.pack('Aa', ' - hello', ' world')) +box.pack('Aa', ' - hello', ' world') --- - - hello world +- ' - hello world' ... -print(box.pack('w', 0x30)) +box.pack('w', 0x30) --- -0 +- '0' ... -print(box.pack('www', 0x30, 0x30, 0x30)) +box.pack('www', 0x30, 0x30, 0x30) --- -000 +- '000' ... -print(box.pack('www', 0x3030, 0x30)) +box.pack('www', 0x3030, 0x30) --- -error: '[string "return print(box.pack(''www'', 0x3030, 0x30))"]:1: box.pack: argument count does not match the format' +- error: 'box.pack: argument count does not match the format' ... -print(string.byte(box.pack('w', 212345), 1, 2)) +string.byte(box.pack('w', 212345), 1, 2) --- -140250 +- 140 +- 250 ... -print(string.sub(box.pack('p', 1684234849), 2)) +string.sub(box.pack('p', 1684234849), 2) --- -abcd +- abcd ... -print(box.pack('p', 'this string is 45 characters long 1234567890 ')) +box.pack('p', 'this string is 45 characters long 1234567890 ') --- --this string is 45 characters long 1234567890 +- '-this string is 45 characters long 1234567890 ' ... -print(box.pack('s', 0x4d)) +box.pack('s', 0x4d) --- -M +- "M\0" ... -print(box.pack('ssss', 25940, 29811, 28448, 11883)) +box.pack('ssss', 25940, 29811, 28448, 11883) --- -Test ok. +- Test ok. ... -print(box.pack('SSSS', 25940, 29811, 28448, 11883)) +box.pack('SSSS', 25940, 29811, 28448, 11883) --- -Test ok. +- Test ok. ... -print(box.pack('SSSSSSSS', 28493, 29550, 27680, 27497, 29541, 20512, 29285, 8556)) +box.pack('SSSSSSSS', 28493, 29550, 27680, 27497, 29541, 20512, 29285, 8556) --- -Mons likes Perl! +- Mons likes Perl! ... -print(box.pack('bsilww', 84, 29541, 1802444916, 2338318684567380014ULL, 103, 111)) +box.pack('bsilww', 84, 29541, 1802444916, 2338318684567380014ULL, 103, 111) --- -Test ok. Let`s go +- Test ok. Let`s go ... -print(box.unpack('b', 'T')) +box.unpack('b', 'T') --- -84 +- 84 ... -print(box.unpack('s', 'Te')) +box.unpack('s', 'Te') --- -25940 +- 25940 ... -print(box.unpack('i', 'Test')) +box.unpack('i', 'Test') --- -1953719636 +- 1953719636 ... -print(box.unpack('l', 'Test ok.')) +box.unpack('l', 'Test ok.') --- -3344889333436081492 +- 3344889333436081492 ... box.unpack('bsil', box.pack('bsil', 255, 65535, 4294967295, tonumber64('18446744073709551615'))) --- - - 255 - - 65535 - - 4294967295 - - 18446744073709551615 +- 255 +- 65535 +- 4294967295 +- 18446744073709551615 ... box.unpack('www', box.pack('www', 255, 65535, 4294967295)) --- - - 255 - - 65535 - - 4294967295 +- 255 +- 65535 +- 4294967295 ... box.unpack('ppp', box.pack('ppp', 'one', 'two', 'three')) --- - - one - - two - - three +- one +- two +- three ... num, str, num64 = box.unpack('ppp', box.pack('ppp', 666, 'string', tonumber64('666666666666666'))) --- ... -print(box.unpack('i', num), str, box.unpack('l', num64)) +box.unpack('i', num), str, box.unpack('l', num64) --- -666string666666666666666 +- 666 +- string +- 666666666666666 ... box.unpack('=p', box.pack('=p', 1, '666')) --- - - 1 - - 666 +- 1 +- '666' ... box.unpack('','') --- ... box.unpack('ii', box.pack('i', 1)) --- -error: 'box.unpack(''i''): got 4 bytes (expected: 8+)' +- error: 'box.unpack(''i''): got 4 bytes (expected: 8+)' ... box.unpack('i', box.pack('ii', 1, 1)) --- -error: 'box.unpack(''i''): too many bytes: unpacked 4, total 8' +- error: 'box.unpack(''i''): too many bytes: unpacked 4, total 8' ... box.unpack('+p', box.pack('=p', 1, '666')) --- -error: 'box.unpack(''+p''): unexpected opcode: offset 0, expected ''+'',found ''=''' +- error: 'box.unpack(''+p''): unexpected opcode: offset 0, expected ''+'',found ''=''' ... box.process(13, box.pack('iiippp', 0, 1, 3, 1, 'testing', 'lua rocks')) --- - - 1: {'testing', 'lua rocks'} +- [1, 'testing', 'lua rocks'] ... box.process(17, box.pack('iiiiiip', 0, 0, 0, 2^31, 1, 1, 1)) --- - - 1: {'testing', 'lua rocks'} +- [1, 'testing', 'lua rocks'] ... box.process(21, box.pack('iiip', 0, 1, 1, 1)) --- - - 1: {'testing', 'lua rocks'} +- [1, 'testing', 'lua rocks'] ... box.process(17, box.pack('iiiiiip', 0, 0, 0, 2^31, 1, 1, 1)) --- ... box.process(22, box.pack('iii', 0, 0, 0)) --- -error: 'box.process(CALL, ...) is not allowed' +- error: box.process(CALL, ...) is not allowed ... call box.process('abc', 'def') An error occurred: ER_ILLEGAL_PARAMS, 'Illegal parameters, unsupported command code, check the error log' @@ -210,13 +226,12 @@ function f1() return 'testing', 1, false, -1, 1.123, 1e123, nil end ... f1() --- - - testing - - 1 - - false - - -1 - - 1.123 - - 1e+123 - - nil +- testing +- 1 +- false +- -1 +- 1.123 +- 1e+123 ... call f1() Found 7 tuples: @@ -248,7 +263,7 @@ insert into t0 values (1, 'test box delete') Insert OK, 1 row affected box.delete(0, 1) --- - - 1: {'test box delete'} +- [1, 'test box delete'] ... box.delete(0, 1) --- @@ -266,7 +281,7 @@ insert into t0 values ('abcd', 'test box delete') Insert OK, 1 row affected box.delete(0, 'abcd') --- - - 1684234849: {'test box delete'} +- [1684234849, 'test box delete'] ... box.delete(0, 'abcd') --- @@ -280,19 +295,19 @@ Found 1 tuple: [1684234849, 'test box.select()'] box.select(0, 0, 'abcd') --- - - 1684234849: {'test box.select()'} +- [1684234849, 'test box.select()'] ... box.select(0, 0) --- -error: 'Invalid key part count in an exact match (expected 1, got 0)' +- error: Invalid key part count in an exact match (expected 1, got 0) ... box.select(0, 1) --- -error: 'No index #1 is defined in space 0' +- error: 'No index #1 is defined in space 0' ... box.select(0) --- -error: '[string "-- box.lua (internal file)..."]:11: box.pack: expected 32-bit int' +- error: '[string "-- box.lua (internal file)..."]:11: box.pack: expected 32-bit int' ... call box.replace('0', 'abcd', 'hello', 'world') Found 1 tuple: @@ -345,7 +360,7 @@ Found 1 tuple: [1936941424, 'new', 1684234848] box.update(0, 'pass', '+p', 2, 1) --- - - 1936941424: {'new', 1684234849} +- [1936941424, 'new', 1684234849] ... call box.select('0', '0', 'pass') Found 1 tuple: @@ -365,283 +380,304 @@ Found 1 tuple: dofile(...) --- ... -fifo_max +fifomax --- - - nil +- 5 ... fifo_push('test', 1) --- - - 1953719668: {3, 4, 1, 0, 0, 0, 0} +- [1953719668, 3, 4, 1, 0, 0, 0, 0] ... fifo_push('test', 2) --- - - 1953719668: {4, 5, 1, 2, 0, 0, 0} +- [1953719668, 4, 5, 1, 2, 0, 0, 0] ... fifo_push('test', 3) --- - - 1953719668: {5, 6, 1, 2, 3, 0, 0} +- [1953719668, 5, 6, 1, 2, 3, 0, 0] ... fifo_push('test', 4) --- - - 1953719668: {6, 7, 1, 2, 3, 4, 0} +- [1953719668, 6, 7, 1, 2, 3, 4, 0] ... fifo_push('test', 5) --- - - 1953719668: {7, 3, 1, 2, 3, 4, 5} +- [1953719668, 7, 3, 1, 2, 3, 4, 5] ... fifo_push('test', 6) --- - - 1953719668: {3, 4, 6, 2, 3, 4, 5} +- [1953719668, 3, 4, 6, 2, 3, 4, 5] ... fifo_push('test', 7) --- - - 1953719668: {4, 5, 6, 7, 3, 4, 5} +- [1953719668, 4, 5, 6, 7, 3, 4, 5] ... fifo_push('test', 8) --- - - 1953719668: {5, 6, 6, 7, 8, 4, 5} +- [1953719668, 5, 6, 6, 7, 8, 4, 5] ... fifo_top('test') --- - - 8 +- 8 ... box.delete(0, 'test') --- - - 1953719668: {5, 6, 6, 7, 8, 4, 5} +- [1953719668, 5, 6, 6, 7, 8, 4, 5] ... fifo_top('test') --- - - 0 +- 0 ... box.delete(0, 'test') --- - - 1953719668: {3, 3, 0, 0, 0, 0, 0} -... -for k,v in pairs(box.cfg) do print(' - ', k, ': ', v) end ---- - - io_collect_interval: 0 - - pid_file: box.pid - - slab_alloc_minimal: 64 - - slab_alloc_arena: 0.1 - - log_level: 4 - - logger_nonblock: true - - memcached_expire_per_loop: 1024 - - snap_dir: . - - coredump: false - - panic_on_snap_error: true - - memcached_expire_full_sweep: 3600 - - replication_port: 0 - - wal_fsync_delay: 0 - - too_long_threshold: 0.5 - - slab_alloc_factor: 2 - - admin_port: 33015 - - logger: cat - >> tarantool.log - - snap_io_rate_limit: 0 - - wal_writer_inbox_size: 16384 - - wal_dir_rescan_delay: 0.1 - - backlog: 1024 - - secondary_port: 33014 - - wal_dir: . - - local_hot_standby: false - - wal_mode: fsync_delay - - rows_per_wal: 50 - - readahead: 16320 - - panic_on_wal_error: false - - script_dir: . - - primary_port: 33013 - - bind_ipaddr: INADDR_ANY - - memcached_port: 0 - - memcached_space: 23 - - memcached_expire: false -... -for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then print(' - ', k, ': ', v) end end ---- - - enabled: true - - arity: 0 - - n: 0 -... -reload configuration ---- -ok -... -for k,v in pairs(box.cfg) do print(' - ', k, ': ', v) end ---- - - io_collect_interval: 0 - - pid_file: box.pid - - slab_alloc_minimal: 64 - - slab_alloc_arena: 0.1 - - log_level: 4 - - logger_nonblock: true - - memcached_expire_per_loop: 1024 - - snap_dir: . - - coredump: false - - panic_on_snap_error: true - - memcached_expire_full_sweep: 3600 - - replication_port: 0 - - wal_fsync_delay: 0 - - too_long_threshold: 0.5 - - slab_alloc_factor: 2 - - admin_port: 33015 - - logger: cat - >> tarantool.log - - snap_io_rate_limit: 0 - - wal_writer_inbox_size: 16384 - - wal_dir_rescan_delay: 0.1 - - backlog: 1024 - - secondary_port: 33014 - - wal_dir: . - - local_hot_standby: false - - wal_mode: fsync_delay - - rows_per_wal: 50 - - readahead: 16320 - - panic_on_wal_error: false - - script_dir: . - - primary_port: 33013 - - bind_ipaddr: INADDR_ANY - - memcached_port: 0 - - memcached_space: 23 - - memcached_expire: false -... -for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then print(' - ', k, ': ', v) end end ---- - - enabled: true - - arity: 0 - - n: 0 +- [1953719668, 3, 3, 0, 0, 0, 0, 0] +... +t = {} for k,v in pairs(box.cfg) do table.insert(t, k..': '..tostring(v)) end +--- +... +t +--- +- - 'io_collect_interval: 0' + - 'pid_file: box.pid' + - 'slab_alloc_minimal: 64' + - 'slab_alloc_arena: 0.1' + - 'log_level: 4' + - 'logger_nonblock: true' + - 'memcached_expire_per_loop: 1024' + - 'snap_dir: .' + - 'coredump: false' + - 'panic_on_snap_error: true' + - 'memcached_expire_full_sweep: 3600' + - 'replication_port: 0' + - 'wal_fsync_delay: 0' + - 'too_long_threshold: 0.5' + - 'slab_alloc_factor: 2' + - 'admin_port: 33015' + - 'logger: cat - >> tarantool.log' + - 'snap_io_rate_limit: 0' + - 'wal_dir_rescan_delay: 0.1' + - 'backlog: 1024' + - 'secondary_port: 33014' + - 'wal_dir: .' + - 'local_hot_standby: false' + - 'wal_mode: fsync_delay' + - 'rows_per_wal: 50' + - 'readahead: 16320' + - 'panic_on_wal_error: false' + - 'script_dir: .' + - 'primary_port: 33013' + - 'bind_ipaddr: INADDR_ANY' + - 'memcached_port: 0' + - 'memcached_space: 23' + - 'memcached_expire: false' +... +t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then table.insert(t, k..': '..tostring(v)) end end +--- +... +t +--- +- - 'enabled: true' + - 'arity: 0' + - 'n: 0' +... +box.cfg_reload() +--- +... +t = {} for k,v in pairs(box.cfg) do table.insert(t, k..': '..tostring(v)) end +--- +... +t +--- +- - 'io_collect_interval: 0' + - 'pid_file: box.pid' + - 'slab_alloc_minimal: 64' + - 'slab_alloc_arena: 0.1' + - 'log_level: 4' + - 'logger_nonblock: true' + - 'memcached_expire_per_loop: 1024' + - 'snap_dir: .' + - 'coredump: false' + - 'panic_on_snap_error: true' + - 'memcached_expire_full_sweep: 3600' + - 'replication_port: 0' + - 'wal_fsync_delay: 0' + - 'too_long_threshold: 0.5' + - 'slab_alloc_factor: 2' + - 'admin_port: 33015' + - 'logger: cat - >> tarantool.log' + - 'snap_io_rate_limit: 0' + - 'wal_dir_rescan_delay: 0.1' + - 'backlog: 1024' + - 'secondary_port: 33014' + - 'wal_dir: .' + - 'local_hot_standby: false' + - 'wal_mode: fsync_delay' + - 'rows_per_wal: 50' + - 'readahead: 16320' + - 'panic_on_wal_error: false' + - 'script_dir: .' + - 'primary_port: 33013' + - 'bind_ipaddr: INADDR_ANY' + - 'memcached_port: 0' + - 'memcached_space: 23' + - 'memcached_expire: false' +... +t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then table.insert(t, k..': '..tostring(v)) end end +--- +... +t +--- +- - 'enabled: true' + - 'arity: 0' + - 'n: 0' ... box.cfg.nosuchoption = 1 --- -error: '[string "box.cfg = {}..."]:43: Attempt to modify a read-only table' +- error: '[string "box.cfg = {}..."]:45: Attempt to modify a read-only table' ... box.space[300] = 1 --- ... box.index.new('abc', 'cde') --- -error: 'bad argument #1 to ''?'' (number expected, got string)' +- error: 'bad argument #1 to ''?'' (number expected, got string)' ... box.index.new(1, 2) --- -error: 'Space 1 does not exist' +- error: Space 1 does not exist ... box.index.new(0, 1) --- -error: 'No index #1 is defined in space 0' +- error: 'No index #1 is defined in space 0' ... box.index.new(0, 0) --- - - index 0 +-index 0 ... #box.index.new(0,0) --- - - 0 +- 0 ... #box.space[0].index[0].idx --- - - 0 +- 0 ... box.insert(0, 'test') --- - - 1953719668: {} +- [1953719668] ... box.insert(0, 'abcd') --- - - 1684234849: {} +- [1684234849] ... #box.index.new(0,0) --- - - 2 +- 2 ... #box.space[0].index[0].idx --- - - 2 +- 2 ... box.delete(0, 'test') --- - - 1953719668: {} +- [1953719668] ... #box.index.new(0,0) --- - - 1 +- 1 ... box.delete(0, 'abcd') --- - - 1684234849: {} +- [1684234849] ... #box.space[0].index[0].idx --- - - 0 +- 0 ... #box.index.new(0,0) --- - - 0 +- 0 ... box.space[0]:insert('test', 'hello world') --- - - 1953719668: {'hello world'} +- [1953719668, 'hello world'] ... box.space[0]:update('test', '=p', 1, 'bye, world') --- - - 1953719668: {'bye, world'} +- [1953719668, 'bye, world'] ... box.space[0]:delete('test') --- - - 1953719668: {'bye, world'} +- [1953719668, 'bye, world'] ... t=box.space[0]:insert('test') --- ... t:next('abcd') --- -error: 'tuple.next(): bad arguments' +- error: 'tuple.next(): bad arguments' ... t:next(1) --- -error: 'tuple.next(): bad arguments' +- error: 'tuple.next(): bad arguments' ... t:next(t) --- -error: 'bad argument #2 to ''?'' (box.tuple.iterator expected, got userdata)' +- error: 'bad argument #2 to ''?'' (box.tuple.iterator expected, got userdata)' ... t:next(t:next()) --- -error: 'tuple.next(): bad arguments' +- error: 'tuple.next(): bad arguments' ... -for k, v in t:pairs() do print(v) end +ta = {} for k, v in t:pairs() do table.insert(ta, v) end --- -test +... +ta +--- +- - test ... t=box.space[0]:replace('test', 'another field') --- ... -for k, v in t:pairs() do print(v) end +ta = {} for k, v in t:pairs() do table.insert(ta, v) end +--- +... +ta --- -test -another field +- - test + - another field ... t=box.space[0]:replace('test', 'another field', 'one more') --- ... -for k, v in t:pairs() do print(v) end +ta = {} for k, v in t:pairs() do table.insert(ta, v) end +--- +... +ta --- -test -another field -one more +- - test + - another field + - one more ... t=box.tuple.new({'a', 'b', 'c', 'd'}) --- ... -for it,field in t:pairs() do print(field); end +ta = {} for it,field in t:pairs() do table.insert(ta, field); end --- -a -b -c -d +... +ta +--- +- - a + - b + - c + - d ... it, field = t:next() --- ... getmetatable(it) --- - - box.tuple.iterator +- box.tuple.iterator ... box.space[0]:truncate() --- @@ -657,15 +693,15 @@ box.fiber.sleep(0.0001) ... box.fiber.sleep('hello') --- -error: 'fiber.sleep(delay): bad arguments' +- error: 'fiber.sleep(delay): bad arguments' ... box.fiber.sleep(box, 0.001) --- -error: 'fiber.sleep(delay): bad arguments' +- error: 'fiber.sleep(delay): bad arguments' ... box.fiber.cancel(box.fiber.self()) --- -error: 'fiber.cancel(): subject fiber does not permit cancel' +- error: 'fiber.cancel(): subject fiber does not permit cancel' ... f = box.fiber.self() --- @@ -675,43 +711,44 @@ old_id = f:id() ... box.fiber.cancel(f) --- -error: 'fiber.cancel(): subject fiber does not permit cancel' +- error: 'fiber.cancel(): subject fiber does not permit cancel' ... box.fiber.self():id() - old_id < 3 --- - - true +- true ... box.fiber.cancel(box.fiber.self()) --- -error: 'fiber.cancel(): subject fiber does not permit cancel' +- error: 'fiber.cancel(): subject fiber does not permit cancel' ... box.fiber.self():id() - old_id < 5 --- - - true +- true ... g = box.fiber.self() --- ... f==g --- - - true +- true ... function r() f = box.fiber.create(r) return (box.fiber.resume(f)) end --- ... r() --- - - true +- true ... f = box.fiber.create(print('hello') --- -error: '[string "f = box.fiber.create(print(''hello'')"]:1: '')'' expected near ''<eof>''' +- error: '[string "f = box.fiber.create(print(''hello'')"]:1: '')'' expected near + ''<eof>''' ... box.fiber.resume(f) --- -error: 'fiber.resume(): the fiber is dead' +- error: 'fiber.resume(): the fiber is dead' ... -function r(a, b) print(a) print(b) return a, b end +function r(a, b) return a, b end --- ... f=box.fiber.create(r) @@ -719,44 +756,33 @@ f=box.fiber.create(r) ... box.fiber.resume(f) --- -nil -nil - - true - - nil - - nil +- true ... f=box.fiber.create(r) --- ... box.fiber.resume(f, 'hello') --- -hello -nil - - true - - hello - - nil +- true +- hello ... f=box.fiber.create(r) --- ... box.fiber.resume(f, 'hello', 'world') --- -hello -world - - true - - hello - - world +- true +- hello +- world ... f=box.fiber.create(r) --- ... box.fiber.resume(f, 'hello', 'world', 'wide') --- -hello -world - - true - - hello - - world +- true +- hello +- world ... function y(a, b) c=box.fiber.yield(a) return box.fiber.yield(b, c) end --- @@ -766,18 +792,18 @@ f=box.fiber.create(y) ... box.fiber.resume(f, 'hello', 'world') --- - - hello +- hello ... box.fiber.resume(f, 'wide') --- - - world - - wide +- world +- wide ... box.fiber.resume(f) --- - - true +- true ... -function y() print('started') box.fiber.detach() while true do box.replace(0, 'test', os.time()) box.fiber.sleep(0.001) end end +function y() box.fiber.detach() while true do box.replace(0, 'test', os.time()) box.fiber.sleep(0.001) end end --- ... f = box.fiber.create(y) @@ -785,7 +811,6 @@ f = box.fiber.create(y) ... box.fiber.resume(f) --- -started ... box.fiber.sleep(0.002) --- @@ -795,7 +820,7 @@ box.fiber.cancel(f) ... box.fiber.resume(f) --- -error: 'fiber.resume(): the fiber is dead' +- error: 'fiber.resume(): the fiber is dead' ... f=nil --- @@ -805,19 +830,19 @@ for k=1, 10000, 1 do box.fiber.create(function() box.fiber.detach() end) end ... collectgarbage('collect') --- - - 0 +- 0 ... box.fiber.find(900) --- - - nil +{} ... box.fiber.find(910) --- - - nil +{} ... box.fiber.find(920) --- - - nil +{} ... f = function() box.fiber.wrap(f) end --- @@ -832,22 +857,22 @@ f('hello ', 'world') ... result --- - - hello world +- hello world ... f('bye ', 'world') --- ... result --- - - bye world +- bye world ... box.fiber.wrap(function() result = box.fiber.status() end) --- - - nil +{} ... result --- - - running +- running ... # A test case for Bug#933487 # tarantool crashed during shutdown if non running LUA fiber @@ -856,22 +881,22 @@ result f = box.fiber.create(function () return true end) --- ... -save snapshot +box.snapshot() --- -ok +- ok ... -save snapshot +box.snapshot() --- -fail: can't save snapshot, errno 17 (File exists) +- 'error: can''t save snapshot, errno 17 (File exists)' ... -save snapshot +box.snapshot() --- -fail: can't save snapshot, errno 17 (File exists) +- 'error: can''t save snapshot, errno 17 (File exists)' ... box.fiber.resume(f) --- - - true - - true +- true +- true ... f = box.fiber.create(function () return true end) --- @@ -881,33 +906,33 @@ f = box.fiber.create(function () return true end) # box.space[0]:insert('test', 'something to splice') --- -error: 'Duplicate key exists in unique index 0' +- error: Duplicate key exists in unique index 0 ... box.space[0]:update('test', ':p', 1, box.pack('ppp', 0, 4, 'no')) --- - - 1953719668: {28526} +- [1953719668, 28526] ... box.space[0]:update('test', ':p', 1, box.pack('ppp', 0, 2, 'every')) --- - - 1953719668: {'every'} +- [1953719668, 'every'] ... box.space[0]:update('test', ':p', 1, box.pack('ppp', 100, 2, 'every')) --- - - 1953719668: {'everyevery'} +- [1953719668, 'everyevery'] ... box.space[0]:update('test', ':p', 1, box.pack('ppp', -100, 2, 'every')) --- -error: 'Field SPLICE error: offset is out of bound' +- error: 'Field SPLICE error: offset is out of bound' ... box.space[0]:truncate() --- ... box.space[0]:insert('test', 'hello', 'october', '20th'):unpack() --- - - test - - hello - - october - - 20th +- test +- hello +- october +- 20th ... box.space[0]:truncate() --- @@ -988,14 +1013,14 @@ box.crossjoin(0, 0, 10000) ... box.space[0]:insert(1) --- - - 1: {} +- [1] ... call box.crossjoin('0', '0', '10000') Found 1 tuple: [1, 1] box.space[0]:insert(2) --- - - 2: {} +- [2] ... call box.crossjoin('0', '0', '10000') Found 4 tuples: @@ -1005,7 +1030,7 @@ Found 4 tuples: [2, 2] box.space[0]:insert(3, 'hello') --- - - 3: {'hello'} +- [3, 'hello'] ... call box.crossjoin('0', '0', '10000') Found 9 tuples: @@ -1020,11 +1045,11 @@ Found 9 tuples: [3, 'hello', 3, 'hello'] box.space[0]:insert(4, 'world') --- - - 4: {'world'} +- [4, 'world'] ... box.space[0]:insert(5, 'hello world') --- - - 5: {'hello world'} +- [5, 'hello world'] ... call box.crossjoin('0', '0', '10000') Found 25 tuples: @@ -1065,18 +1090,18 @@ box.crossjoin = nil pcall(box.insert, 99, 1, 'test') --- - - false - - Space 99 does not exist +- false +- Space 99 does not exist ... pcall(box.insert, 0, 1, 'hello') --- - - true - - 1: {'hello'} +- true +- [1, 'hello'] ... pcall(box.insert, 0, 1, 'hello') --- - - false - - Duplicate key exists in unique index 0 +- false +- Duplicate key exists in unique index 0 ... box.space[0]:truncate() --- @@ -1087,7 +1112,8 @@ box.space[0]:truncate() os.execute('ls') --- -error: '[string "return os.execute(''ls'')"]:1: attempt to call field ''execute'' (a nil value)' +- error: '[string "return os.execute(''ls'')"]:1: attempt to call field ''execute'' + (a nil value)' ... # @@ -1102,84 +1128,84 @@ dofile(...) box.fiber.status(1) --- -error: 'bad argument #1 to ''?'' (box.fiber expected, got number)' +- error: 'bad argument #1 to ''?'' (box.fiber expected, got number)' ... box.fiber.status('fafa-gaga') --- -error: 'bad argument #1 to ''?'' (box.fiber expected, got string)' +- error: 'bad argument #1 to ''?'' (box.fiber expected, got string)' ... box.fiber.status(nil) --- -error: 'bad argument #1 to ''?'' (box.fiber expected, got nil)' +- error: 'bad argument #1 to ''?'' (box.fiber expected, got nil)' ... # run fiber's test box_fiber_run_test() --- -tester: status(tester) = running -tester: status(printer) = suspended -count: 1 -printer: tester status = normal -printer: printer status = running -A: odd 1 -status: suspended -count: 2 -B: odd 1 -C: even 2 -status: suspended -count: 3 -A: odd 3 -status: suspended -count: 4 -B: odd 3 -C: even 4 -D: even 4 -A: odd 5 -status: suspended -count: 5 -B: odd 5 -status: dead +- - 'tester: status(tester) = running' + - 'tester: status(printer) = suspended' + - 'count: 1' + - 'printer: tester status = normal' + - 'printer: printer status = running' + - 'A: odd 1' + - 'status: suspended' + - 'count: 2' + - 'B: odd 1' + - 'C: event 2' + - 'status: suspended' + - 'count: 3' + - 'A: odd 3' + - 'status: suspended' + - 'count: 4' + - 'B: odd 3' + - 'C: event 4' + - 'D: event 4' + - 'A: odd 5' + - 'status: suspended' + - 'count: 5' + - 'B: odd 5' + - 'status: dead' ... tonumber64(123) --- - - 123 +- 123 ... tonumber64('123') --- - - 123 +- 123 ... type(tonumber64('123')) == 'cdata' --- - - true +- true ... tonumber64('9223372036854775807') == tonumber64('9223372036854775807') --- - - true +- true ... tonumber64('9223372036854775807') - tonumber64('9223372036854775800') --- - - 7 +- 7 ... tonumber64('18446744073709551615') == tonumber64('18446744073709551615') --- - - true +- true ... tonumber64('18446744073709551615') + 1 --- - - 0 +- 0 ... tonumber64(-1) --- - - 18446744073709551615 +- 18446744073709551615 ... tonumber64('184467440737095516155') --- -error: 'lua_tointeger64: bad argument' +- error: 'lua_tointeger64: bad argument' ... string.byte(box.pack('p', tonumber64(123))) --- - - 8 +- 8 ... box.space[0]:truncate() --- @@ -1201,7 +1227,7 @@ Found 1 tuple: [896755060] box.update(0, 'tes5', '#p', 0, '') --- -error: 'Illegal parameters, tuple must have all indexed fields' +- error: Illegal parameters, tuple must have all indexed fields ... box.space[0]:truncate() --- @@ -1211,45 +1237,45 @@ box.space[0]:truncate() box.insert(0, 1, 3, 6, 9) --- - - 1: {3, 6, 9} +- [1, 3, 6, 9] ... box.update(0, 1, '!p', 1, 2) --- - - 1: {2, 3, 6, 9} +- [1, 2, 3, 6, 9] ... box.update(0, 1, '!p!p!p!p', 3, 4, 3, 5, 4, 7, 4, 8) --- - - 1: {2, 3, 5, 8, 7, 4, 6, 9} +- [1, 2, 3, 5, 8, 7, 4, 6, 9] ... box.update(0, 1, '!p!p!p', 9, 10, 9, 11, 9, 12) --- - - 1: {2, 3, 5, 8, 7, 4, 6, 9, 12, 11, 10} +- [1, 2, 3, 5, 8, 7, 4, 6, 9, 12, 11, 10] ... box.space[0]:truncate() --- ... box.insert(0, 1, 'tuple') --- - - 1: {'tuple'} +- [1, 'tuple'] ... box.update(0, 1, '#p!p=p', 1, '', 1, 'inserted tuple', 2, 'set tuple') --- - - 1: {'inserted tuple', 'set tuple'} +- [1, 'inserted tuple', 'set tuple'] ... box.space[0]:truncate() --- ... box.insert(0, 1, 'tuple') --- - - 1: {'tuple'} +- [1, 'tuple'] ... box.update(0, 1, '=p!p#p', 1, 'set tuple', 1, 'inerted tuple', 2, '') --- - - 1: {'inerted tuple'} +- [1, 'inerted tuple'] ... box.update(0, 1, '!p!p', 0, 3, 0, 2) --- - - 2: {3, 1, 'inerted tuple'} +- [2, 3, 1, 'inerted tuple'] ... box.space[0]:truncate() --- @@ -1273,18 +1299,18 @@ Found 4 tuples: box.replace(0, 1, 'field string value') --- - - 1: {'field string value'} +- [1, 'field string value'] ... box.update(0, 1, '=p=p=p', 1, 'new field string value', 2, 42, 3, 0xdeadbeef) --- - - 1: {'new field string value', 42, 3735928559} +- [1, 'new field string value', 42, 3735928559] ... # test update's arith opearations box.update(0, 1, '+p&p|p^p', 2, 16, 3, 0xffff0000, 3, 0x0000a0a0, 3, 0xffff00aa) --- - - 1: {'new field string value', 58, 559063050} +- [1, 'new field string value', 58, 559063050] ... # test update splice operation @@ -1294,25 +1320,26 @@ ops_list = {} ... table.insert(ops_list, box.upd.splice(1, 0, 3, 'the newest')) --- -error: '[string "return table.insert(ops_list, box.upd.splice(..."]:1: attempt to index field ''upd'' (a nil value)' +- error: '[string "return table.insert(ops_list, box.upd.splice(..."]:1: attempt to + index field ''upd'' (a nil value)' ... box.update(0, 1, ':p', 1, box.pack('ppp', 0, 3, 'the newest')) --- - - 1: {'the newest field string value', 58, 559063050} +- [1, 'the newest field string value', 58, 559063050] ... # test update delete operations box.update(0, 1, '#p#p', 3, '', 2, '') --- - - 1: {'the newest field string value'} +- [1, 'the newest field string value'] ... # test update insert operations box.update(0, 1, '!p!p!p!p', 1, 1, 1, 2, 1, 3, 1, 4) --- - - 1: {4, 3, 2, 1, 'the newest field string value'} +- [1, 4, 3, 2, 1, 'the newest field string value'] ... box.space[0]:truncate() --- @@ -1324,7 +1351,7 @@ box.space[0]:truncate() ffi --- - - nil +{} ... # @@ -1339,81 +1366,88 @@ ffi print_config() --- -io_collect_interval = 0 -pid_file = box.pid -slab_alloc_minimal = 64 -primary_port = 33013 -log_level = 4 -logger_nonblock = true -memcached_expire_per_loop = 1024 -snap_dir = . -coredump = false -panic_on_snap_error = true -memcached_expire_full_sweep = 3600 -replication_port = 0 -wal_fsync_delay = 0 -too_long_threshold = 0.5 -slab_alloc_factor = 2 -admin_port = 33015 -logger = cat - >> tarantool.log -snap_io_rate_limit = 0 -wal_writer_inbox_size = 16384 -memcached_expire = false -backlog = 1024 -memcached_space = 23 -memcached_port = 0 -rows_per_wal = 50 -wal_mode = fsync_delay -local_hot_standby = false -secondary_port = 33014 -panic_on_wal_error = false -script_dir = . -wal_dir = . -bind_ipaddr = INADDR_ANY -readahead = 16320 -slab_alloc_arena = 0.1 -wal_dir_rescan_delay = 0.1 +- - io_collect_interval = 0 + - pid_file = box.pid + - slab_alloc_minimal = 64 + - slab_alloc_arena = 0.1 + - log_level = 4 + - logger_nonblock = true + - memcached_expire_per_loop = 1024 + - snap_dir = . + - coredump = false + - panic_on_snap_error = true + - memcached_expire_full_sweep = 3600 + - replication_port = 0 + - wal_fsync_delay = 0 + - too_long_threshold = 0.5 + - slab_alloc_factor = 2 + - admin_port = 33015 + - memcached_space = 23 + - snap_io_rate_limit = 0 + - memcached_expire = false + - backlog = 1024 + - logger = cat - >> tarantool.log + - readahead = 16320 + - local_hot_standby = false + - wal_mode = fsync_delay + - secondary_port = 33014 + - wal_dir = . + - panic_on_wal_error = false + - script_dir = . + - rows_per_wal = 50 + - bind_ipaddr = INADDR_ANY + - primary_port = 33013 + - memcached_port = 0 + - wal_dir_rescan_delay = 0.1 ... # Test bug #977898 box.insert(0, 4, 8, 16) --- - - 4: {8, 16} +- [4, 8, 16] ... # Test insert from init.lua box.select(0, 0, 1) --- - - 1: {2, 4, 8} +- [1, 2, 4, 8] ... box.select(0, 0, 2) --- - - 2: {4, 8, 16} +- [2, 4, 8, 16] ... box.select(0, 0, 4) --- - - 4: {8, 16} +- [4, 8, 16] ... # Test bug #1002272 floor(0.5) --- - - 0 +- 0 ... floor(0.9) --- - - 0 +- 0 ... floor(1.1) --- - - 1 +- 1 ... # clean-up after tests +box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum') +--- +- [0, 0, 'tweedledum'] +... +box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num') +--- +- [0, 0, 'primary', 1752392040, 1, 1, 0, 'num'] +... # Test box.tuple:slice() @@ -1422,123 +1456,123 @@ t=box.tuple.new({'0', '1', '2', '3', '4', '5', '6', '7'}) ... t:slice(0) --- - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 +- '0' +- '1' +- '2' +- '3' +- '4' +- '5' +- '6' +- '7' ... t:slice(-1) --- - - 7 +- '7' ... t:slice(1) --- - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 +- '1' +- '2' +- '3' +- '4' +- '5' +- '6' +- '7' ... t:slice(-1, -1) --- -error: 'tuple.slice(): start must be less than end' +- error: 'tuple.slice(): start must be less than end' ... t:slice(-1, 1) --- -error: 'tuple.slice(): start must be less than end' +- error: 'tuple.slice(): start must be less than end' ... t:slice(1, -1) --- - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 +- '1' +- '2' +- '3' +- '4' +- '5' +- '6' ... t:slice(1, 3) --- - - 1 - - 2 +- '1' +- '2' ... t:slice(7) --- - - 7 +- '7' ... t:slice(8) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(9) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(100500) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(9, -1) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(6, -1) --- - - 6 +- '6' ... t:slice(4, 4) --- -error: 'tuple.slice(): start must be less than end' +- error: 'tuple.slice(): start must be less than end' ... t:slice(6, 4) --- -error: 'tuple.slice(): start must be less than end' +- error: 'tuple.slice(): start must be less than end' ... t:slice(0, 0) --- -error: 'tuple.slice(): end > field count' +- error: 'tuple.slice(): end > field count' ... t:slice(9, 10) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(-7) --- - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 +- '1' +- '2' +- '3' +- '4' +- '5' +- '6' +- '7' ... t:slice(-8) --- - - 0 - - 1 - - 2 - - 3 - - 4 - - 5 - - 6 - - 7 +- '0' +- '1' +- '2' +- '3' +- '4' +- '5' +- '6' +- '7' ... t:slice(-9) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(-100500) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... t:slice(500, 700) --- -error: 'tuple.slice(): start >= field count' +- error: 'tuple.slice(): start >= field count' ... box.space[0]:truncate() --- @@ -1555,11 +1589,11 @@ f = box.fiber.create(r) ... box.fiber.resume(f) --- - - true +- true ... box.fiber.resume(f) --- -error: 'fiber.resume(): the fiber is dead' +- error: 'fiber.resume(): the fiber is dead' ... function r() box.fiber.yield(box.space[0]:insert(0, 0, 1)) box.fiber.yield(box.space[0]:select(0, 0)) box.fiber.yield(box.space[0]:truncate()) end --- @@ -1569,18 +1603,18 @@ f = box.fiber.create(r) ... box.fiber.resume(f) --- - - 0: {0, 1} +- [0, 0, 1] ... box.fiber.resume(f) --- - - 0: {0, 1} +- [0, 0, 1] ... box.fiber.resume(f) --- ... box.fiber.resume(f) --- - - true +- true ... function r() return box.fiber.yield(box.fiber.create(r)) end --- @@ -1641,71 +1675,71 @@ f17 = box.fiber.resume(f16) ... box.fiber.resume(f) --- - - true +- true ... box.fiber.resume(f1) --- - - true +- true ... box.fiber.resume(f2) --- - - true +- true ... box.fiber.resume(f3) --- - - true +- true ... box.fiber.resume(f4) --- - - true +- true ... box.fiber.resume(f5) --- - - true +- true ... box.fiber.resume(f6) --- - - true +- true ... box.fiber.resume(f7) --- - - true +- true ... box.fiber.resume(f8) --- - - true +- true ... box.fiber.resume(f9) --- - - true +- true ... box.fiber.resume(f10) --- - - true +- true ... box.fiber.resume(f11) --- - - true +- true ... box.fiber.resume(f12) --- - - true +- true ... box.fiber.resume(f13) --- - - true +- true ... box.fiber.resume(f14) --- - - true +- true ... box.fiber.resume(f15) --- - - true +- true ... box.fiber.resume(f16) --- - - true +- true ... f17 = nil --- @@ -1721,14 +1755,14 @@ box.fiber.resume(f) ... box.fiber.resume(f) --- -error: 'fiber.resume(): can''t resume a detached fiber' +- error: 'fiber.resume(): can''t resume a detached fiber' ... box.fiber.cancel(f) --- ... box.fiber.resume(f) --- -error: 'fiber.resume(): the fiber is dead' +- error: 'fiber.resume(): the fiber is dead' ... # A test case for Bug#103491 @@ -1764,39 +1798,39 @@ Found 1 tuple: box.counter.inc(0, 1) --- - - 1 +- 1 ... box.select(0, 0, 1) --- - - 1: {1} +- [1, 1] ... box.counter.inc(0, 1) --- - - 2 +- 2 ... box.counter.inc(0, 1) --- - - 3 +- 3 ... box.select(0, 0, 1) --- - - 1: {3} +- [1, 3] ... box.counter.dec(0, 1) --- - - 2 +- 2 ... box.counter.dec(0, 1) --- - - 1 +- 1 ... box.select(0, 0, 1) --- - - 1: {1} +- [1, 1] ... box.counter.dec(0, 1) --- - - 0 +- 0 ... box.select(0, 0, 1) --- @@ -1804,65 +1838,65 @@ box.select(0, 0, 1) # box.dostring() box.dostring('abc') --- -error: '[string "abc"]:1: ''='' expected near ''<eof>''' +- error: '[string "abc"]:1: ''='' expected near ''<eof>''' ... box.dostring('abc=2') --- ... box.dostring('return abc') --- - - 2 +- 2 ... box.dostring('return ...', 1, 2, 3) --- - - 1 - - 2 - - 3 +- 1 +- 2 +- 3 ... # box.update: push/pop fields box.insert(0, 'abcd') --- - - 1684234849: {} +- [1684234849] ... box.update(0, 'abcd', '#p', 1, '') --- -error: 'Field 1 was not found in the tuple' +- error: Field 1 was not found in the tuple ... box.update(0, 'abcd', '=p', -1, 'push1') --- - - 1684234849: {'push1'} +- [1684234849, 'push1'] ... box.update(0, 'abcd', '=p', -1, 'push2') --- - - 1684234849: {'push1', 'push2'} +- [1684234849, 'push1', 'push2'] ... box.update(0, 'abcd', '=p', -1, 'push3') --- - - 1684234849: {'push1', 'push2', 'push3'} +- [1684234849, 'push1', 'push2', 'push3'] ... box.update(0, 'abcd', '#p=p', 1, '', -1, 'swap1') --- - - 1684234849: {'push2', 'push3', 'swap1'} +- [1684234849, 'push2', 'push3', 'swap1'] ... box.update(0, 'abcd', '#p=p', 1, '', -1, 'swap2') --- - - 1684234849: {'push3', 'swap1', 'swap2'} +- [1684234849, 'push3', 'swap1', 'swap2'] ... box.update(0, 'abcd', '#p=p', 1, '', -1, 'swap3') --- - - 1684234849: {'swap1', 'swap2', 'swap3'} +- [1684234849, 'swap1', 'swap2', 'swap3'] ... box.update(0, 'abcd', '#p=p', -1, '', -1, 'noop1') --- - - 1684234849: {'swap1', 'swap2', 'noop1'} +- [1684234849, 'swap1', 'swap2', 'noop1'] ... box.update(0, 'abcd', '#p=p', -1, '', -1, 'noop2') --- - - 1684234849: {'swap1', 'swap2', 'noop2'} +- [1684234849, 'swap1', 'swap2', 'noop2'] ... box.update(0, 'abcd', '#p=p', -1, '', -1, 'noop3') --- - - 1684234849: {'swap1', 'swap2', 'noop3'} +- [1684234849, 'swap1', 'swap2', 'noop3'] ... box.space[0]:truncate() --- @@ -1870,7 +1904,7 @@ box.space[0]:truncate() # A test case for Bug#1043804 lua error() -> server crash error() --- -error: '' +- error: ... # Test box.fiber.name() old_name = box.fiber.name() @@ -1878,25 +1912,25 @@ old_name = box.fiber.name() ... box.fiber.name() == old_name --- - - true +- true ... box.fiber.self():name() == old_name --- - - true +- true ... box.fiber.name('hello fiber') --- ... box.fiber.name() --- - - hello fiber +- hello fiber ... box.fiber.self():name('bye fiber') --- ... box.fiber.self():name() --- - - bye fiber +- bye fiber ... box.fiber.self():name(old_name) --- @@ -1904,45 +1938,45 @@ box.fiber.self():name(old_name) # A test case for bitwise operations bit.lshift(1, 32) --- - - 1 +- 1 ... bit.band(1, 3) --- - - 1 +- 1 ... bit.bor(1, 2) --- - - 3 +- 3 ... # A test case for Bug#1061747 'tonumber64 is not transitive' tonumber64(tonumber64(2)) --- - - 2 +- 2 ... tostring(tonumber64(tonumber64(3))) --- - - 3ULL +- 3ULL ... # box.tuple.new test box.tuple.new() --- -error: 'tuple.new(): bad arguments' +- error: 'tuple.new(): bad arguments' ... box.tuple.new(1) --- - - 1: {} +- [1] ... box.tuple.new('string') --- - - 'string': {} +- ['string'] ... box.tuple.new(tonumber64('18446744073709551615')) --- - - 18446744073709551615: {} +- [18446744073709551615] ... box.tuple.new({tonumber64('18446744073709551615'), 'string', 1}) --- - - 18446744073709551615: {'string', 1} +- [18446744073709551615, 'string', 1] ... # A test case for the key as an tuple t=box.insert(0, 777, '0', '1', '2', '3') @@ -1950,15 +1984,15 @@ t=box.insert(0, 777, '0', '1', '2', '3') ... t --- - - 777: {'0', '1', '2', '3'} +- [777, '0', '1', '2', '3'] ... box.replace(0, t) --- - - 777: {'0', '1', '2', '3'} +- [777, '0', '1', '2', '3'] ... box.replace(0, 777, { 'a', 'b', 'c', {'d', 'e', t}}) --- - - 777: {'a', 'b', 'c', 'd', 'e', 777, '0', '1', '2', '3'} +- [777, 'a', 'b', 'c', 'd', 'e', 777, '0', '1', '2', '3'] ... # A test case for tuple:totable() method t=box.select(0, 0, 777):totable() @@ -1966,10 +2000,10 @@ t=box.select(0, 0, 777):totable() ... t[2], t[3], t[4], t[5] --- - - a - - b - - c - - d +- a +- b +- c +- d ... box.space[0]:truncate() --- @@ -1980,40 +2014,41 @@ t=box.insert(0, 8989) ... t[nil] --- -error: '[string "return t[nil]"]:1: bad argument #2 to ''__index'' (string expected, got nil)' +- error: '[string "return t[nil]"]:1: bad argument #2 to ''__index'' (string expected, + got nil)' ... # A test case for Bug#1131108 'tonumber64 from negative int inconsistency' tonumber64(-1) --- - - 18446744073709551615 +- 18446744073709551615 ... tonumber64(-1LL) --- - - 18446744073709551615 +- 18446744073709551615 ... tonumber64(-1ULL) --- - - 18446744073709551615 +- 18446744073709551615 ... -1 --- - - -1 +- -1 ... -1LL --- - - -1 +- -1 ... -1ULL --- - - 18446744073709551615 +- 18446744073709551615 ... tonumber64(-1.0) --- - - 18446744073709551615 +- 18446744073709551615 ... 6LL - 7LL --- - - -1 +- -1 ... # A test case for Bug#1131108 'incorrect conversion from boolean lua value to tarantool tuple' @@ -2028,20 +2063,23 @@ bug1075677=nil ... box.tuple.new(false) --- - - 'false': {} +- ['false'] ... box.tuple.new({false}) --- - - 'false': {} +- ['false'] ... t = box.tuple.new('abc') --- ... t --- - - 'abc': {} +- ['abc'] ... t:bsize() --- - - 4 +- 4 +... +box.space[0]:drop() +--- ... diff --git a/test/box/lua.test.py b/test/box/lua.test.py index fce7a867b2d69a93272ad262d94c08516e1816e4..b45bf95ccec189bd3977cc56c7ba083716cace24 100644 --- a/test/box/lua.test.py +++ b/test/box/lua.test.py @@ -1,39 +1,43 @@ # encoding: utf-8 import os import sys + +admin("box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum')") +admin("box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num')") + # Test Lua from admin console. Whenever producing output, # make sure it's a valid YAML. -admin("lua", simple=True) -admin("lua 1", simple=True) -admin("print(' lua says: hello')") +admin("' lua says: hello'") # What's in the box? -admin("local t = {} for n in pairs(box) do table.insert(t, ' - box.' .. tostring(n)) end table.sort(t) for i = 1, #t do print(t[i]) end t = nil") +admin("t = {} for n in pairs(box) do table.insert(t, tostring(n)) end table.sort(t)") +admin("t") +admin("t = nil") # Test box.pack() admin("box.pack()") admin("box.pack(1)") admin("box.pack('abc')") -admin("print(box.pack('a', ' - hello'))") -admin("print(box.pack('Aa', ' - hello', ' world'))") -admin("print(box.pack('w', 0x30))") -admin("print(box.pack('www', 0x30, 0x30, 0x30))") -admin("print(box.pack('www', 0x3030, 0x30))") -admin("print(string.byte(box.pack('w', 212345), 1, 2))") -admin("print(string.sub(box.pack('p', 1684234849), 2))") -admin("print(box.pack('p', 'this string is 45 characters long 1234567890 '))") -admin("print(box.pack('s', 0x4d))") -admin("print(box.pack('ssss', 25940, 29811, 28448, 11883))") -admin("print(box.pack('SSSS', 25940, 29811, 28448, 11883))") -admin("print(box.pack('SSSSSSSS', 28493, 29550, 27680, 27497, 29541, 20512, 29285, 8556))") -admin("print(box.pack('bsilww', 84, 29541, 1802444916, 2338318684567380014ULL, 103, 111))") -admin("print(box.unpack('b', 'T'))") -admin("print(box.unpack('s', 'Te'))") -admin("print(box.unpack('i', 'Test'))") -admin("print(box.unpack('l', 'Test ok.'))") +admin("box.pack('a', ' - hello')") +admin("box.pack('Aa', ' - hello', ' world')") +admin("box.pack('w', 0x30)") +admin("box.pack('www', 0x30, 0x30, 0x30)") +admin("box.pack('www', 0x3030, 0x30)") +admin("string.byte(box.pack('w', 212345), 1, 2)") +admin("string.sub(box.pack('p', 1684234849), 2)") +admin("box.pack('p', 'this string is 45 characters long 1234567890 ')") +admin("box.pack('s', 0x4d)") +admin("box.pack('ssss', 25940, 29811, 28448, 11883)") +admin("box.pack('SSSS', 25940, 29811, 28448, 11883)") +admin("box.pack('SSSSSSSS', 28493, 29550, 27680, 27497, 29541, 20512, 29285, 8556)") +admin("box.pack('bsilww', 84, 29541, 1802444916, 2338318684567380014ULL, 103, 111)") +admin("box.unpack('b', 'T')") +admin("box.unpack('s', 'Te')") +admin("box.unpack('i', 'Test')") +admin("box.unpack('l', 'Test ok.')") admin("box.unpack('bsil', box.pack('bsil', 255, 65535, 4294967295, tonumber64('18446744073709551615')))") admin("box.unpack('www', box.pack('www', 255, 65535, 4294967295))") admin("box.unpack('ppp', box.pack('ppp', 'one', 'two', 'three'))") admin("num, str, num64 = box.unpack('ppp', box.pack('ppp', 666, 'string', tonumber64('666666666666666')))") -admin("print(box.unpack('i', num), str, box.unpack('l', num64))") +admin("box.unpack('i', num), str, box.unpack('l', num64)") admin("box.unpack('=p', box.pack('=p', 1, '666'))") admin("box.unpack('','')") admin("box.unpack('ii', box.pack('i', 1))") @@ -112,7 +116,7 @@ fifo_lua = os.path.abspath("box/fifo.lua") sys.stdout.push_filter("dofile(.*)", "dofile(...)") admin("dofile('{0}')".format(fifo_lua)) sys.stdout.pop_filter() -admin("fifo_max") +admin("fifomax") admin("fifo_push('test', 1)") admin("fifo_push('test', 2)") admin("fifo_push('test', 3)") @@ -125,11 +129,15 @@ admin("fifo_top('test')") admin("box.delete(0, 'test')") admin("fifo_top('test')") admin("box.delete(0, 'test')") -admin("for k,v in pairs(box.cfg) do print(' - ', k, ': ', v) end") -admin("for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then print(' - ', k, ': ', v) end end") -admin("reload configuration") -admin("for k,v in pairs(box.cfg) do print(' - ', k, ': ', v) end") -admin("for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then print(' - ', k, ': ', v) end end") +admin("t = {} for k,v in pairs(box.cfg) do table.insert(t, k..': '..tostring(v)) end") +admin("t") +admin("t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then table.insert(t, k..': '..tostring(v)) end end") +admin("t") +admin("box.cfg_reload()") +admin("t = {} for k,v in pairs(box.cfg) do table.insert(t, k..': '..tostring(v)) end") +admin("t") +admin("t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then table.insert(t, k..': '..tostring(v)) end end") +admin("t") # must be read-only admin("box.cfg.nosuchoption = 1") admin("box.space[300] = 1") @@ -158,13 +166,17 @@ admin("t:next('abcd')") admin("t:next(1)") admin("t:next(t)") admin("t:next(t:next())") -admin("for k, v in t:pairs() do print(v) end") +admin("ta = {} for k, v in t:pairs() do table.insert(ta, v) end") +admin("ta") admin("t=box.space[0]:replace('test', 'another field')") -admin("for k, v in t:pairs() do print(v) end") +admin("ta = {} for k, v in t:pairs() do table.insert(ta, v) end") +admin("ta") admin("t=box.space[0]:replace('test', 'another field', 'one more')") -admin("for k, v in t:pairs() do print(v) end") +admin("ta = {} for k, v in t:pairs() do table.insert(ta, v) end") +admin("ta") admin("t=box.tuple.new({'a', 'b', 'c', 'd'})") -admin("for it,field in t:pairs() do print(field); end") +admin("ta = {} for it,field in t:pairs() do table.insert(ta, field); end") +admin("ta") admin("it, field = t:next()") admin("getmetatable(it)") admin("box.space[0]:truncate()") @@ -187,7 +199,7 @@ admin("r()") admin("f = box.fiber.create(print('hello')") admin("box.fiber.resume(f)") # test passing arguments in and out created fiber -admin("function r(a, b) print(a) print(b) return a, b end") +admin("function r(a, b) return a, b end") admin("f=box.fiber.create(r)") admin("box.fiber.resume(f)") admin("f=box.fiber.create(r)") @@ -201,7 +213,7 @@ admin("f=box.fiber.create(y)") admin("box.fiber.resume(f, 'hello', 'world')") admin("box.fiber.resume(f, 'wide')") admin("box.fiber.resume(f)") -admin("function y() print('started') box.fiber.detach() while true do box.replace(0, 'test', os.time()) box.fiber.sleep(0.001) end end") +admin("function y() box.fiber.detach() while true do box.replace(0, 'test', os.time()) box.fiber.sleep(0.001) end end") admin("f = box.fiber.create(y)") admin("box.fiber.resume(f)") admin("box.fiber.sleep(0.002)") @@ -244,9 +256,9 @@ print """# A test case for Bug#933487 # was created #""" admin("f = box.fiber.create(function () return true end)") -admin("save snapshot") -admin("save snapshot") -admin("save snapshot") +admin("box.snapshot()") +admin("box.snapshot()") +admin("box.snapshot()") admin("box.fiber.resume(f)") admin("f = box.fiber.create(function () return true end)") # @@ -487,6 +499,10 @@ print """ """ server.stop() server.deploy(init_lua=None) + +admin("box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum')") +admin("box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num')") + print """ # Test box.tuple:slice() """ @@ -682,3 +698,5 @@ admin("t = box.tuple.new('abc')") admin("t") admin("t:bsize()") admin("box.delete(0, 8989)", silent=True) + +admin("box.space[0]:drop()") diff --git a/test/box/lua_box_uuid.result b/test/box/lua_box_uuid.result index b70e85b21a2979d2bcbf2d0f08495c9fd16e601c..dc8ef3e470bc0c02491201c08c3d9f29e4a23c2c 100644 --- a/test/box/lua_box_uuid.result +++ b/test/box/lua_box_uuid.result @@ -1,14 +1,14 @@ -- box.uuid() string.len(box.uuid()) --- - - 16 +- 16 ... string.len(box.uuid_hex()) --- - - 32 +- 32 ... string.match(box.uuid_hex(), '^[a-f0-9]+$') ~= nil --- - - true +- true ... -- vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 syntax=lua diff --git a/test/box/lua_misc.result b/test/box/lua_misc.result index 302d58dcce35fa9a2f1da67317caed219cd1fc6b..9a227c32b1fa2380ff90569af37aa0c7168d8614 100644 --- a/test/box/lua_misc.result +++ b/test/box/lua_misc.result @@ -1,137 +1,176 @@ -- setopt delim ';' +box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum'); +--- +- [0, 0, 'tweedledum'] +... +box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num'); +--- +- [0, 0, 'primary', 1752392040, 1, 1, 0, 'num'] +... ---------------- -- # box.raise ---------------- 1 + 1; --- - - 2 +- 2 ... box.raise(123, 'test'); --- -error: 'test' +- error: test ... box.raise(0, 'the other test'); --- -error: 'box.raise(): unknown error code' +- error: 'box.raise(): unknown error code' ... box.raise(12, 345); --- -error: '345' +- error: '345' ... ---------------- -- # box.stat ---------------- +t = {}; +--- +... for k, v in pairs(box.stat()) do - print(' - ', k) + table.insert(t, k) end; --- - - DELETE - - SELECT - - REPLACE - - CALL - - UPDATE - - DELETE_1_3 ... for k, v in pairs(box.stat().DELETE) do - print(' - ', k) + table.insert(t, k) end; --- - - total - - rps ... for k, v in pairs(box.stat.DELETE) do - print(' - ', k) + table.insert(t, k) end; --- - - total - - rps +... +t; +--- +- - DELETE + - SELECT + - REPLACE + - CALL + - UPDATE + - DELETE_1_3 + - total + - rps + - total + - rps ... ---------------- -- # box.space ---------------- type(box); --- - - table +- table ... type(box.space); --- - - table +- table ... box.cfg.memcached_space; --- - - 23 +- 23 +... +t = {}; +--- ... for i, v in pairs(box.space[0].index[0].key_field[0]) do - print(i, ' : ', v) + table.insert(t, tostring(i)..' : '..tostring(v)) end; --- -type : NUM -fieldno : 0 +... +t; +--- +- - 'type : NUM' + - 'fieldno : 0' ... ---------------- -- # box.space ---------------- -string.match(tostring(box.slab), '^table:') ~= nil; +string.match(tostring(box.slab.info()), '^table:') ~= nil; +--- +- true +... +box.slab.info().arena_used >= 0; --- - - true +- true ... -box.slab.arena_used >= 0; +box.slab.info().arena_size > 0; --- - - true +- true ... -box.slab.arena_size > 0; +string.match(tostring(box.slab.info().slabs), '^table:') ~= nil; --- - - true +- true ... -string.match(tostring(box.slab.slabs), '^table:') ~= nil; +t = {}; --- - - true ... -for k, v in pairs(box.slab()) do - print(' - ', k) +for k, v in pairs(box.slab.info()) do + table.insert(t, k) end; --- - - slabs - - arena_size - - arena_used +... +t; +--- +- - slabs + - arena_size + - arena_used ... ---------------- -- # box.error ---------------- +t = {} for k,v in pairs(box.error) do - print('box.error.', k, ' : ', v) + table.insert(t, 'box.error.'..tostring(k)..' : '..tostring(v)) end; --- -box.error.ER_ILLEGAL_PARAMS : 514 -box.error.ER_KEY_FIELD_TYPE : 9730 -box.error.ER_NONMASTER : 258 -box.error.ER_PROC_RET : 12290 -box.error.ER_TUPLE_IS_TOO_LONG : 11010 -box.error.ER_UNKNOWN_UPDATE_OP : 11266 -box.error.ER_EXACT_MATCH : 11522 -box.error.ER_TUPLE_FORMAT_LIMIT : 7170 -box.error.ER_FIELD_TYPE : 10242 -box.error.ER_TUPLE_FOUND : 14082 -box.error.ER_NO_SUCH_FIELD : 13826 -box.error.ER_OK : 0 -box.error.ER_NO_SUCH_INDEX : 13570 -box.error.ER_TUPLE_NOT_FOUND : 12546 -box.error.ER_FIBER_STACK : 6658 -box.error.ER_WAL_IO : 9986 -box.error.ER_SPACE_DISABLED : 13314 -box.error.ER_UNSUPPORTED : 2562 -box.error.ER_INJECTION : 2306 -box.error.ER_PROC_LUA : 13058 -box.error.ER_INDEX_TYPE : 1282 -box.error.ER_ARG_TYPE : 10498 -box.error.ER_NO_SUCH_SPACE : 14594 -box.error.ER_SECONDARY : 770 -box.error.ER_FIELD_TYPE_MISMATCH : 11778 -box.error.ER_NO_SUCH_PROC : 12802 -box.error.ER_SPLICE : 10754 -box.error.ER_KEY_PART_COUNT : 12034 -box.error.ER_SPACE_EXISTS : 1538 -box.error.ER_TUPLE_IS_RO : 1025 -box.error.ER_MEMORY_ISSUE : 1793 +... +t; +--- +- - 'box.error.ER_NO_SUCH_INDEX : 13570' + - 'box.error.ER_PROC_RET : 12290' + - 'box.error.ER_CREATE_SPACE : 2050' + - 'box.error.ER_TUPLE_FORMAT_LIMIT : 7170' + - 'box.error.ER_FIELD_TYPE : 10242' + - 'box.error.ER_OK : 0' + - 'box.error.ER_TUPLE_NOT_FOUND : 12546' + - 'box.error.ER_WAL_IO : 9986' + - 'box.error.ER_INJECTION : 2306' + - 'box.error.ER_DROP_PRIMARY_KEY : 7682' + - 'box.error.ER_INDEX_TYPE : 1282' + - 'box.error.ER_ARG_TYPE : 10498' + - 'box.error.ER_KEY_PART_COUNT : 12034' + - 'box.error.ER_MEMORY_ISSUE : 1793' + - 'box.error.ER_ILLEGAL_PARAMS : 514' + - 'box.error.ER_KEY_FIELD_TYPE : 9730' + - 'box.error.ER_NONMASTER : 258' + - 'box.error.ER_TUPLE_IS_TOO_LONG : 11010' + - 'box.error.ER_MODIFY_INDEX : 6914' + - 'box.error.ER_EXACT_MATCH : 11522' + - 'box.error.ER_SECONDARY : 770' + - 'box.error.ER_DROP_SPACE : 6146' + - 'box.error.ER_UNKNOWN_UPDATE_OP : 11266' + - 'box.error.ER_UNSUPPORTED : 2562' + - 'box.error.ER_NO_SUCH_SPACE : 14594' + - 'box.error.ER_TUPLE_FOUND : 14082' + - 'box.error.ER_NO_SUCH_FIELD : 13826' + - 'box.error.ER_SPACE_DISABLED : 13314' + - 'box.error.ER_ALTER_SPACE : 6402' + - 'box.error.ER_TUPLE_IS_RO : 1025' + - 'box.error.ER_FIBER_STACK : 6658' + - 'box.error.ER_PROC_LUA : 13058' + - 'box.error.ER_NO_SUCH_PROC : 12802' + - 'box.error.ER_SPLICE : 10754' + - 'box.error.ER_LAST_DROP : 7426' + - 'box.error.ER_SPACE_EXISTS : 1538' + - 'box.error.ER_FIELD_TYPE_MISMATCH : 11778' +... +box.space[0]:drop(); +--- ... -- vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 syntax=lua diff --git a/test/box/lua_misc.test.lua b/test/box/lua_misc.test.lua index 019b703acb01a870a484fb8f61d26700075ca82b..ea4bf2adf348056af2797d04d0c14971119d18d1 100644 --- a/test/box/lua_misc.test.lua +++ b/test/box/lua_misc.test.lua @@ -1,4 +1,8 @@ -- setopt delim ';' + +box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum'); +box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num'); + ---------------- -- # box.raise ---------------- @@ -10,15 +14,17 @@ box.raise(12, 345); ---------------- -- # box.stat ---------------- +t = {}; for k, v in pairs(box.stat()) do - print(' - ', k) + table.insert(t, k) end; for k, v in pairs(box.stat().DELETE) do - print(' - ', k) + table.insert(t, k) end; for k, v in pairs(box.stat.DELETE) do - print(' - ', k) + table.insert(t, k) end; +t; ---------------- -- # box.space @@ -26,25 +32,33 @@ end; type(box); type(box.space); box.cfg.memcached_space; +t = {}; for i, v in pairs(box.space[0].index[0].key_field[0]) do - print(i, ' : ', v) + table.insert(t, tostring(i)..' : '..tostring(v)) end; +t; ---------------- -- # box.space ---------------- -string.match(tostring(box.slab), '^table:') ~= nil; -box.slab.arena_used >= 0; -box.slab.arena_size > 0; -string.match(tostring(box.slab.slabs), '^table:') ~= nil; -for k, v in pairs(box.slab()) do - print(' - ', k) +string.match(tostring(box.slab.info()), '^table:') ~= nil; +box.slab.info().arena_used >= 0; +box.slab.info().arena_size > 0; +string.match(tostring(box.slab.info().slabs), '^table:') ~= nil; +t = {}; +for k, v in pairs(box.slab.info()) do + table.insert(t, k) end; +t; ---------------- -- # box.error ---------------- +t = {} for k,v in pairs(box.error) do - print('box.error.', k, ' : ', v) + table.insert(t, 'box.error.'..tostring(k)..' : '..tostring(v)) end; +t; + +box.space[0]:drop(); -- vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 syntax=lua diff --git a/test/box/suite.ini b/test/box/suite.ini index cbf3d6abdb3470772d2626313a187c559df39da9..bf031caa96dde00d5d1b642c0d9d1b72d756202d 100644 --- a/test/box/suite.ini +++ b/test/box/suite.ini @@ -2,6 +2,6 @@ core = tarantool description = tarantool/box, minimal configuration config = tarantool.cfg -disabled = snapshot_1_3.test.py +disabled = snapshot_1_3.test.py configuration.test.py valgrind_disabled = admin_coredump.test.lua release_disabled = errinj.test.lua diff --git a/test/box/test_init.lua b/test/box/test_init.lua index 61b0ed08709bfba288bb051a352c01ce95ebddc1..e1736bb9a157738ebeabac9a9e293ebdf3f35d5a 100644 --- a/test/box/test_init.lua +++ b/test/box/test_init.lua @@ -1,6 +1,9 @@ -- testing start-up script floor = require("math").floor +box.insert(box.schema.SPACE_ID, 0, 0, 'tweedledum') +box.insert(box.schema.INDEX_ID, 0, 0, 'primary', 'hash', 1, 1, 0, 'num') + -- -- Access to box.cfg from start-up script -- @@ -13,9 +16,11 @@ function copy_box_cfg() end function print_config() + t = {} for i, v in pairs(box_cfg) do - print(i, " = ", v) + table.insert(t, tostring(i).." = "..tostring(v)) end + return t end copy_box_cfg()