Skip to content

Commit

Permalink
Handle the bail out case in the signal path
Browse files Browse the repository at this point in the history
When a TAP test program asks to bail out, we forcibly kill it.  As a
result, it is very likely that our later wait() will tell us that the
program exited due to a signal... and, because we caused it upon
request of the test, we need to report the test as failed instead of
broken.

However, there is a race.  If the test program happens to finish after
it has printed the "Bail out!" message and before we send the signal,
the program will exit cleanly.  I guess this (different scheduling
behavior) is why the code worked at all in FreeBSD but failed in NetBSD.
  • Loading branch information
jmmv committed Nov 27, 2013
1 parent d6f8d5c commit 6959c50
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ status_to_result(int status, const kyua_tap_summary_t* summary,
} else {
assert(WIFSIGNALED(status));
*success = false;
return kyua_result_write(result_file, KYUA_RESULT_BROKEN,
"Received signal %d", WTERMSIG(status));

if (summary->bail_out) {
return kyua_result_write(result_file, KYUA_RESULT_FAILED,
"Bailed out");
} else {
return kyua_result_write(result_file, KYUA_RESULT_BROKEN,
"Received signal %d", WTERMSIG(status));
}
}
}

Expand Down

0 comments on commit 6959c50

Please sign in to comment.