summaryrefslogtreecommitdiff
path: root/tests/lib/cli/common_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/cli/common_cli.c')
-rw-r--r--tests/lib/cli/common_cli.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/lib/cli/common_cli.c b/tests/lib/cli/common_cli.c
index ad9658f95f..56db460438 100644
--- a/tests/lib/cli/common_cli.c
+++ b/tests/lib/cli/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;
@@ -49,6 +49,12 @@ int dump_args(struct vty *vty, const char *descr,
static void vty_do_exit(void)
{
printf ("\nend.\n");
+ cmd_terminate ();
+ vty_terminate ();
+ thread_master_free (master);
+ closezlog ();
+
+ log_memstats_stderr ("testcli");
exit (0);
}
@@ -64,20 +70,20 @@ main (int argc, char **argv)
/* master init. */
master = thread_master_create ();
- zlog_default = openzlog ("common-cli", ZLOG_NONE, 0,
- LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
- zlog_set_level (NULL, ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
- zlog_set_level (NULL, ZLOG_DEST_STDOUT, ZLOG_DISABLED);
- zlog_set_level (NULL, ZLOG_DEST_MONITOR, LOG_DEBUG);
+ openzlog("common-cli", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID,
+ LOG_DAEMON);
+ zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED);
+ zlog_set_level(ZLOG_DEST_STDOUT, ZLOG_DISABLED);
+ zlog_set_level(ZLOG_DEST_MONITOR, LOG_DEBUG);
/* Library inits. */
cmd_init (1);
- host.name = strdup ("test");
+ cmd_hostname_set ("test");
vty_init (master);
memory_init ();
- test_init ();
+ test_init (argc, argv);
vty_stdio (vty_do_exit);