]> granicus.if.org Git - vnstat/commitdiff
improve vnstat parseargs test coverage, fix minor findings
authorTeemu Toivola <git@humdi.net>
Sat, 31 Aug 2019 13:38:12 +0000 (16:38 +0300)
committerTeemu Toivola <git@humdi.net>
Sat, 31 Aug 2019 13:38:12 +0000 (16:38 +0300)
src/vnstat_func.c
src/vnstati.c
tests/cli_tests.c

index 6c6350864c17eaba8123a28995126c807efa1357..00f25b239feb16eafe5afacb34cab142b6205274 100644 (file)
@@ -176,6 +176,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                        }
                } else if ((strcmp(argv[currentarg], "--style")) == 0) {
                        if (currentarg + 1 < argc && isdigit(argv[currentarg + 1][0])) {
+                               cfg.ostyle = atoi(argv[currentarg + 1]);
                                if (cfg.ostyle > 4 || cfg.ostyle < 0) {
                                        printf("Error: Invalid style parameter \"%d\" for --style.\n", cfg.ostyle);
                                        printf(" Valid parameters:\n");
@@ -187,7 +188,6 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        printf("        and show raw values in --oneline\n");
                                        exit(EXIT_FAILURE);
                                }
-                               cfg.ostyle = atoi(argv[currentarg + 1]);
                                if (debug)
                                        printf("Style changed: %d\n", cfg.ostyle);
                                currentarg++;
@@ -244,6 +244,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-m") == 0) || (strcmp(argv[currentarg], "--months") == 0)) {
                        cfg.qmode = 2;
@@ -254,6 +255,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-t") == 0) || (strcmp(argv[currentarg], "--top") == 0)) {
                        cfg.qmode = 3;
@@ -264,6 +266,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-s") == 0) || (strcmp(argv[currentarg], "--short") == 0)) {
                        cfg.qmode = 5;
@@ -276,6 +279,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-hg") == 0) || (strcmp(argv[currentarg], "--hoursgraph") == 0)) {
                        cfg.qmode = 7;
@@ -288,6 +292,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-5") == 0) || (strcmp(argv[currentarg], "--fiveminutes") == 0)) {
                        cfg.qmode = 12;
@@ -298,6 +303,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if (strcmp(argv[currentarg], "--oneline") == 0) {
                        cfg.qmode = 9;
@@ -305,6 +311,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                if (argv[currentarg + 1][0] == 'b') {
                                        cfg.ostyle = 4;
                                        currentarg++;
+                                       continue;
                                } else {
                                        printf("Error: Invalid mode parameter \"%s\" for --oneline.\n", argv[currentarg + 1]);
                                        printf(" Valid parameters:\n");
@@ -314,6 +321,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                }
                        }
                } else if (strcmp(argv[currentarg], "--xml") == 0) {
+                       cfg.qmode = 8;
                        if (currentarg + 1 < argc && argv[currentarg + 1][0] != '-' && !isdigit(argv[currentarg + 1][0])) {
                                p->xmlmode = argv[currentarg + 1][0];
                                if (strlen(argv[currentarg + 1]) != 1 || strchr("afhdmyt", p->xmlmode) == NULL) {
@@ -329,6 +337,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                        if (currentarg + 1 < argc && isdigit(argv[currentarg + 1][0])) {
                                cfg.listjsonxml = atoi(argv[currentarg + 1]);
@@ -337,9 +346,10 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
-                       cfg.qmode = 8;
                } else if (strcmp(argv[currentarg], "--json") == 0) {
+                       cfg.qmode = 10;
                        if (currentarg + 1 < argc && argv[currentarg + 1][0] != '-' && !isdigit(argv[currentarg + 1][0])) {
                                p->jsonmode = argv[currentarg + 1][0];
                                if (strlen(argv[currentarg + 1]) != 1 || strchr("afhdmyt", p->jsonmode) == NULL) {
@@ -355,6 +365,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                        if (currentarg + 1 < argc && isdigit(argv[currentarg + 1][0])) {
                                cfg.listjsonxml = atoi(argv[currentarg + 1]);
@@ -363,10 +374,11 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
-                       cfg.qmode = 10;
                } else if ((strcmp(argv[currentarg], "-ru") == 0) || (strcmp(argv[currentarg], "--rateunit")) == 0) {
                        if (currentarg + 1 < argc && isdigit(argv[currentarg + 1][0])) {
+                               cfg.rateunit = atoi(argv[currentarg + 1]);
                                if (cfg.rateunit > 1 || cfg.rateunit < 0) {
                                        printf("Error: Invalid parameter \"%d\" for --rateunit.\n", cfg.rateunit);
                                        printf(" Valid parameters:\n");
@@ -374,7 +386,6 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                        printf("    1 - bits\n");
                                        exit(EXIT_FAILURE);
                                }
-                               cfg.rateunit = atoi(argv[currentarg + 1]);
                                if (debug)
                                        printf("Rateunit changed: %d\n", cfg.rateunit);
                                currentarg++;
@@ -388,15 +399,13 @@ void parseargs(PARAMS *p, int argc, char **argv)
                        if (currentarg + 1 < argc && isdigit(argv[currentarg + 1][0])) {
                                cfg.sampletime = atoi(argv[currentarg + 1]);
                                currentarg++;
-                               p->traffic = 1;
-                               p->query = 0;
-                               continue;
                        }
                        p->traffic = 1;
                        p->query = 0;
+                       continue;
                } else if ((strcmp(argv[currentarg], "-l") == 0) || (strcmp(argv[currentarg], "--live") == 0)) {
                        if (currentarg + 1 < argc && argv[currentarg + 1][0] != '-') {
-                               if (!isdigit(argv[currentarg + 1][0]) || p->livemode > 1 || p->livemode < 0) {
+                               if (!isdigit(argv[currentarg + 1][0]) || atoi(argv[currentarg + 1]) > 1 || atoi(argv[currentarg + 1]) < 0) {
                                        printf("Error: Invalid mode parameter \"%s\" for -l / --live.\n", argv[currentarg + 1]);
                                        printf(" Valid parameters:\n");
                                        printf("    0 - show packets per second (default)\n");
@@ -408,6 +417,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                        }
                        p->livetraffic = 1;
                        p->query = 0;
+                       continue;
                } else if (strcmp(argv[currentarg], "--force") == 0) {
                        p->force = 1;
                } else if (strcmp(argv[currentarg], "--showconfig") == 0) {
@@ -437,6 +447,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                }
                                strncpy_nt(p->databegin, argv[currentarg + 1], 18);
                                currentarg++;
+                               continue;
                        } else {
                                printf("Error: Date of format YYYY-MM-DD HH:MM or YYYY-MM-DD for %s missing.\n", argv[currentarg]);
                                exit(EXIT_FAILURE);
@@ -449,6 +460,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                                }
                                strncpy_nt(p->dataend, argv[currentarg + 1], 18);
                                currentarg++;
+                               continue;
                        } else {
                                printf("Error: Date of format YYYY-MM-DD HH:MM or YYYY-MM-DD for %s missing.\n", argv[currentarg]);
                                exit(EXIT_FAILURE);
@@ -466,7 +478,7 @@ void parseargs(PARAMS *p, int argc, char **argv)
                        printf("vnStat %s by Teemu Toivola <tst at iki dot fi>\n", getversion());
                        exit(EXIT_SUCCESS);
                } else {
-                       printf("Unknown parameter \"%s\". Use --help for help->\n", argv[currentarg]);
+                       printf("Unknown parameter \"%s\". Use --help for help.\n", argv[currentarg]);
                        exit(EXIT_FAILURE);
                }
        }
index 24798b7309c87a87a1812992818fe8733fb44b10..6a22bd6de35f9a4ef4397e0353b22103fa495a16 100644 (file)
@@ -265,6 +265,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-m") == 0) || (strcmp(argv[currentarg], "--months")) == 0) {
                        cfg.qmode = 2;
@@ -275,6 +276,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-t") == 0) || (strcmp(argv[currentarg], "--top")) == 0) {
                        cfg.qmode = 3;
@@ -285,6 +287,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-y") == 0) || (strcmp(argv[currentarg], "--years")) == 0) {
                        cfg.qmode = 4;
@@ -295,6 +298,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-h") == 0) || (strcmp(argv[currentarg], "--hours")) == 0) {
                        cfg.qmode = 8;
@@ -305,6 +309,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-5") == 0) || (strcmp(argv[currentarg], "--fiveminutes")) == 0) {
                        cfg.qmode = 9;
@@ -315,6 +320,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                        exit(EXIT_FAILURE);
                                }
                                currentarg++;
+                               continue;
                        }
                } else if ((strcmp(argv[currentarg], "-s") == 0) || (strcmp(argv[currentarg], "--summary")) == 0) {
                        cfg.qmode = 5;
@@ -357,6 +363,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                }
                                strncpy_nt(ic->databegin, argv[currentarg + 1], 18);
                                currentarg++;
+                               continue;
                        } else {
                                printf("Error: Date of format YYYY-MM-DD HH:MM or YYYY-MM-DD for %s missing.\n", argv[currentarg]);
                                exit(EXIT_FAILURE);
@@ -369,6 +376,7 @@ void parseargs(IPARAMS *p, IMAGECONTENT *ic, int argc, char **argv)
                                }
                                strncpy_nt(ic->dataend, argv[currentarg + 1], 18);
                                currentarg++;
+                               continue;
                        } else {
                                printf("Error: Date of format YYYY-MM-DD HH:MM or YYYY-MM-DD for %s missing.\n", argv[currentarg]);
                                exit(EXIT_FAILURE);
index 6f9f40b697128633f3c25b059d8198fff30bd952..71b3c98f519a2c08a5ae2a70ea27733177c79170 100644 (file)
@@ -126,6 +126,278 @@ START_TEST(vnstat_parseargs_detects_unknown_parameters)
 }
 END_TEST
 
+START_TEST(vnstat_parseargs_can_modify_settings)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--debug", "--traffic", "12", "--add", "--rename", "aname", "--config", \
+        "does_nothing", "-l", "1", "--remove", "-i", "ethsomething", "--style", "0", "--dbdir", \
+        "dbsomewhere", "-q", "-d", "1", "-m", "2", "-t", "3", "-s", "-y", "4", "-hg", "-h", "5", "-5", "6", \
+        "--oneline", "b", "--xml", "h", "--json", "d", "-ru", "--rateunit", "0", \
+        "--force", "--setalias", "super", "--begin", "2000-01-01", \
+        "--end", "2001-01-01", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    defaultcfg();
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+
+    ck_assert_str_eq(p.interface, "ethsomething");
+    ck_assert_int_eq(p.defaultiface, 0);
+    ck_assert_int_eq(cfg.ostyle, 4);
+    ck_assert_str_eq(cfg.dbdir, "dbsomewhere");
+    ck_assert_int_eq(p.query, 1);
+    ck_assert_int_eq(p.force, 1);
+    ck_assert_int_eq(cfg.qmode, 10);
+    ck_assert_int_eq(p.jsonmode, 'd');
+    ck_assert_int_eq(p.xmlmode, 'h');
+    ck_assert_int_eq(cfg.rateunit, 0);
+    ck_assert_int_eq(p.setalias, 1);
+    ck_assert_str_eq(p.alias, "super");
+    ck_assert_str_eq(p.newifname, "aname");
+    ck_assert_int_eq(p.renameiface, 1);
+    ck_assert_int_eq(p.removeiface, 1);
+    ck_assert_int_eq(p.traffic, 1);
+    ck_assert_int_eq(cfg.sampletime, 12);
+    ck_assert_int_eq(p.livetraffic, 1);
+    ck_assert_int_eq(p.livemode, 1);
+    ck_assert_int_eq(cfg.listdays, 1);
+    ck_assert_int_eq(cfg.listmonths, 2);
+    ck_assert_int_eq(cfg.listtop, 3);
+    ck_assert_int_eq(cfg.listyears, 4);
+    ck_assert_int_eq(cfg.listhours, 5);
+    ck_assert_int_eq(cfg.listfivemins, 6);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_does_not_allow_too_long_interface_names)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--iface", "12345678901234567890123456789012", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_style_requires_parameter)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--style", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_style_checks_parameter)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--style", "9001", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_knows_that_update_is_not_supported)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "-u", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_dbdir_requires_a_directory)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--dbdir", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_oneline_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--oneline", "a", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_xml_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--xml", "b", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_json_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--json", "b", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_rateunit_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--rateunit", "2", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_live_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--live", "2", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_begin_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--begin", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_end_gives_help)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--end", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_begin_validates_input)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--begin", "world_domination", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_end_validates_input)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--end", "what?", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_can_show_config)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--showconfig", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_iface_requires_parameter)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--iface", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_locale_requires_parameter)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--locale", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_setalias_requires_parameter)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--setalias", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
+START_TEST(vnstat_parseargs_rename_requires_parameter)
+{
+    PARAMS p;
+    char *argv[] = {"vnstat", "--rename", NULL};
+    int argc = sizeof(argv) / sizeof(char*) - 1;
+
+    initparams(&p);
+    suppress_output();
+    parseargs(&p, argc, argv);
+}
+END_TEST
+
 void add_cli_tests(Suite *s)
 {
        TCase *tc_cli = tcase_create("CLI");
@@ -141,5 +413,25 @@ void add_cli_tests(Suite *s)
     tcase_add_exit_test(tc_cli, vnstat_parseargs_can_longhelp, 0);
     tcase_add_exit_test(tc_cli, vnstat_parseargs_can_show_version, 0);
     tcase_add_exit_test(tc_cli, vnstat_parseargs_detects_unknown_parameters, 1);
+    tcase_add_test(tc_cli, vnstat_parseargs_can_modify_settings);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_does_not_allow_too_long_interface_names, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_style_requires_parameter, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_style_checks_parameter, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_knows_that_update_is_not_supported, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_dbdir_requires_a_directory, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_oneline_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_xml_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_json_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_rateunit_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_live_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_begin_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_end_gives_help, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_begin_validates_input, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_end_validates_input, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_can_show_config, 0);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_iface_requires_parameter, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_locale_requires_parameter, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_setalias_requires_parameter, 1);
+    tcase_add_exit_test(tc_cli, vnstat_parseargs_rename_requires_parameter, 1);
     suite_add_tcase(s, tc_cli);
 }