Add tests for JSON and sudo-style log output.

This commit is contained in:
Todd C. Miller
2023-03-13 19:42:54 -06:00
parent 0f46ffa9f1
commit 1b3991b717
17 changed files with 797 additions and 13 deletions

View File

@@ -124,7 +124,7 @@ done:
static void
usage(void)
{
fprintf(stderr, "usage: %s [-c] input_file ...\n",
fprintf(stderr, "usage: %s [-cv] input_file ...\n",
getprogname());
exit(EXIT_FAILURE);
}
@@ -176,11 +176,14 @@ main(int argc, char *argv[])
initprogname(argc > 0 ? argv[0] : "check_parse_json");
while ((ch = getopt(argc, argv, "c")) != -1) {
while ((ch = getopt(argc, argv, "cv")) != -1) {
switch (ch) {
case 'c':
cat = true;
break;
case 'v':
/* ignored */
break;
default:
usage();
}
@@ -258,8 +261,8 @@ next:
}
if (ntests != 0) {
printf("iolog_json: %d test%s run, %d errors, %d%% success rate\n",
ntests, ntests == 1 ? "" : "s", errors,
printf("%s: %d test%s run, %d errors, %d%% success rate\n",
getprogname(), ntests, ntests == 1 ? "" : "s", errors,
(ntests - errors) * 100 / ntests);
}