Skip to content

Commit

Permalink
Fix miscounting of expected failures in C unit test API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Bachmeyer committed Nov 27, 2022
1 parent 999b7c0 commit c173c00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
2022-11-26 Jacob Bachmeyer <[email protected]>

* dejagnu.h (xpass): Fix use of wrong counter.
(xfail): Likewise.
(totals): Report unexpected passes if any occurred.

* doc/dejagnu.texi (DejaGnu unit test protocol): Add end marker
line using "END" to allow detecting tests that exit prematurely.
The "Totals:" line was previously used for this purpose, but it
Expand Down
6 changes: 4 additions & 2 deletions dejagnu.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ xpass (const char* fmt, ...)
{
va_list ap;

passed++;
xpassed++;
va_start (ap, fmt);
vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
Expand All @@ -103,7 +103,7 @@ xfail (const char* fmt, ...)
{
va_list ap;

failed++;
xfailed++;
va_start (ap, fmt);
vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
Expand Down Expand Up @@ -157,6 +157,8 @@ totals (void)
printf ("\t#real failed:\t\t%d\n", failed);
if (xfailed)
printf ("\t#expected failures:\t\t%d\n", xfailed);
if (xpassed)
printf ("\t#unexpected passes:\t\t%d\n", xpassed);
if (untest)
printf ("\t#untested:\t\t%d\n", untest);
if (unresolve)
Expand Down

0 comments on commit c173c00

Please sign in to comment.