diff --git a/src/lua/console.lua b/src/lua/console.lua index 959b65ef844f7730b9ce058ba2eb31cad6cdf856..601450014f44c3ae8fe06b135fa2e7ad14a1736d 100644 --- a/src/lua/console.lua +++ b/src/lua/console.lua @@ -346,7 +346,7 @@ local function client_handler(client, peer) print = client_print; client = client; }, repl_mt) - local version = _TARANTOOL + local version = _TARANTOOL:match("([^-]+)-") state:print(string.format("%-63s\n%-63s\n", "Tarantool ".. version.." (Lua console)", "type 'help' for interactive help")) diff --git a/test-run b/test-run index 886577172b82073b33d8a23a7f7555a85e6c146e..ab8b33ccbe4f11021acebbcb7909efa3b5e8e5d7 160000 --- a/test-run +++ b/test-run @@ -1 +1 @@ -Subproject commit 886577172b82073b33d8a23a7f7555a85e6c146e +Subproject commit ab8b33ccbe4f11021acebbcb7909efa3b5e8e5d7 diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua index e56dfba65ce13944c534d652542e3e0a4984ccc8..94864839872ee5b3ebf148925dcf3fee57cb1e42 100755 --- a/test/app-tap/tarantoolctl.test.lua +++ b/test/app-tap/tarantoolctl.test.lua @@ -81,13 +81,39 @@ local function run_command(dir, command) local line = [[/bin/sh -c 'cd "%s" && %s >"%s" 2>"%s"']] line = line:format(dir, command, fstdout, fstderr) local res = os.execute(line) - fiber.sleep(0.1) local fstdout_e, fstderr_e = io.open(fstdout):read('*a'), io.open(fstderr):read('*a') fio.unlink(fstdout); fio.unlink(fstderr); return res/256, fstdout_e, fstderr_e end -local function tctl_command(dir, cmd, args) +local function tctl_wait(dir, name) + if name then + local path = fio.pathjoin(dir, name .. '.control') + while not fio.stat(path) do + fiber.sleep(0.01) + end + ::again:: + while true do + local stat, nb = pcall(require('net.box').new, path, { + wait_connected = true, console = true + }) + if stat == false then + fiber.sleep(0.01) + goto again + else + break + end + local stat, msg = pcall(nb.eval, nb, 'require("fiber").time()') + if stat == false then + fiber.sleep(0.01) + else + break + end + end + end +end + +local function tctl_command(dir, cmd, args, name) local pid = nil if not fio.stat(fio.pathjoin(dir, '.tarantoolctl')) then create_script(dir, '.tarantoolctl', tctlcfg_code) @@ -173,7 +199,7 @@ do check_ok(test_i, dir, 'start', 'bad_script', 1, nil, 'unexpected symbol near') check_ok(test_i, dir, 'start', 'good_script', 0) - fiber.sleep(0.1) + tctl_wait(dir, 'good_script') -- wait here check_ok(test_i, dir, 'eval', 'good_script bad_script.lua', 3, nil, 'Error, while reloading config:') @@ -205,7 +231,7 @@ do test:test("check answers in case of call", function(test_i) test_i:plan(6) check_ok(test_i, dir, 'start', 'good_script', 0) - fiber.sleep(0.1) + tctl_wait(dir, 'good_script') check_ok(test_i, dir, 'eval', 'good_script bad_script.lua', 3, nil, 'Error, while reloading config') check_ok(test_i, dir, 'eval', 'good_script ok_script.lua', 0, @@ -324,7 +350,7 @@ do local dir = fio.tempdir() local filler_code = [[ - box.cfg{slab_alloc_arena = 0.1} + box.cfg{slab_alloc_arena = 0.1, background=false} local space = box.schema.create_space("test") space:create_index("primary") space:insert({[1] = 1, [2] = 2, [3] = 3, [4] = 4}) @@ -361,7 +387,6 @@ do test:test("fill and test play output", function(test_i) test_i:plan(6) check_ok(test_i, dir, 'start', 'filler', 0) - fiber.sleep(0.01) local lsn_before = test_run:get_lsn("remote", 1) test_i:is(lsn_before, 4, "check lsn before") local res, stdout, stderr = run_command(dir, command_base)