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

Function test_invalid_kvargs

dpdk/app/test/test_kvargs.c:249–281  ·  view source on GitHub ↗

test several error cases */

Source from the content-addressed store, hash-verified

247
248/* test several error cases */
249static int test_invalid_kvargs(void)
250{
251 struct rte_kvargs *kvlist;
252 /* list of argument that should fail */
253 const char *args_list[] = {
254 "wrong-key=x", /* key not in valid_keys_list */
255 NULL };
256 const char **args;
257 const char *valid_keys_list[] = { "foo", "check", NULL };
258 const char **valid_keys = valid_keys_list;
259
260 for (args = args_list; *args != NULL; args++) {
261
262 kvlist = rte_kvargs_parse(*args, valid_keys);
263 if (kvlist != NULL) {
264 printf("rte_kvargs_parse() returned 0 (but should not)\n");
265 rte_kvargs_free(kvlist);
266 goto fail;
267 }
268 }
269 return 0;
270
271 fail:
272 printf("while processing <%s>", *args);
273 if (valid_keys != NULL && *valid_keys != NULL) {
274 printf(" using valid_keys=<%s", *valid_keys);
275 while (*(++valid_keys) != NULL)
276 printf(",%s", *valid_keys);
277 printf(">");
278 }
279 printf("\n");
280 return -1;
281}
282
283static int
284test_kvargs(void)

Callers 1

test_kvargsFunction · 0.85

Calls 3

rte_kvargs_parseFunction · 0.85
rte_kvargs_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected