summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-04-11 11:21:19 +0200
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-04-11 11:31:47 +0200
commit753698e070ce5b9efbe5889a6a7434115520223d (patch)
treed991cb54b20b6b02aedf6b5933f6b505827e8466 /source4/torture
parentcc32e7aff2e071e0b1985097bb8526ce36160391 (diff)
downloadsamba-753698e070ce5b9efbe5889a6a7434115520223d.tar.gz
samba-753698e070ce5b9efbe5889a6a7434115520223d.tar.bz2
samba-753698e070ce5b9efbe5889a6a7434115520223d.zip
s4:torture - "dbspeed" test
Unify error handling.
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/local/dbspeed.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 4033979331..e56aa4ecd5 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -181,15 +181,21 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb",
NULL, NULL, LDB_FLG_NOSYNC);
if (!ldb) {
- unlink("./test.ldb");
- talloc_free(tmp_ctx);
- torture_fail(torture, "Failed to open test.ldb");
+ torture_result(torture, TORTURE_FAIL, "Failed to open test.ldb");
+ goto failed;
}
/* add an index */
ldif = ldb_ldif_read_string(ldb, &init_ldif);
- if (ldif == NULL) goto failed;
- if (ldb_add(ldb, ldif->msg) != LDB_SUCCESS) goto failed;
+ if (ldif == NULL) {
+ torture_result(torture, TORTURE_FAIL, "Didn't get LDIF data!\n");
+ goto failed;
+ }
+ if (ldb_add(ldb, ldif->msg) != LDB_SUCCESS) {
+ torture_result(torture, TORTURE_FAIL, "Couldn't apply LDIF data!\n");
+ talloc_free(ldif);
+ goto failed;
+ }
talloc_free(ldif);
torture_comment(torture, "Adding %d SID records\n", torture_entries);
@@ -217,20 +223,21 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
i = random() % torture_entries;
dn = ldb_dn_new_fmt(tmp_ctx, ldb, "SID=S-1-5-21-53173311-3623041448-2049097239-%u", i);
if (ldb_search(ldb, tmp_ctx, &res, dn, LDB_SCOPE_BASE, NULL, NULL) != LDB_SUCCESS || res->count != 1) {
- torture_fail(torture, talloc_asprintf(torture, "Failed to find SID %d", i));
+ torture_result(torture, TORTURE_FAIL, "Failed to find SID %d", i);
+ goto failed;
}
talloc_free(res);
talloc_free(dn);
if (ldb_search(ldb, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, NULL, "(UID=%u)", i) != LDB_SUCCESS || res->count != 1) {
- torture_fail(torture, talloc_asprintf(torture, "Failed to find UID %d", i));
+ torture_result(torture, TORTURE_FAIL, "Failed to find UID %d", i);
+ goto failed;
}
talloc_free(res);
}
if (talloc_total_blocks(torture) > 100) {
- unlink("./test.ldb");
- talloc_free(tmp_ctx);
- torture_fail(torture, "memory leak in ldb search");
+ torture_result(torture, TORTURE_FAIL, "memory leak in ldb search\n");
+ goto failed;
}
ldb_speed = count/timeval_elapsed(&tv);