- if (WIFEXITED(status) && WEXITSTATUS(status) != rctx->expected_return ) {
- if (rctx->expected_return)
- ERROR3("Child \"%s\" returned code %d instead of %d", rctx->cmd,
- WEXITSTATUS(status), rctx->expected_return);
- else
- ERROR2("Child \"%s\" returned code %d", rctx->cmd, WEXITSTATUS(status));
- errcode = 40+WEXITSTATUS(status);
+ if (WIFSIGNALED(rctx->status) && rctx->expected_signal &&
+ strcmp(signal_name(WTERMSIG(rctx->status), rctx->expected_signal),
+ rctx->expected_signal)) {
+ ERROR4("Test suite `%s': NOK (%s got signal %s instead of %s)",
+ testsuite_name, rctx->filepos,
+ signal_name(WTERMSIG(rctx->status), rctx->expected_signal),
+ rctx->expected_signal);
+ errcode = WTERMSIG(rctx->status) + 4;
+ }
+
+ if (!WIFSIGNALED(rctx->status) && rctx->expected_signal) {
+ ERROR3("Test suite `%s': NOK (child %s expected signal %s)",
+ testsuite_name, rctx->filepos, rctx->expected_signal);
+ errcode = 5;
+ }
+
+ if (WIFEXITED(rctx->status)
+ && WEXITSTATUS(rctx->status) != rctx->expected_return) {
+ if (rctx->expected_return)
+ ERROR4("Test suite `%s': NOK (<%s> returned code %d instead of %d)",
+ testsuite_name, rctx->filepos,
+ WEXITSTATUS(rctx->status), rctx->expected_return);
+ else
+ ERROR3("Test suite `%s': NOK (<%s> returned code %d)",
+ testsuite_name, rctx->filepos, WEXITSTATUS(rctx->status));
+ errcode = 40 + WEXITSTATUS(rctx->status);
+
+ }
+ rctx->expected_return = 0;
+
+ if (rctx->expected_signal) {
+ free(rctx->expected_signal);
+ rctx->expected_signal = NULL;
+ }