- const struct failtest_call *i, *last = &history[num-1];
-
- if (failmatch(last, INITIAL_TDB_MALLOC)
- || failmatch(last, LOGGING_MALLOC)
- || failmatch(last, URANDOM_OPEN)
- || failmatch(last, URANDOM_READ)) {
- if (find_repeat(history, last, last))
- return FAIL_DONT_FAIL;
- return FAIL_PROBE;
- }
-
- /* Unlock or non-blocking lock is fail-once. */
- if (last->type == FAILTEST_FCNTL
- && last->u.fcntl.arg.fl.l_type == F_UNLCK) {
- /* Find a previous unlock at this point? */
- for (i = find_repeat(history, last, last);
- i;
- i = find_repeat(history, i, last)) {
- if (i->u.fcntl.arg.fl.l_type == F_UNLCK)
- return FAIL_DONT_FAIL;
- }
- return FAIL_PROBE;
- } else if (is_nonblocking_lock(last)) {
- /* Find a previous non-blocking lock at this point? */
- for (i = find_repeat(history, last, last);
- i;
- i = find_repeat(history, i, last)) {
- if (is_nonblocking_lock(i))
- return FAIL_DONT_FAIL;
- }
- return FAIL_PROBE;
- }
-
- return FAIL_OK;
-}
-
-static bool exit_check(struct failtest_call *history, unsigned num)
-{
- unsigned int i;
-
- for (i = 0; i < num; i++) {
- if (!history[i].fail)
- continue;
- /* Failing the /dev/urandom open doesn't count: we fall back. */
- if (failmatch(&history[i], URANDOM_OPEN))
- continue;
-
- /* Similarly with read fail. */
- if (failmatch(&history[i], URANDOM_READ))
- continue;
-
- /* Initial allocation of tdb doesn't log. */
- if (failmatch(&history[i], INITIAL_TDB_MALLOC))
- continue;
-
- /* We don't block "failures" on non-blocking locks. */
- if (is_nonblocking_lock(&history[i]))
- continue;
-
- if (!tap_log_messages)
- diag("We didn't log for %u (%s:%u)",
- i, history[i].file, history[i].line);
- return tap_log_messages != 0;
- }
- return true;