tile: fix build
[dpdk.git] / app / test / test_kvargs.c
index 2db9d08..4d9e805 100644 (file)
@@ -78,18 +78,16 @@ static int test_valid_kvargs(void)
        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" */
@@ -145,12 +143,11 @@ static int test_valid_kvargs(void)
        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
@@ -190,11 +187,11 @@ static int test_invalid_kvargs(void)
        /* 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 };
@@ -223,7 +220,8 @@ static int test_invalid_kvargs(void)
        return -1;
 }
 
-int test_kvargs(void)
+static int
+test_kvargs(void)
 {
        printf("== test valid case ==\n");
        if (test_valid_kvargs() < 0)
@@ -233,3 +231,5 @@ int test_kvargs(void)
                return -1;
        return 0;
 }
+
+REGISTER_TEST_COMMAND(kvargs_autotest, test_kvargs);