Skip to content

Commit

Permalink
Count and summarize failures and errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
kr committed Dec 15, 2008
1 parent c5cd9f0 commit a4fb87a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 7 additions & 5 deletions cut.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ struct test_output {
};

static int breakpoint = 0;
static int count = 0;
static int any_problems = 0;
static int count = 0, count_failures = 0, count_errors = 0;
static cut_fn cur_takedown;
static test_output problem_reports = 0;

Expand Down Expand Up @@ -125,6 +124,7 @@ void cut_exit( void )
char buf[BUF_SIZE];
test_output to;

printf("\n");
for (to = problem_reports; to; to = to->next) {
printf("\n%s in %s/%s", to->desc, to->group_name, to->test_name);
if (!WIFEXITED(to->status) || (WEXITSTATUS(to->status) != 255)) {
Expand All @@ -143,7 +143,9 @@ void cut_exit( void )
}
}

exit(any_problems);
printf("\n%d tests; %d failures; %d errors.\n", count, count_failures,
count_errors);
exit(!!(count_failures + count_errors));
}

/* Test Progress Accounting functions */
Expand Down Expand Up @@ -220,12 +222,12 @@ __cut_run(char *group_name, cut_fn bringup, cut_fn takedown, char *test_name,
} else if (WIFEXITED(status) && (WEXITSTATUS(status) == 255)) {
/* failure */
cut_mark_point('F', filename, lineno );
any_problems = 1;
count_failures++;
problem_desc = "Failure";
} else {
/* error */
cut_mark_point('E', filename, lineno );
any_problems = 1;
count_errors++;
problem_desc = "Error";
}

Expand Down
1 change: 0 additions & 1 deletion cutgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ void EmitUnitTesterBody()
}

BlankLine();
Emit( " printf(\"\\nDone.\\n\");" );
Emit( " cut_exit();\n" );
Emit( " return 0;\n}\n" );
}
Expand Down

0 comments on commit a4fb87a

Please sign in to comment.