MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_args

Function test_args

dpdk/app/test/test_devargs.c:18–51  ·  view source on GitHub ↗

Check layer arguments. */

Source from the content-addressed store, hash-verified

16
17/* Check layer arguments. */
18static int
19test_args(const char *devargs, const char *layer, const char *args, const int n)
20{
21 struct rte_kvargs *kvlist;
22
23 if (n == 0) {
24 if (args != NULL && strlen(args) > 0) {
25 printf("rte_devargs_parse(%s) %s args parsed (not expected)\n",
26 devargs, layer);
27 return -1;
28 } else {
29 return 0;
30 }
31 }
32 if (args == NULL) {
33 printf("rte_devargs_parse(%s) %s args not parsed\n",
34 devargs, layer);
35 return -1;
36 }
37 kvlist = rte_kvargs_parse(args, NULL);
38 if (kvlist == NULL) {
39 printf("rte_devargs_parse(%s) %s_str: %s not parsed\n",
40 devargs, layer, args);
41 return -1;
42 }
43 if ((int)kvlist->count != n) {
44 printf("rte_devargs_parse(%s) %s_str: %s kv number %u, not %d\n",
45 devargs, layer, args, kvlist->count, n);
46 rte_kvargs_free(kvlist);
47 return -1;
48 }
49 rte_kvargs_free(kvlist);
50 return 0;
51}
52
53struct devargs_case {
54 const char *devargs;

Callers 1

test_valid_devargs_casesFunction · 0.70

Calls 3

rte_kvargs_parseFunction · 0.85
rte_kvargs_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected