kvlist = rte_kvargs_parse(args, valid_keys);
if (kvlist == NULL) {
printf("rte_kvargs_parse() error");
- rte_kvargs_free(kvlist);
goto fail;
}
rte_kvargs_free(kvlist);
/* first test without valid_keys */
- args = "foo=1234;check=value0;check=value1";
+ args = "foo=1234,check=value0,check=value1";
valid_keys = NULL;
kvlist = rte_kvargs_parse(args, valid_keys);
if (kvlist == NULL) {
printf("rte_kvargs_parse() error");
- rte_kvargs_free(kvlist);
goto fail;
}
/* call check_handler() for all entries with key="check" */
rte_kvargs_free(kvlist);
/* second test using valid_keys */
- args = "foo=droids;check=value0;check=value1;check=wrong_value";
+ args = "foo=droids,check=value0,check=value1,check=wrong_value";
valid_keys = valid_keys_list;
kvlist = rte_kvargs_parse(args, valid_keys);
if (kvlist == NULL) {
printf("rte_kvargs_parse() error");
- rte_kvargs_free(kvlist);
goto fail;
}
/* call check_handler() on all entries with key="check", it
/* list of argument that should fail */
const char *args_list[] = {
"wrong-key=x", /* key not in valid_keys_list */
- "foo=1;foo=", /* empty value */
- "foo=1;;foo=2", /* empty key/value */
- "foo=1;foo", /* no value */
- "foo=1;=2", /* no key */
- ";=", /* also test with a smiley */
+ "foo=1,foo=", /* empty value */
+ "foo=1,,foo=2", /* empty key/value */
+ "foo=1,foo", /* no value */
+ "foo=1,=2", /* no key */
+ ",=", /* also test with a smiley */
NULL };
const char **args;
const char *valid_keys_list[] = { "foo", "check", NULL };
return -1;
}
-int test_kvargs(void)
+static int
+test_kvargs(void)
{
printf("== test valid case ==\n");
if (test_valid_kvargs() < 0)
return -1;
return 0;
}
+
+REGISTER_TEST_COMMAND(kvargs_autotest, test_kvargs);