From 6959c5063486bf51cbb81667f158caf4d4299b42 Mon Sep 17 00:00:00 2001 From: Julio Merino Date: Tue, 26 Nov 2013 22:54:47 -0500 Subject: [PATCH] Handle the bail out case in the signal path 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. --- tap_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tap_main.c b/tap_main.c index ec06dc3c..037ecb47 100644 --- a/tap_main.c +++ b/tap_main.c @@ -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)); + } } }