This is extending the existing unittest to also cover corner cases of rte_eal_devargs_parse().
Signed-off-by: Jan Blunck <jblu...@infradead.org> --- test/test/test_devargs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test/test_devargs.c b/test/test/test_devargs.c index 02fec8b1f..178c3b243 100644 --- a/test/test/test_devargs.c +++ b/test/test/test_devargs.c @@ -58,6 +58,7 @@ test_devargs(void) { struct rte_devargs_list save_devargs_list; struct rte_devargs *devargs; + struct rte_devargs devargs_stack; /* save the real devargs_list, it is restored at the end of the test */ save_devargs_list = devargs_list; @@ -121,6 +122,25 @@ test_devargs(void) if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "000f:0:0") == 0) goto fail; + if (rte_eal_devargs_parse("", &devargs_stack) == 0) { + printf("Error in rte_eal_devargs_parse()\n"); + goto fail; + } + + if (rte_eal_devargs_parse("08:00.1,foo=bar", &devargs_stack) != 0) { + printf("Error in rte_eal_devargs_parse(08:00.1,foo=bar)\n"); + goto fail; + } + devargs = TAILQ_FIRST(&devargs_list); + if (devargs != NULL) + goto fail; + devargs = &devargs_stack; + if (strcmp(devargs->name, "08:00.1") != 0) + goto fail; + if (!devargs->args || strcmp(devargs->args, "foo=bar") != 0) + goto fail; + + free_devargs_list(); devargs_list = save_devargs_list; return 0; -- 2.13.2