]>
git.proxmox.com Git - mirror_frr.git/blob - tests/lib/cli/common_cli.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * generic CLI test helper functions
5 * Copyright (C) 2015 by David Lamparter,
6 * for Open Source Routing / NetDEF, Inc.
18 #include "common_cli.h"
20 struct thread_master
*master
;
22 int dump_args(struct vty
*vty
, const char *descr
, int argc
,
23 struct cmd_token
*argv
[])
26 vty_out(vty
, "%s with %d args.\n", descr
, argc
);
27 for (i
= 0; i
< argc
; i
++) {
28 vty_out(vty
, "[%02d] %s@%s: %s\n", i
, argv
[i
]->text
,
29 argv
[i
]->varname
, argv
[i
]->arg
);
35 static void vty_do_exit(int isexit
)
42 thread_master_free(master
);
44 log_memstats(stderr
, "testcli");
49 const struct frr_yang_module_info
*const *test_yang_modules
= NULL
;
50 int test_log_prio
= ZLOG_DISABLED
;
53 int main(int argc
, char **argv
)
58 /* Set umask before anything for security */
62 master
= thread_master_create(NULL
);
64 zlog_aux_init("NONE: ", test_log_prio
);
68 cmd_hostname_set("test");
69 cmd_domainname_set("test.domain");
71 vty_init(master
, false);
74 for (yangcount
= 0; test_yang_modules
&& test_yang_modules
[yangcount
];
77 nb_init(master
, test_yang_modules
, yangcount
, false);
79 test_init(argc
, argv
);
81 vty_stdio(vty_do_exit
);
83 /* Fetch next active thread. */
84 while (thread_fetch(master
, &thread
))