From 195c233035d723bd38f9da462f14661414be8039 Mon Sep 17 00:00:00 2001 From: Yuriy Vostrikov <vostrikov@corp.mail.ru> Date: Mon, 27 Dec 2010 13:16:40 +0300 Subject: [PATCH] [core] Ensure that all output from administrative console is in YAML. Fix output to be YAML parsable. Fix test to actually check for YAML syntax. Use CRLF consistently. --- core/admin.c | 183 +++++++++++++++++++++++++------------------ core/admin.rl | 96 ++++++++++++++--------- core/fiber.c | 20 ++--- core/palloc.c | 14 ++-- core/salloc.c | 8 +- core/stat.c | 4 +- include/util.h | 2 + test/box/show.result | 116 ++++++++------------------- test/lib/admin.py | 8 +- 9 files changed, 228 insertions(+), 223 deletions(-) diff --git a/core/admin.c b/core/admin.c index d4923b101a..2312257139 100644 --- a/core/admin.c +++ b/core/admin.c @@ -41,26 +41,25 @@ #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" - ; +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; -static const char unknown_command[] = "unknown command. try typing help.\r\n"; +static const char unknown_command[] = "unknown command. try typing help." CRLF; -#line 64 "core/admin.c" +#line 63 "core/admin.c" static const int admin_start = 1; static const int admin_first_final = 88; static const int admin_error = 0; @@ -68,19 +67,28 @@ static const int admin_error = 0; static const int admin_en_main = 1; -#line 63 "core/admin.rl" +#line 62 "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, "---\r\n"); + tbuf_printf(out, "---" CRLF); +} + +static void +ok(struct tbuf *out) +{ + start(out); + tbuf_printf(out, "ok" CRLF); + end(out); } static int @@ -100,12 +108,12 @@ admin_dispatch(void) p = fiber->rbuf->data; -#line 104 "core/admin.c" +#line 112 "core/admin.c" { cs = admin_start; } -#line 109 "core/admin.c" +#line 117 "core/admin.c" { if ( p == pe ) goto _test_eof; @@ -166,146 +174,164 @@ case 6: } goto st0; tr11: -#line 140 "core/admin.rl" +#line 161 "core/admin.rl" {slab_validate(); ok(out);} goto st88; tr18: -#line 130 "core/admin.rl" +#line 151 "core/admin.rl" {return 0;} goto st88; tr27: -#line 127 "core/admin.rl" +#line 148 "core/admin.rl" {strend = p;} -#line 139 "core/admin.rl" - {mod_exec(strstart, strend - strstart, out); end(out);} +#line 126 "core/admin.rl" + { + start(out); + mod_exec(strstart, strend - strstart, out); + end(out); + } goto st88; tr31: -#line 129 "core/admin.rl" - {tbuf_append(out, help, sizeof(help));} +#line 120 "core/admin.rl" + { + start(out); + tbuf_append(out, help, strlen(help)); + end(out); + } goto st88; tr44: -#line 137 "core/admin.rl" +#line 158 "core/admin.rl" {coredump(60); ok(out);} goto st88; tr53: -#line 138 "core/admin.rl" +#line 159 "core/admin.rl" {snapshot(NULL, 0); ok(out);} goto st88; tr70: -#line 94 "core/admin.rl" +#line 102 "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 st88; tr84: -#line 132 "core/admin.rl" - {fiber_info(out);end(out);} +#line 153 "core/admin.rl" + {start(out); fiber_info(out); end(out);} goto st88; tr90: -#line 131 "core/admin.rl" - {mod_info(out); end(out);} +#line 152 "core/admin.rl" + {start(out); mod_info(out); end(out);} goto st88; tr95: -#line 135 "core/admin.rl" - {palloc_stat(out);end(out);} +#line 156 "core/admin.rl" + {start(out); palloc_stat(out); end(out);} goto st88; tr103: -#line 134 "core/admin.rl" - {slab_stat(out);end(out);} +#line 155 "core/admin.rl" + {start(out); slab_stat(out); end(out);} goto st88; tr107: -#line 136 "core/admin.rl" - {stat_print(out);end(out);} +#line 157 "core/admin.rl" + {start(out); stat_print(out);end(out);} goto st88; st88: if ( ++p == pe ) goto _test_eof88; case 88: -#line 238 "core/admin.c" +#line 255 "core/admin.c" goto st0; tr12: -#line 140 "core/admin.rl" +#line 161 "core/admin.rl" {slab_validate(); ok(out);} goto st7; tr19: -#line 130 "core/admin.rl" +#line 151 "core/admin.rl" {return 0;} goto st7; tr28: -#line 127 "core/admin.rl" +#line 148 "core/admin.rl" {strend = p;} -#line 139 "core/admin.rl" - {mod_exec(strstart, strend - strstart, out); end(out);} +#line 126 "core/admin.rl" + { + start(out); + mod_exec(strstart, strend - strstart, out); + end(out); + } goto st7; tr32: -#line 129 "core/admin.rl" - {tbuf_append(out, help, sizeof(help));} +#line 120 "core/admin.rl" + { + start(out); + tbuf_append(out, help, strlen(help)); + end(out); + } goto st7; tr45: -#line 137 "core/admin.rl" +#line 158 "core/admin.rl" {coredump(60); ok(out);} goto st7; tr54: -#line 138 "core/admin.rl" +#line 159 "core/admin.rl" {snapshot(NULL, 0); ok(out);} goto st7; tr71: -#line 94 "core/admin.rl" +#line 102 "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; tr85: -#line 132 "core/admin.rl" - {fiber_info(out);end(out);} +#line 153 "core/admin.rl" + {start(out); fiber_info(out); end(out);} goto st7; tr91: -#line 131 "core/admin.rl" - {mod_info(out); end(out);} +#line 152 "core/admin.rl" + {start(out); mod_info(out); end(out);} goto st7; tr96: -#line 135 "core/admin.rl" - {palloc_stat(out);end(out);} +#line 156 "core/admin.rl" + {start(out); palloc_stat(out); end(out);} goto st7; tr104: -#line 134 "core/admin.rl" - {slab_stat(out);end(out);} +#line 155 "core/admin.rl" + {start(out); slab_stat(out); end(out);} goto st7; tr108: -#line 136 "core/admin.rl" - {stat_print(out);end(out);} +#line 157 "core/admin.rl" + {start(out); stat_print(out);end(out);} goto st7; st7: if ( ++p == pe ) goto _test_eof7; case 7: -#line 309 "core/admin.c" +#line 335 "core/admin.c" if ( (*p) == 10 ) goto st88; goto st0; @@ -386,28 +412,28 @@ case 15: } goto tr24; tr24: -#line 127 "core/admin.rl" +#line 148 "core/admin.rl" {strstart = p;} goto st16; st16: if ( ++p == pe ) goto _test_eof16; case 16: -#line 397 "core/admin.c" +#line 423 "core/admin.c" switch( (*p) ) { case 10: goto tr27; case 13: goto tr28; } goto st16; tr25: -#line 127 "core/admin.rl" +#line 148 "core/admin.rl" {strstart = p;} goto st17; st17: if ( ++p == pe ) goto _test_eof17; case 17: -#line 411 "core/admin.c" +#line 437 "core/admin.c" switch( (*p) ) { case 10: goto tr27; case 13: goto tr28; @@ -1166,14 +1192,17 @@ case 87: _out: {} } -#line 145 "core/admin.rl" +#line 166 "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 a73061c705..065a14403c 100644 --- a/core/admin.rl +++ b/core/admin.rl @@ -39,39 +39,47 @@ #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" - ; - - -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; + + +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 int @@ -95,19 +103,32 @@ 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); + } + eol = "\n" | "\r\n"; show = "sh"("o"("w")?)?; info = "in"("f"("o")?)?; @@ -126,17 +147,17 @@ admin_dispatch(void) exec = "ex"("e"("c")?)?; string = [^\r\n]+ >{strstart = p;} %{strend = p;}; - 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);}| + 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);}); main := commands eol; @@ -147,8 +168,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 328e4d0253..4ffdab0273 100644 --- a/core/fiber.c +++ b/core/fiber.c @@ -1043,25 +1043,25 @@ void fiber_info(struct tbuf *out) { struct fiber *fiber; - tbuf_printf(out, "fibers:\n"); + tbuf_printf(out, "fibers:" CRLF); SLIST_FOREACH(fiber, &fibers, link) { void *stack_top = fiber->coro.stack + fiber->coro.stack_size; - tbuf_printf(out, " - fid: %4i\n", fiber->fid); - tbuf_printf(out, " csw: %i\n", fiber->csw); - tbuf_printf(out, " name: %s\n", fiber->name); - tbuf_printf(out, " inbox: %i\n", ring_size(fiber->inbox)); - 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, " - fid: %4i" CRLF, fiber->fid); + tbuf_printf(out, " csw: %i" CRLF, fiber->csw); + tbuf_printf(out, " name: %s" CRLF, fiber->name); + tbuf_printf(out, " inbox: %i" CRLF, ring_size(fiber->inbox)); + tbuf_printf(out, " fd: %4i" CRLF, fiber->fd); + tbuf_printf(out, " peer: %s" CRLF, fiber_peer_name(fiber)); + tbuf_printf(out, " stack: %p" CRLF, stack_top); #if CORO_ASM void *stack_bottom = fiber->coro.stack; struct frame *frame = fiber->rbp; - tbuf_printf(out, " backtrace:\n"); + tbuf_printf(out, " backtrace:" CRLF); while (stack_bottom < (void *)frame && (void *)frame < stack_top) { - tbuf_printf(out, " - { frame: %p, pc: %p }\n", + tbuf_printf(out, " - { frame: %p, pc: %p }" CRLF, frame + 2 * sizeof(void *), frame->ret); frame = frame->rbp; } diff --git a/core/palloc.c b/core/palloc.c index 874fa9c199..d47e14eb75 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 7b845abcd7..7a78430266 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 96b0ef0fe5..85fd40f996 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/include/util.h b/include/util.h index bc7e6f5370..6c0dd7d400 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/show.result b/test/box/show.result index 24a7b9e3d9..f00b203b75 100644 --- a/test/box/show.result +++ b/test/box/show.result @@ -1,92 +1,42 @@ 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 } ---- + DELETE: {rps: 0, total: 0} + INSERT: {rps: 0, total: 0} + SELECT: {rps: 0, total: 0} + SELECT_LIMIT: {rps: 0, total: 0} + UPDATE_FIELDS: {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 -�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" ---- +available commands: [help, exit, show info, show fiber, show configuration, show slab, + show palloc, show stat, save coredump, save snapshot, exec module command] +show configuration +configuration: {admin_port: '33015', backlog: '1024', coredump: '0', custom_proc_title: (null), + io_collect_interval: '0', local_hot_standby: '0', log_level: '4', logger: (null), + logger_nonblock: '1', memcached: '0', memcached_expire_full_sweep: '3600', memcached_expire_per_loop: '1024', + memcached_namespace: '23', 'namespace[0].cardinality': '-1', 'namespace[0].enabled': '1', + 'namespace[0].estimated_rows': '0', 'namespace[0].index[0].key_field[0].fieldno': '0', + 'namespace[0].index[0].key_field[0].type': NUM, 'namespace[0].index[0].type': HASH, + 'namespace[0].index[0].unique': '1', panic_on_snap_error: '1', panic_on_wal_error: '0', + pid_file: box.pid, primary_port: '33013', readahead: '16320', remote_hot_standby: '0', + rows_per_wal: '50', secondary_port: '33014', slab_alloc_arena: '0.1', slab_alloc_factor: '2', + slab_alloc_minimal: '64', snap_dir: ., snap_io_rate_limit: '0', too_long_threshold: '0.5', + username: (null), wal_dir: ., wal_dir_rescan_delay: '0.1', wal_feeder_ipaddr: (null), + wal_feeder_port: '0', wal_fsync_delay: '0', wal_writer_inbox_size: '128', work_dir: (null)} 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 } ---- + DELETE: {rps: 0, total: 0} + INSERT: {rps: 0, total: 0} + SELECT: {rps: 0, total: 0} + SELECT_LIMIT: {rps: 0, total: 0} + UPDATE_FIELDS: {rps: 0, total: 0} save coredump -ok +ok +... save snapshot -ok +ok +... exec module command -unimplemented ---- +unimplemented +... show info -info: - version: "1.3.minor-<rev>-<commit> - uptime: 0 - pid: <pid> - wal_writer_pid: <pid> - lsn: 1 - recovery_lag: 0.000 - recovery_last_update: 0.000 - status: primary ---- +info: {lsn: 1, pid: <pid>, recovery_lag: 0.0, recovery_last_update: 0.0, status: primary, + uptime: 0, version: 1.3.minor-<rev>-<commit> wal_writer_pid: <pid>} diff --git a/test/lib/admin.py b/test/lib/admin.py index 600bb1f136..514537318e 100644 --- a/test/lib/admin.py +++ b/test/lib/admin.py @@ -25,6 +25,7 @@ import socket import sys import string import cStringIO +import yaml class Connection: def __init__(self, host, port): @@ -54,13 +55,12 @@ class Connection: 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 + res = yaml.dump(yaml.load(res)) return res + def write(self, fragment): """This is to support print >> admin, "command" syntax. For every print statement, write is invoked twice: one to -- GitLab