[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Apr 11 13:56:08 MDT 2010


The branch, master has been updated
       via  1d3b00b... s4:dbspeed torture - improve also the TDB code part
       via  1fd6d9c... s4:dbspeed torture - remove unneeded newlines on "torture_result"
      from  b65c8d0... s4: Fix more test results to not conflict with subunit commands.

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


- Log -----------------------------------------------------------------
commit 1d3b00bfd7ddfa983a68ecf4b0033729a42e9baa
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Apr 11 21:44:20 2010 +0200

    s4:dbspeed torture - improve also the TDB code part
    
    Always use the label "failed" on failures, always close the database context
    (child of "tmp_ctx") when deleting database file.

commit 1fd6d9cd661692e6b0ac950127a0d5b80945bfad
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Apr 11 21:37:23 2010 +0200

    s4:dbspeed torture - remove unneeded newlines on "torture_result"
    
    According to Jelmer's post on the technical list.

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

Summary of changes:
 source4/torture/local/dbspeed.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 77e0174..1541d0e 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -36,6 +36,7 @@ static bool tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1,
 {
 	TDB_DATA key, data;
 	int ret;
+
 	key.dptr = (uint8_t *)talloc_asprintf(tdbw, fmt1, i);
 	key.dsize = strlen((char *)key.dptr)+1;
 	data.dptr = (uint8_t *)talloc_asprintf(tdbw, fmt2, i+10000);
@@ -66,9 +67,8 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
 	tdbw = tdb_wrap_open(tmp_ctx, "test.tdb", 
 			     10000, 0, O_RDWR|O_CREAT|O_TRUNC, 0600);
 	if (!tdbw) {
-		unlink("test.tdb");
-		talloc_free(tmp_ctx);
-		torture_fail(torture, "Failed to open test.tdb");
+		torture_result(torture, TORTURE_FAIL, "Failed to open test.tdb");
+		goto failed;
 	}
 
 	torture_comment(torture, "Adding %d SID records\n", torture_entries);
@@ -77,13 +77,13 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
 		if (!tdb_add_record(tdbw, 
 				    "S-1-5-21-53173311-3623041448-2049097239-%u",
 				    "UID %u", i)) {
-			torture_result(torture, TORTURE_FAIL, "Failed to add SID %d\n", i);
+			torture_result(torture, TORTURE_FAIL, "Failed to add SID %d!", i);
 			goto failed;
 		}
 		if (!tdb_add_record(tdbw, 
 				    "UID %u",
 				    "S-1-5-21-53173311-3623041448-2049097239-%u", i)) {
-			torture_result(torture, TORTURE_FAIL, "Failed to add UID %d\n", i);
+			torture_result(torture, TORTURE_FAIL, "Failed to add UID %d!", i);
 			goto failed;
 		}
 	}
@@ -100,7 +100,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
 		data = tdb_fetch(tdbw->tdb, key);
 		talloc_free(key.dptr);
 		if (data.dptr == NULL) {
-			torture_result(torture, TORTURE_FAIL, "Failed to fetch SID %d\n", i);
+			torture_result(torture, TORTURE_FAIL, "Failed to find SID %d!", i);
 			goto failed;
 		}
 		free(data.dptr);
@@ -109,7 +109,7 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
 		data = tdb_fetch(tdbw->tdb, key);
 		talloc_free(key.dptr);
 		if (data.dptr == NULL) {
-			torture_result(torture, TORTURE_FAIL, "Failed to fetch UID %d\n", i);
+			torture_result(torture, TORTURE_FAIL, "Failed to find UID %d!", i);
 			goto failed;
 		}
 		free(data.dptr);
@@ -118,14 +118,13 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
 	tdb_speed = count/timeval_elapsed(&tv);
 	torture_comment(torture, "tdb speed %.2f ops/sec\n", tdb_speed);
 	
-
-	unlink("test.tdb");
 	talloc_free(tmp_ctx);
+	unlink("test.tdb");
 	return true;
 
 failed:
-	unlink("test.tdb");
 	talloc_free(tmp_ctx);
+	unlink("test.tdb");
 	return false;
 }
 
@@ -188,11 +187,11 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
 	/* add an index */
 	ldif = ldb_ldif_read_string(ldb, &init_ldif);
 	if (ldif == NULL) {
-		torture_result(torture, TORTURE_FAIL, "Didn't get LDIF data!\n");
+		torture_result(torture, TORTURE_FAIL, "Didn't get LDIF data!");
 		goto failed;
 	}
 	if (ldb_add(ldb, ldif->msg) != LDB_SUCCESS) {
-		torture_result(torture, TORTURE_FAIL, "Couldn't apply LDIF data!\n");
+		torture_result(torture, TORTURE_FAIL, "Couldn't apply LDIF data!");
 		talloc_free(ldif);
 		goto failed;
 	}
@@ -202,13 +201,13 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
 
 	for (i=0;i<torture_entries;i++) {
 		if (!ldb_add_record(ldb, i)) {
-			torture_result(torture, TORTURE_FAIL, "Failed to add SID %d\n", i);
+			torture_result(torture, TORTURE_FAIL, "Failed to add SID %d", i);
 			goto failed;
 		}
 	}
 
 	if (talloc_total_blocks(tmp_ctx) > 100) {
-		torture_result(torture, TORTURE_FAIL, "memory leak in ldb add\n");
+		torture_result(torture, TORTURE_FAIL, "memory leak in ldb add");
 		goto failed;
 	}
 
@@ -223,20 +222,20 @@ 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_result(torture, TORTURE_FAIL, "Failed to find SID %d!\n", 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_result(torture, TORTURE_FAIL, "Failed to find UID %d!\n", i);
+			torture_result(torture, TORTURE_FAIL, "Failed to find UID %d!", i);
 			goto failed;
 		}
 		talloc_free(res);
 	}
 
 	if (talloc_total_blocks(tmp_ctx) > 100) {
-		torture_result(torture, TORTURE_FAIL, "memory leak in ldb search\n");
+		torture_result(torture, TORTURE_FAIL, "memory leak in ldb search");
 		goto failed;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list