From 6a23719c75308da2e11b68d7407abe78a7717aaa Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 28 Nov 2016 18:32:45 +0100 Subject: [PATCH] tests: fixup for vtysh-grammar merge Tests weren't updated for vtysh-grammar yet... NB: things still fail since some CLI behaviour changed. Signed-off-by: David Lamparter --- tests/common-cli.c | 4 ++-- tests/common-cli.h | 2 +- tests/test-cli.c | 8 ++++---- tests/test-commands.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/common-cli.c b/tests/common-cli.c index aed20b2d53..9cc1626fe8 100644 --- a/tests/common-cli.c +++ b/tests/common-cli.c @@ -34,13 +34,13 @@ struct thread_master *master; int dump_args(struct vty *vty, const char *descr, - int argc, const char **argv) + int argc, struct cmd_token *argv[]) { int i; vty_out (vty, "%s with %d args.%s", descr, argc, VTY_NEWLINE); for (i = 0; i < argc; i++) { - vty_out (vty, "[%02d]: %s%s", i, argv[i], VTY_NEWLINE); + vty_out (vty, "[%02d]: %s%s", i, argv[i]->arg, VTY_NEWLINE); } return CMD_SUCCESS; diff --git a/tests/common-cli.h b/tests/common-cli.h index 8f6751512e..9c72b08e44 100644 --- a/tests/common-cli.h +++ b/tests/common-cli.h @@ -36,7 +36,7 @@ extern void test_init (void); extern struct thread_master *master; extern int dump_args(struct vty *vty, const char *descr, - int argc, const char **argv); + int argc, struct cmd_token *argv[]); #define DUMMY_HELPSTR \ "00\n01\n02\n03\n04\n05\n06\n07\n08\n09\n" \ diff --git a/tests/test-cli.c b/tests/test-cli.c index 6fab6d52cb..e7bed0991e 100644 --- a/tests/test-cli.c +++ b/tests/test-cli.c @@ -28,10 +28,10 @@ DUMMY_DEFUN(cmd0, "arg ipv4 A.B.C.D"); DUMMY_DEFUN(cmd1, "arg ipv4m A.B.C.D/M"); DUMMY_DEFUN(cmd2, "arg ipv6 X:X::X:X"); DUMMY_DEFUN(cmd3, "arg ipv6m X:X::X:X/M"); -DUMMY_DEFUN(cmd4, "arg range <5-15>"); -DUMMY_DEFUN(cmd5, "pat a ( a|b)"); -DUMMY_DEFUN(cmd6, "pat b (a|)"); -DUMMY_DEFUN(cmd7, "pat c (a | b|c) A.B.C.D"); +DUMMY_DEFUN(cmd4, "arg range (5-15)"); +DUMMY_DEFUN(cmd5, "pat a < a|b>"); +DUMMY_DEFUN(cmd6, "pat b "); +DUMMY_DEFUN(cmd7, "pat c A.B.C.D"); DUMMY_DEFUN(cmd8, "pat d { foo A.B.C.D|bar X:X::X:X| baz }"); DUMMY_DEFUN(cmd9, "pat e [ WORD ]"); DUMMY_DEFUN(cmd10, "pat f [key]"); diff --git a/tests/test-commands.c b/tests/test-commands.c index b4613a567d..c0bc39f88f 100644 --- a/tests/test-commands.c +++ b/tests/test-commands.c @@ -146,7 +146,7 @@ static struct cmd_node keychain_key_node = }; static int -test_callback(struct cmd_element *cmd, struct vty *vty, int argc, const char *argv[]) +test_callback(const struct cmd_element *cmd, struct vty *vty, int argc, struct cmd_token *argv[]) { int offset; int rv; @@ -162,7 +162,7 @@ test_callback(struct cmd_element *cmd, struct vty *vty, int argc, const char *ar for (i = 0; i < argc; i++) { rv = snprintf(test_buf + offset, sizeof(test_buf) - offset, "%s'%s'", - (i == 0) ? ": " : ", ", argv[i]); + (i == 0) ? ": " : ", ", argv[i]->arg); if (rv < 0) abort(); offset += rv; @@ -332,7 +332,7 @@ test_run(struct prng *prng, struct vty *vty, const char *cmd, unsigned int edit_ for (j = 0; j < vector_active(descriptions); j++) { struct cmd_token *cmd = vector_slot(descriptions, j); - printf(" '%s' '%s'\n", cmd->cmd, cmd->desc); + printf(" '%s' '%s'\n", cmd->text, cmd->desc); } vector_free(descriptions); } -- 2.39.5