diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-05 17:04:30 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-05 17:04:30 +1030 |
commit | bb09b32910f6da647f5409f974eb056169ab9cdb (patch) | |
tree | 64daed75db83bc9beb010e4b150ed98dfd8aa1ff /lib/tdb2 | |
parent | 6d248534936ce5169d651b7d5e47ae8c74efb610 (diff) | |
download | samba-bb09b32910f6da647f5409f974eb056169ab9cdb.tar.gz samba-bb09b32910f6da647f5409f974eb056169ab9cdb.tar.bz2 samba-bb09b32910f6da647f5409f974eb056169ab9cdb.zip |
tdb2: simplify failtest helper.
failtest now culls duplicates for itself (and more efficiently), so
don't replicate the logic here. It changes things a bit, because
failtest uses backtraces rather than a simple call point to find
duplicates.
Also, fix one case (in run-11-simple-fetch.c) where we simply exited
rather than using failtest_exit(). We got away with it before, because
we never hit that particular failure pattern.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 3d99c9334fe3067c88772547b9c06acec21616ea)
Diffstat (limited to 'lib/tdb2')
-rw-r--r-- | lib/tdb2/test/failtest_helper.c | 32 | ||||
-rw-r--r-- | lib/tdb2/test/run-11-simple-fetch.c | 2 |
2 files changed, 3 insertions, 31 deletions
diff --git a/lib/tdb2/test/failtest_helper.c b/lib/tdb2/test/failtest_helper.c index f3ef09a6c3..f094a5974e 100644 --- a/lib/tdb2/test/failtest_helper.c +++ b/lib/tdb2/test/failtest_helper.c @@ -25,21 +25,6 @@ bool failmatch(const struct failtest_call *call, == '/'))); } -static const struct failtest_call * -find_repeat(const struct tlist_calls *history, - const struct failtest_call *call) -{ - const struct failtest_call *i; - - tlist_for_each(history, i, list) { - if (i != call) - continue; - if (failmatch(i, call->file, call->line, call->type)) - return i; - } - return NULL; -} - static bool is_nonblocking_lock(const struct failtest_call *call) { return call->type == FAILTEST_FCNTL && call->u.fcntl.cmd == F_SETLK; @@ -85,7 +70,7 @@ bool exit_check_log(struct tlist_calls *history) enum failtest_result block_repeat_failures(struct tlist_calls *history) { - const struct failtest_call *i, *last; + const struct failtest_call *last; last = tlist_tail(history, struct failtest_call, list); @@ -95,25 +80,12 @@ block_repeat_failures(struct tlist_calls *history) if (failmatch(last, INITIAL_TDB_MALLOC) || failmatch(last, URANDOM_OPEN) || failmatch(last, URANDOM_READ)) { - if (find_repeat(history, last)) - return FAIL_DONT_FAIL; return FAIL_PROBE; } /* Unlock or non-blocking lock is fail-once. */ - if (is_unlock(last)) { - /* Find a previous unlock at this point? */ - i = find_repeat(history, last); - if (i && is_unlock(i)) - return FAIL_DONT_FAIL; + if (is_unlock(last) || is_nonblocking_lock(last)) return FAIL_PROBE; - } else if (is_nonblocking_lock(last)) { - /* Find a previous non-blocking lock at this point? */ - i = find_repeat(history, last); - if (i && is_nonblocking_lock(i)) - return FAIL_DONT_FAIL; - return FAIL_PROBE; - } return FAIL_OK; } diff --git a/lib/tdb2/test/run-11-simple-fetch.c b/lib/tdb2/test/run-11-simple-fetch.c index 8681eef22c..fd77332016 100644 --- a/lib/tdb2/test/run-11-simple-fetch.c +++ b/lib/tdb2/test/run-11-simple-fetch.c @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) } } ok1(tap_log_messages == 0); - return exit_status(); + failtest_exit(exit_status()); fail: failtest_suppress = true; |