[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Apr 11 03:32:04 MDT 2010


The branch, master has been updated
       via  52ab3ca... s4:torture - "dbspeed" test
       via  753698e... s4:torture - "dbspeed" test
       via  cc32e7a... s4:torture - "dbspeed" test
      from  b91484a... s3: Cosmetics -- I could not spot where "chal" was initialized

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 52ab3ca5e697bc638a20a338b857521ee69949a7
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Apr 11 11:22:41 2010 +0200

    s4:torture - "dbspeed" test
    
    Calculate the leaks on base of the "tmp_ctx" not the torture context.

commit 753698e070ce5b9efbe5889a6a7434115520223d
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Apr 11 11:21:19 2010 +0200

    s4:torture - "dbspeed" test
    
    Unify error handling.

commit cc32e7aff2e071e0b1985097bb8526ce36160391
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Apr 11 11:13:31 2010 +0200

    s4:torture - "dbspeed" test
    
    Add more "talloc_free"s where needed or useful.

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/local/dbspeed.c |   38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 236a52b..38dd01c 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -142,10 +142,12 @@ static bool ldb_add_record(struct ldb_context *ldb, unsigned rid)
 
 	msg->dn = ldb_dn_new_fmt(msg, ldb, "SID=S-1-5-21-53173311-3623041448-2049097239-%u", rid);
 	if (msg->dn == NULL) {
+		talloc_free(msg);
 		return false;
 	}
 
 	if (ldb_msg_add_fmt(msg, "UID", "%u", rid) != 0) {
+		talloc_free(msg);
 		return false;
 	}
 
@@ -179,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);
@@ -199,7 +207,7 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
 		}
 	}
 
-	if (talloc_total_blocks(torture) > 100) {
+	if (talloc_total_blocks(tmp_ctx) > 100) {
 		torture_result(torture, TORTURE_FAIL, "memory leak in ldb add\n");
 		goto failed;
 	}
@@ -215,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");
+	if (talloc_total_blocks(tmp_ctx) > 100) {
+		torture_result(torture, TORTURE_FAIL, "memory leak in ldb search\n");
+		goto failed;
 	}
 
 	ldb_speed = count/timeval_elapsed(&tv);
@@ -236,14 +245,13 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
 
 	torture_comment(torture, "ldb/tdb speed ratio is %.2f%%\n", (100*ldb_speed/tdb_speed));
 	
-
-	unlink("./test.ldb");
 	talloc_free(tmp_ctx);
+	unlink("./test.ldb");
 	return true;
 
 failed:
-	unlink("./test.ldb");
 	talloc_free(tmp_ctx);
+	unlink("./test.ldb");
 	return false;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list