diff --git a/cfg/warning.c b/cfg/warning.c index 63ad036fd3b49b5429c8327226ee4edcc7401a02..4b79926d7368cb5e47f4060388e81c22ddd017ae 100644 --- a/cfg/warning.c +++ b/cfg/warning.c @@ -12,7 +12,7 @@ out_warning(ConfettyError v, char *format, ...) (void)v; /* make gcc happy */ va_start(ap, format); - tbuf_printf(cfg_out, "\r\n\t"); + tbuf_printf(cfg_out, "\r\n - "); tbuf_vprintf(cfg_out, format, ap); va_end(ap); } diff --git a/core/admin.c b/core/admin.c index d29a9cc7b472f8dbb27d765e0950ccb8fb13e9b9..ce4176cc47058ee94ece8c5cc22b889f2994289c 100644 --- a/core/admin.c +++ b/core/admin.c @@ -1,5 +1,5 @@ -#line 1 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 1 "core/admin.rl" /* * Copyright (C) 2010 Mail.RU * Copyright (C) 2010 Yuriy Vostrikov @@ -41,27 +41,26 @@ #include <tbuf.h> #include <util.h> -static const char help[] = - "available commands:\r\n" - "help\r\n" - "exit\r\n" - "show info\r\n" - "show fiber\r\n" - "show configuration\r\n" - "show slab\r\n" - "show palloc\r\n" - "show stat\r\n" - "save coredump\r\n" - "save snapshot\r\n" - "exec module command\r\n" - "reload configuration\r\n" - ; +static const char *help = + "available commands:" CRLF + " - help" CRLF + " - exit" CRLF + " - show info" CRLF + " - show fiber" CRLF + " - show configuration" CRLF + " - show slab" CRLF + " - show palloc" CRLF + " - show stat" CRLF + " - save coredump" CRLF + " - save snapshot" CRLF + " - exec module command" CRLF + " - reload configuration" CRLF; -static const char unknown_command[] = "unknown command. try typing help.\r\n"; +static const char unknown_command[] = "unknown command. try typing help." CRLF; -#line 65 "/home/scorpio/repo/tarantool/core/admin.c" +#line 64 "core/admin.c" static const int admin_start = 1; static const int admin_first_final = 108; static const int admin_error = 0; @@ -69,26 +68,35 @@ static const int admin_error = 0; static const int admin_en_main = 1; -#line 64 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 63 "core/admin.rl" + static void -ok(struct tbuf *out) +end(struct tbuf *out) { - tbuf_printf(out, "ok\r\n"); + tbuf_printf(out, "..." CRLF); } static void -end(struct tbuf *out) +start(struct tbuf *out) +{ + tbuf_printf(out, "---" CRLF); +} + +static void +ok(struct tbuf *out) { - tbuf_printf(out, "---\r\n"); + start(out); + tbuf_printf(out, "ok" CRLF); + end(out); } static void fail(struct tbuf *out, struct tbuf *err) { - tbuf_printf(out, "fail" - "%.*s\r\n", err->len, (char *)err->data); + start(out); + tbuf_printf(out, "fail:%.*s" CRLF, err->len, (char *)err->data); end(out); } @@ -110,12 +118,12 @@ admin_dispatch(void) p = fiber->rbuf->data; -#line 114 "/home/scorpio/repo/tarantool/core/admin.c" +#line 122 "core/admin.c" { cs = admin_start; } -#line 119 "/home/scorpio/repo/tarantool/core/admin.c" +#line 127 "core/admin.c" { if ( p == pe ) goto _test_eof; @@ -177,154 +185,182 @@ case 6: } goto st0; tr12: -#line 151 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 179 "core/admin.rl" {slab_validate(); ok(out);} goto st108; tr19: -#line 141 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 169 "core/admin.rl" {return 0;} goto st108; tr28: -#line 137 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 165 "core/admin.rl" {strend = p;} -#line 150 "/home/scorpio/repo/tarantool/core/admin.rl" - {mod_exec(strstart, strend - strstart, out); end(out);} +#line 136 "core/admin.rl" + { + start(out); + mod_exec(strstart, strend - strstart, out); + end(out); + } goto st108; tr32: -#line 140 "/home/scorpio/repo/tarantool/core/admin.rl" - {tbuf_append(out, help, sizeof(help));} +#line 130 "core/admin.rl" + { + start(out); + tbuf_append(out, help, strlen(help)); + end(out); + } goto st108; tr43: -#line 152 "/home/scorpio/repo/tarantool/core/admin.rl" - {if (reload_cfg(err)) { fail(out, err); } else { ok(out); }} +#line 142 "core/admin.rl" + { + if (reload_cfg(err)) + fail(out, err); + else + ok(out); + } goto st108; tr66: -#line 148 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 176 "core/admin.rl" {coredump(60); ok(out);} goto st108; tr75: -#line 149 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 177 "core/admin.rl" {snapshot(NULL, 0); ok(out);} goto st108; tr92: -#line 104 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 112 "core/admin.rl" { tarantool_cfg_iterator_t *i; char *key, *value; - tbuf_printf(out, "configuration:\n"); + start(out); + tbuf_printf(out, "configuration:" CRLF); i = tarantool_cfg_iterator_init(); while ((key = tarantool_cfg_iterator_next(i, &cfg, &value)) != NULL) { if (value) { - tbuf_printf(out, " %s: \"%s\"\n", key, value); + tbuf_printf(out, " %s: \"%s\"" CRLF, key, value); free(value); } else { - tbuf_printf(out, " %s: (null)\n", key); + tbuf_printf(out, " %s: (null)" CRLF, key); } } end(out); } goto st108; tr106: -#line 143 "/home/scorpio/repo/tarantool/core/admin.rl" - {fiber_info(out);end(out);} +#line 171 "core/admin.rl" + {start(out); fiber_info(out); end(out);} goto st108; tr112: -#line 142 "/home/scorpio/repo/tarantool/core/admin.rl" - {mod_info(out); end(out);} +#line 170 "core/admin.rl" + {start(out); mod_info(out); end(out);} goto st108; tr117: -#line 146 "/home/scorpio/repo/tarantool/core/admin.rl" - {palloc_stat(out);end(out);} +#line 174 "core/admin.rl" + {start(out); palloc_stat(out); end(out);} goto st108; tr125: -#line 145 "/home/scorpio/repo/tarantool/core/admin.rl" - {slab_stat(out);end(out);} +#line 173 "core/admin.rl" + {start(out); slab_stat(out); end(out);} goto st108; tr129: -#line 147 "/home/scorpio/repo/tarantool/core/admin.rl" - {stat_print(out);end(out);} +#line 175 "core/admin.rl" + {start(out); stat_print(out);end(out);} goto st108; st108: if ( ++p == pe ) goto _test_eof108; case 108: -#line 253 "/home/scorpio/repo/tarantool/core/admin.c" +#line 275 "core/admin.c" goto st0; tr13: -#line 151 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 179 "core/admin.rl" {slab_validate(); ok(out);} goto st7; tr20: -#line 141 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 169 "core/admin.rl" {return 0;} goto st7; tr29: -#line 137 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 165 "core/admin.rl" {strend = p;} -#line 150 "/home/scorpio/repo/tarantool/core/admin.rl" - {mod_exec(strstart, strend - strstart, out); end(out);} +#line 136 "core/admin.rl" + { + start(out); + mod_exec(strstart, strend - strstart, out); + end(out); + } goto st7; tr33: -#line 140 "/home/scorpio/repo/tarantool/core/admin.rl" - {tbuf_append(out, help, sizeof(help));} +#line 130 "core/admin.rl" + { + start(out); + tbuf_append(out, help, strlen(help)); + end(out); + } goto st7; tr44: -#line 152 "/home/scorpio/repo/tarantool/core/admin.rl" - {if (reload_cfg(err)) { fail(out, err); } else { ok(out); }} +#line 142 "core/admin.rl" + { + if (reload_cfg(err)) + fail(out, err); + else + ok(out); + } goto st7; tr67: -#line 148 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 176 "core/admin.rl" {coredump(60); ok(out);} goto st7; tr76: -#line 149 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 177 "core/admin.rl" {snapshot(NULL, 0); ok(out);} goto st7; tr93: -#line 104 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 112 "core/admin.rl" { tarantool_cfg_iterator_t *i; char *key, *value; - tbuf_printf(out, "configuration:\n"); + start(out); + tbuf_printf(out, "configuration:" CRLF); i = tarantool_cfg_iterator_init(); while ((key = tarantool_cfg_iterator_next(i, &cfg, &value)) != NULL) { if (value) { - tbuf_printf(out, " %s: \"%s\"\n", key, value); + tbuf_printf(out, " %s: \"%s\"" CRLF, key, value); free(value); } else { - tbuf_printf(out, " %s: (null)\n", key); + tbuf_printf(out, " %s: (null)" CRLF, key); } } end(out); } goto st7; tr107: -#line 143 "/home/scorpio/repo/tarantool/core/admin.rl" - {fiber_info(out);end(out);} +#line 171 "core/admin.rl" + {start(out); fiber_info(out); end(out);} goto st7; tr113: -#line 142 "/home/scorpio/repo/tarantool/core/admin.rl" - {mod_info(out); end(out);} +#line 170 "core/admin.rl" + {start(out); mod_info(out); end(out);} goto st7; tr118: -#line 146 "/home/scorpio/repo/tarantool/core/admin.rl" - {palloc_stat(out);end(out);} +#line 174 "core/admin.rl" + {start(out); palloc_stat(out); end(out);} goto st7; tr126: -#line 145 "/home/scorpio/repo/tarantool/core/admin.rl" - {slab_stat(out);end(out);} +#line 173 "core/admin.rl" + {start(out); slab_stat(out); end(out);} goto st7; tr130: -#line 147 "/home/scorpio/repo/tarantool/core/admin.rl" - {stat_print(out);end(out);} +#line 175 "core/admin.rl" + {start(out); stat_print(out);end(out);} goto st7; st7: if ( ++p == pe ) goto _test_eof7; case 7: -#line 328 "/home/scorpio/repo/tarantool/core/admin.c" +#line 364 "core/admin.c" if ( (*p) == 10 ) goto st108; goto st0; @@ -405,28 +441,28 @@ case 15: } goto tr25; tr25: -#line 137 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 165 "core/admin.rl" {strstart = p;} goto st16; st16: if ( ++p == pe ) goto _test_eof16; case 16: -#line 416 "/home/scorpio/repo/tarantool/core/admin.c" +#line 452 "core/admin.c" switch( (*p) ) { case 10: goto tr28; case 13: goto tr29; } goto st16; tr26: -#line 137 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 165 "core/admin.rl" {strstart = p;} goto st17; st17: if ( ++p == pe ) goto _test_eof17; case 17: -#line 430 "/home/scorpio/repo/tarantool/core/admin.c" +#line 466 "core/admin.c" switch( (*p) ) { case 10: goto tr28; case 13: goto tr29; @@ -1390,14 +1426,17 @@ case 107: _out: {} } -#line 157 "/home/scorpio/repo/tarantool/core/admin.rl" +#line 185 "core/admin.rl" fiber->rbuf->len -= (void *)pe - (void *)fiber->rbuf->data; fiber->rbuf->data = pe; - if (p != pe) + if (p != pe) { + start(out); tbuf_append(out, unknown_command, sizeof(unknown_command)); + end(out); + } return fiber_write(out->data, out->len); } diff --git a/core/admin.rl b/core/admin.rl index 65f06dc2b48950d5c40083d0780915ca1b1e82a0..766239c9fa19086433b9d6c60b8961156f763ebe 100644 --- a/core/admin.rl +++ b/core/admin.rl @@ -39,47 +39,55 @@ #include <tbuf.h> #include <util.h> -static const char help[] = - "available commands:\r\n" - "help\r\n" - "exit\r\n" - "show info\r\n" - "show fiber\r\n" - "show configuration\r\n" - "show slab\r\n" - "show palloc\r\n" - "show stat\r\n" - "save coredump\r\n" - "save snapshot\r\n" - "exec module command\r\n" - "reload configuration\r\n" - ; - - -static const char unknown_command[] = "unknown command. try typing help.\r\n"; +static const char *help = + "available commands:" CRLF + " - help" CRLF + " - exit" CRLF + " - show info" CRLF + " - show fiber" CRLF + " - show configuration" CRLF + " - show slab" CRLF + " - show palloc" CRLF + " - show stat" CRLF + " - save coredump" CRLF + " - save snapshot" CRLF + " - exec module command" CRLF + " - reload configuration" CRLF; + + +static const char unknown_command[] = "unknown command. try typing help." CRLF; %%{ machine admin; write data; }%% + static void -ok(struct tbuf *out) +end(struct tbuf *out) { - tbuf_printf(out, "ok\r\n"); + tbuf_printf(out, "..." CRLF); } static void -end(struct tbuf *out) +start(struct tbuf *out) +{ + tbuf_printf(out, "---" CRLF); +} + +static void +ok(struct tbuf *out) { - tbuf_printf(out, "---\r\n"); + start(out); + tbuf_printf(out, "ok" CRLF); + end(out); } static void fail(struct tbuf *out, struct tbuf *err) { - tbuf_printf(out, "fail" - "%.*s\r\n", err->len, (char *)err->data); + start(out); + tbuf_printf(out, "fail:%.*s" CRLF, err->len, (char *)err->data); end(out); } @@ -105,19 +113,39 @@ admin_dispatch(void) tarantool_cfg_iterator_t *i; char *key, *value; - tbuf_printf(out, "configuration:\n"); + start(out); + tbuf_printf(out, "configuration:" CRLF); i = tarantool_cfg_iterator_init(); while ((key = tarantool_cfg_iterator_next(i, &cfg, &value)) != NULL) { if (value) { - tbuf_printf(out, " %s: \"%s\"\n", key, value); + tbuf_printf(out, " %s: \"%s\"" CRLF, key, value); free(value); } else { - tbuf_printf(out, " %s: (null)\n", key); + tbuf_printf(out, " %s: (null)" CRLF, key); } } end(out); } + action help { + start(out); + tbuf_append(out, help, strlen(help)); + end(out); + } + + action mod_exec { + start(out); + mod_exec(strstart, strend - strstart, out); + end(out); + } + + action reload_configuration { + if (reload_cfg(err)) + fail(out, err); + else + ok(out); + } + eol = "\n" | "\r\n"; show = "sh"("o"("w")?)?; info = "in"("f"("o")?)?; @@ -137,19 +165,19 @@ admin_dispatch(void) string = [^\r\n]+ >{strstart = p;} %{strend = p;}; reload = "re"("l"("o"("a"("d")?)?)?)?; - commands = (help %{tbuf_append(out, help, sizeof(help));} | - exit %{return 0;} | - show " "+ info %{mod_info(out); end(out);} | - show " "+ fiber %{fiber_info(out);end(out);} | - show " "+ configuration %show_configuration | - show " "+ slab %{slab_stat(out);end(out);} | - show " "+ palloc %{palloc_stat(out);end(out);} | - show " "+ stat %{stat_print(out);end(out);} | - save " "+ coredump %{coredump(60); ok(out);} | - save " "+ snapshot %{snapshot(NULL, 0); ok(out);} | - exec " "+ string %{mod_exec(strstart, strend - strstart, out); end(out);}| - check " "+ slab %{slab_validate(); ok(out);} | - reload " "+ configuration %{if (reload_cfg(err)) { fail(out, err); } else { ok(out); }}); + commands = (help %help | + exit %{return 0;} | + show " "+ info %{start(out); mod_info(out); end(out);} | + show " "+ fiber %{start(out); fiber_info(out); end(out);} | + show " "+ configuration %show_configuration | + show " "+ slab %{start(out); slab_stat(out); end(out);} | + show " "+ palloc %{start(out); palloc_stat(out); end(out);} | + show " "+ stat %{start(out); stat_print(out);end(out);} | + save " "+ coredump %{coredump(60); ok(out);} | + save " "+ snapshot %{snapshot(NULL, 0); ok(out);} | + exec " "+ string %mod_exec | + check " "+ slab %{slab_validate(); ok(out);} | + reload " "+ configuration %reload_configuration); main := commands eol; write init; @@ -159,8 +187,11 @@ admin_dispatch(void) fiber->rbuf->len -= (void *)pe - (void *)fiber->rbuf->data; fiber->rbuf->data = pe; - if (p != pe) + if (p != pe) { + start(out); tbuf_append(out, unknown_command, sizeof(unknown_command)); + end(out); + } return fiber_write(out->data, out->len); } diff --git a/core/fiber.c b/core/fiber.c index 0cb5361a3e26b33b5b1c639cca1e7f5d5d305e56..9d6c71312238e4df0ab8e29dbd97052e9a4eac73 100644 --- a/core/fiber.c +++ b/core/fiber.c @@ -1066,8 +1066,8 @@ fiber_info(struct tbuf *out) tbuf_printf(out, " fd: %4i\n", fiber->fd); tbuf_printf(out, " peer: %s\n", fiber_peer_name(fiber)); tbuf_printf(out, " stack: %p\n", stack_top); - tbuf_printf(out, " exc: %p, frame: %p\n", - ((void **)fiber->exc)[3], ((void **)fiber->exc)[3] + 2 * sizeof(void *)); + tbuf_printf(out, " exc: %p\n", ((void **)fiber->exc)[3]); + tbuf_printf(out, " exc_frame: %p, \n", ((void **)fiber->exc)[3] + 2 * sizeof(void *)); #ifdef BACKTRACE tbuf_printf(out, " backtrace:\n%s", backtrace(fiber->last_stack_frame, diff --git a/core/palloc.c b/core/palloc.c index 874fa9c199b290671d1722f073c161838dc767a2..d47e14eb75328964ee94253fdc2814b17d4cce88 100644 --- a/core/palloc.c +++ b/core/palloc.c @@ -326,8 +326,8 @@ palloc_stat(struct tbuf *buf) struct palloc_pool *pool; int chunks[class_count]; - tbuf_printf(buf, "palloc statistic:\n"); - tbuf_printf(buf, " classes:\n"); + tbuf_printf(buf, "palloc statistic:" CRLF); + tbuf_printf(buf, " classes:" CRLF); TAILQ_FOREACH(class, &classes, link) { int free_chunks = 0; SLIST_FOREACH(chunk, &class->chunks, free_link) @@ -335,20 +335,20 @@ palloc_stat(struct tbuf *buf) tbuf_printf(buf, " - { size: %"PRIu32 - ", free_chunks: %- 6i, busy_chunks: %- 6i }\n", class->size, + ", free_chunks: %- 6i, busy_chunks: %- 6i }" CRLF, class->size, free_chunks, class->chunks_count - free_chunks); } - tbuf_printf(buf, " pools:\n"); + tbuf_printf(buf, " pools:" CRLF); SLIST_FOREACH(pool, &pools, link) { for (int i = 0; i < class_count; i++) chunks[i] = 0; - tbuf_printf(buf, " - name: %s\n alloc: %" PRI_SZ "\n", + tbuf_printf(buf, " - name: %s\n alloc: %" PRI_SZ "" CRLF, pool->name, pool->allocated); if (pool->allocated > 0) { - tbuf_printf(buf, " busy chunks:\n"); + tbuf_printf(buf, " busy chunks:" CRLF); SLIST_FOREACH(chunk, &pool->chunks, busy_link) chunks[chunk->class->i]++; @@ -357,7 +357,7 @@ palloc_stat(struct tbuf *buf) TAILQ_FOREACH(class, &classes, link) { if (chunks[class->i] == 0) continue; - tbuf_printf(buf, " - { size: %"PRIu32", used: %i }\n", + tbuf_printf(buf, " - { size: %"PRIu32", used: %i }" CRLF, class->size, chunks[class->i]); if (indent == 0) diff --git a/core/salloc.c b/core/salloc.c index 7b845abcd752c10b02dac41a87421ad353aa4912..7a7843026680627a287df8386d51b6acb46fec88 100644 --- a/core/salloc.c +++ b/core/salloc.c @@ -332,7 +332,7 @@ slab_stat(struct tbuf *t) struct slab *slab; int slabs; i64 items, used, free, total_used = 0; - tbuf_printf(t, "slab statistics:\n classes:\n"); + tbuf_printf(t, "slab statistics:\n classes:" CRLF); for (int i = 0; i < slab_active_classes; i++) { slabs = items = used = free = 0; TAILQ_FOREACH(slab, &slab_classes[i].slabs, class_link) { @@ -348,12 +348,12 @@ slab_stat(struct tbuf *t) tbuf_printf(t, " - { item_size: %- 5i, slabs: %- 3i, items: %- 11" PRIi64 - ", bytes_used: %- 12" PRIi64 ", bytes_free: %- 12" PRIi64 " }\n", + ", bytes_used: %- 12" PRIi64 ", bytes_free: %- 12" PRIi64 " }" CRLF, (int)slab_classes[i].item_size, slabs, items, used, free); } - tbuf_printf(t, " items_used: %.2f\n", (double)total_used / arena.size * 100); - tbuf_printf(t, " arena_used: %.2f\n", (double)arena.used / arena.size * 100); + tbuf_printf(t, " items_used: %.2f" CRLF, (double)total_used / arena.size * 100); + tbuf_printf(t, " arena_used: %.2f" CRLF, (double)arena.used / arena.size * 100); } void diff --git a/core/stat.c b/core/stat.c index 96b0ef0fe5b2a53d68847adbb0414e6ced9f7dd3..85fd40f9968b979bbd2ea888e61ba872ce779106 100644 --- a/core/stat.c +++ b/core/stat.c @@ -81,7 +81,7 @@ void stat_print(struct tbuf *buf) { int max_len = 0; - tbuf_printf(buf, "statistics:\n"); + tbuf_printf(buf, "statistics:" CRLF); for (int i = 0; i <= stats_max; i++) { if (stats[i].name == NULL) @@ -99,7 +99,7 @@ stat_print(struct tbuf *buf) diff /= SECS; - tbuf_printf(buf, " %s:%*s{ rps: %- 6i, total: %- 12" PRIi64 " }\n", + tbuf_printf(buf, " %s:%*s{ rps: %- 6i, total: %- 12" PRIi64 " }" CRLF, stats[i].name, 1 + max_len - (int)strlen(stats[i].name), " ", diff, stats[i].value[SECS]); } diff --git a/core/tarantool.c b/core/tarantool.c index 6b83d73b80c8ed2dde5ae5d7491c48a61eab4f46..6128c729302bb37e76f15198ab6f57b9500fc448 100644 --- a/core/tarantool.c +++ b/core/tarantool.c @@ -64,6 +64,7 @@ struct tarantool_cfg cfg; bool init_storage, booting = true; extern int daemonize(int nochdir, int noclose); +void out_warning(int v, char *format, ...); static i32 load_cfg(struct tarantool_cfg *conf, i32 check_rdonly) @@ -79,7 +80,7 @@ load_cfg(struct tarantool_cfg *conf, i32 check_rdonly) f = fopen(cfg_filename, "r"); if (f == NULL) { - tbuf_printf(cfg_out, "\r\n\tcan't open config `%s'", cfg_filename); + out_warning(0, "can't open config `%s'", cfg_filename); return -1; } @@ -133,7 +134,7 @@ reload_cfg(struct tbuf *out) destroy_tarantool_cfg(&new_cfg1); destroy_tarantool_cfg(&new_cfg2); - tbuf_printf(out, "\r\n\tCould not accept read only '%s' option", diff); + out_warning(0, "tCould not accept read only '%s' option", diff); return -1; } diff --git a/include/util.h b/include/util.h index 4f23a4df19369efd1ef143dc36a118771e7651b9..ddbff310dbca5efc02503c3d45cb1c824c208561 100644 --- a/include/util.h +++ b/include/util.h @@ -98,6 +98,8 @@ typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; +#define CRLF "\r\n" + #ifdef GCC # define FORMAT_PRINTF gnu_printf #else diff --git a/test/box/reconfigure.result b/test/box/reconfigure.result index ae783fb1eef27def7860a8e5bf7d89253fd4f5b2..4f197ef54505f0c4d2d8ef7d5780e908ab1a059f 100644 --- a/test/box/reconfigure.result +++ b/test/box/reconfigure.result @@ -1,43 +1,52 @@ reload configuration -fail - Could not accept read only 'slab_alloc_arena' option - Could not accept read only 'pid_file' option - Could not accept read only 'primary_port' option - Could not accept read only 'secondary_port' option - Could not accept read only 'admin_port' option - Could not accept read only 'rows_per_wal' option - Could not accept read only 'namespace[0].enabled' option - Could not accept read only 'namespace[0].index[0].type' option - Could not accept read only 'namespace[0].index[0].unique' option - Could not accept read only 'namespace[0].index[0].key_field[0].fieldno' option - Could not accept read only 'namespace[0].index[0].key_field[0].type' option --- +fail: + - Could not accept read only 'slab_alloc_arena' option + - Could not accept read only 'pid_file' option + - Could not accept read only 'primary_port' option + - Could not accept read only 'secondary_port' option + - Could not accept read only 'admin_port' option + - Could not accept read only 'rows_per_wal' option + - Could not accept read only 'namespace[0].enabled' option + - Could not accept read only 'namespace[0].index[0].type' option + - Could not accept read only 'namespace[0].index[0].unique' option + - Could not accept read only 'namespace[0].index[0].key_field[0].fieldno' option + - Could not accept read only 'namespace[0].index[0].key_field[0].type' option +... reload configuration -fail - Option 'primary_port' is not set (or has a default value) - Option 'namespace[0].enabled' is not set (or has a default value) - Option 'namespace[0].index[0].type' is not set (or has a default value) - Option 'namespace[0].index[0].key_field[0].fieldno' is not set (or has a default value) --- +fail: + - Option 'primary_port' is not set (or has a default value) + - Option 'namespace[0].enabled' is not set (or has a default value) + - Option 'namespace[0].index[0].type' is not set (or has a default value) + - Option 'namespace[0].index[0].key_field[0].fieldno' is not set (or has a default value) +... reload configuration -fail - Option 'namespace' is not set (or has a default value) --- +fail: + - Option 'namespace' is not set (or has a default value) +... reload configuration -fail - Could not accept read only 'namespace[1].enabled' option --- +fail: + - Could not accept read only 'namespace[1].enabled' option +... reload configuration -fail - Could not accept read only 'namespace[0].index[0].key_field[1].fieldno' option --- +fail: + - Could not accept read only 'namespace[0].index[0].key_field[1].fieldno' option +... reload configuration +--- ok +... reload configuration -fail - gram_yyerror: syntax error, unexpected $end, expecting KEY_P or NULL_P at line 1 --- +fail: + - gram_yyerror: syntax error, unexpected $end, expecting KEY_P or NULL_P at line 1 +... reload configuration -fail - can't open config `tarantool.cfg' --- +fail: + - can't open config `tarantool.cfg' +... diff --git a/test/box/show.result b/test/box/show.result index 21b9349322be0cf90509cbfbbb91c4d5a47d43a1..87c6289d6171f88427ed75f109b8cebcbb142198 100644 --- a/test/box/show.result +++ b/test/box/show.result @@ -1,86 +1,97 @@ show stat -statistics: - INSERT: { rps: 0 , total: 0 } - SELECT_LIMIT: { rps: 0 , total: 0 } - SELECT: { rps: 0 , total: 0 } - UPDATE_FIELDS: { rps: 0 , total: 0 } - DELETE: { rps: 0 , total: 0 } --- +statistics: + INSERT: { rps: 0 , total: 0 } + SELECT_LIMIT: { rps: 0 , total: 0 } + SELECT: { rps: 0 , total: 0 } + UPDATE_FIELDS: { rps: 0 , total: 0 } + DELETE: { rps: 0 , total: 0 } +... help +--- available commands: -help -exit -show info -show fiber -show configuration -show slab -show palloc -show stat -save coredump -save snapshot -exec module command -reload configuration -�show configuration -configuration: - username: (null) - coredump: "0" - admin_port: "33015" - log_level: "4" - slab_alloc_arena: "0.1" - slab_alloc_minimal: "64" - slab_alloc_factor: "2" - work_dir: (null) - pid_file: "box.pid" - logger: (null) - logger_nonblock: "1" - io_collect_interval: "0" - backlog: "1024" - readahead: "16320" - snap_dir: "." - wal_dir: "." - primary_port: "33013" - secondary_port: "33014" - too_long_threshold: "0.5" - custom_proc_title: (null) - memcached: "0" - memcached_namespace: "23" - memcached_expire_per_loop: "1024" - memcached_expire_full_sweep: "3600" - snap_io_rate_limit: "0" - rows_per_wal: "50" - wal_fsync_delay: "0" - wal_writer_inbox_size: "128" - local_hot_standby: "0" - wal_dir_rescan_delay: "0.1" - panic_on_snap_error: "1" - panic_on_wal_error: "0" - remote_hot_standby: "0" - wal_feeder_ipaddr: (null) - wal_feeder_port: "0" - namespace[0].enabled: "1" - namespace[0].cardinality: "-1" - namespace[0].estimated_rows: "0" - namespace[0].index[0].type: "HASH" - namespace[0].index[0].unique: "1" - namespace[0].index[0].key_field[0].fieldno: "0" - namespace[0].index[0].key_field[0].type: "NUM" + - help + - exit + - show info + - show fiber + - show configuration + - show slab + - show palloc + - show stat + - save coredump + - save snapshot + - exec module command + - reload configuration +... +show configuration --- +configuration: + username: (null) + coredump: "0" + admin_port: "33015" + log_level: "4" + slab_alloc_arena: "0.1" + slab_alloc_minimal: "64" + slab_alloc_factor: "2" + work_dir: (null) + pid_file: "box.pid" + logger: (null) + logger_nonblock: "1" + io_collect_interval: "0" + backlog: "1024" + readahead: "16320" + snap_dir: "." + wal_dir: "." + primary_port: "33013" + secondary_port: "33014" + too_long_threshold: "0.5" + custom_proc_title: (null) + memcached: "0" + memcached_namespace: "23" + memcached_expire_per_loop: "1024" + memcached_expire_full_sweep: "3600" + snap_io_rate_limit: "0" + rows_per_wal: "50" + wal_fsync_delay: "0" + wal_writer_inbox_size: "128" + local_hot_standby: "0" + wal_dir_rescan_delay: "0.1" + panic_on_snap_error: "1" + panic_on_wal_error: "0" + remote_hot_standby: "0" + wal_feeder_ipaddr: (null) + wal_feeder_port: "0" + namespace[0].enabled: "1" + namespace[0].cardinality: "-1" + namespace[0].estimated_rows: "0" + namespace[0].index[0].type: "HASH" + namespace[0].index[0].unique: "1" + namespace[0].index[0].key_field[0].fieldno: "0" + namespace[0].index[0].key_field[0].type: "NUM" +... show stat -statistics: - INSERT: { rps: 0 , total: 0 } - SELECT_LIMIT: { rps: 0 , total: 0 } - SELECT: { rps: 0 , total: 0 } - UPDATE_FIELDS: { rps: 0 , total: 0 } - DELETE: { rps: 0 , total: 0 } --- +statistics: + INSERT: { rps: 0 , total: 0 } + SELECT_LIMIT: { rps: 0 , total: 0 } + SELECT: { rps: 0 , total: 0 } + UPDATE_FIELDS: { rps: 0 , total: 0 } + DELETE: { rps: 0 , total: 0 } +... save coredump +--- ok +... save snapshot +--- ok +... exec module command -unimplemented --- +unimplemented +... show info +--- info: version: "1.3.minor-<rev>-<commit> uptime: 0 @@ -90,4 +101,4 @@ info: recovery_lag: 0.000 recovery_last_update: 0.000 status: primary ---- +... diff --git a/test/box/sql.result b/test/box/sql.result index 41fe972cb795e74f84ffec28f4f256370919eb24..1a557c1d6bea0af58c1f42f25765d4a38b6db9fc 100644 --- a/test/box/sql.result +++ b/test/box/sql.result @@ -16,7 +16,9 @@ select * from t0 where k0 = 1 Found 1 tuple: [1, 'I am a tuple'] save snapshot +--- ok +... select * from t0 where k0 = 1 Found 1 tuple: [1, 'I am a tuple'] diff --git a/test/lib/tarantool_connection.py b/test/lib/tarantool_connection.py index 949de4c586edd5410af6c0287281cf2f8f6b587f..4db46c375cbe61b3aaf262f6bfa92fc578e83c2c 100644 --- a/test/lib/tarantool_connection.py +++ b/test/lib/tarantool_connection.py @@ -25,6 +25,7 @@ import socket import sys import string import cStringIO +import yaml import re import sql import struct @@ -75,11 +76,12 @@ class AdminConnection: if not buf: break res = res + buf; - if (res.rfind("\n---\r\n") >= 0 or - res.rfind("module command\r\n") >= 0 or - res.rfind("try typing help.\r\n") >= 0 or - res.rfind("ok\r\n") >= 0): + if (res.rfind("\r\n...\r\n") >= 0): break + + # validate yaml by parsing it + yaml.load(res) + return res def write(self, fragment):