Changeset 745 for trunk/server/source4/torture/local
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 1 deleted
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/torture/local/dbspeed.c
r414 r745 22 22 #include "includes.h" 23 23 #include "system/filesys.h" 24 #include "../tdb/include/tdb.h"25 #include "lib/ldb/include/ldb.h"26 #include "lib/ldb/include/ldb_errors.h"27 #include "l ib/ldb_wrap.h"28 #include "lib/ tdb_wrap.h"24 #include <tdb.h> 25 #include <ldb.h> 26 #include <ldb_errors.h> 27 #include "ldb_wrap.h" 28 #include "lib/util/tdb_wrap.h" 29 29 #include "torture/smbtorture.h" 30 30 #include "param/param.h" … … 37 37 TDB_DATA key, data; 38 38 int ret; 39 39 40 key.dptr = (uint8_t *)talloc_asprintf(tdbw, fmt1, i); 40 41 key.dsize = strlen((char *)key.dptr)+1; … … 67 68 10000, 0, O_RDWR|O_CREAT|O_TRUNC, 0600); 68 69 if (!tdbw) { 69 unlink("test.tdb"); 70 talloc_free(tmp_ctx); 71 torture_fail(torture, "Failed to open test.tdb"); 70 torture_result(torture, TORTURE_FAIL, "Failed to open test.tdb"); 71 goto failed; 72 72 } 73 73 … … 78 78 "S-1-5-21-53173311-3623041448-2049097239-%u", 79 79 "UID %u", i)) { 80 torture_result(torture, TORTURE_FAIL, "Failed to add SID %d \n", i);80 torture_result(torture, TORTURE_FAIL, "Failed to add SID %d!", i); 81 81 goto failed; 82 82 } … … 84 84 "UID %u", 85 85 "S-1-5-21-53173311-3623041448-2049097239-%u", i)) { 86 torture_result(torture, TORTURE_FAIL, "Failed to add UID %d \n", i);86 torture_result(torture, TORTURE_FAIL, "Failed to add UID %d!", i); 87 87 goto failed; 88 88 } … … 101 101 talloc_free(key.dptr); 102 102 if (data.dptr == NULL) { 103 torture_result(torture, TORTURE_FAIL, "Failed to f etch SID %d\n", i);103 torture_result(torture, TORTURE_FAIL, "Failed to find SID %d!", i); 104 104 goto failed; 105 105 } … … 110 110 talloc_free(key.dptr); 111 111 if (data.dptr == NULL) { 112 torture_result(torture, TORTURE_FAIL, "Failed to f etch UID %d\n", i);112 torture_result(torture, TORTURE_FAIL, "Failed to find UID %d!", i); 113 113 goto failed; 114 114 } … … 119 119 torture_comment(torture, "tdb speed %.2f ops/sec\n", tdb_speed); 120 120 121 121 talloc_free(tmp_ctx); 122 122 unlink("test.tdb"); 123 talloc_free(tmp_ctx);124 123 return true; 125 124 126 125 failed: 126 talloc_free(tmp_ctx); 127 127 unlink("test.tdb"); 128 talloc_free(tmp_ctx);129 128 return false; 130 129 } … … 143 142 msg->dn = ldb_dn_new_fmt(msg, ldb, "SID=S-1-5-21-53173311-3623041448-2049097239-%u", rid); 144 143 if (msg->dn == NULL) { 144 talloc_free(msg); 145 145 return false; 146 146 } 147 147 148 if (ldb_msg_add_fmt(msg, "UID", "%u", rid) != 0) { 148 ret = ldb_msg_add_fmt(msg, "UID", "%u", rid); 149 if (ret != LDB_SUCCESS) { 150 talloc_free(msg); 149 151 return false; 150 152 } … … 177 179 torture_comment(torture, "Testing ldb speed for sidmap\n"); 178 180 179 ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb", 180 NULL, NULL, LDB_FLG_NOSYNC , NULL);181 ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb", 182 NULL, NULL, LDB_FLG_NOSYNC); 181 183 if (!ldb) { 182 unlink("./test.ldb"); 183 talloc_free(tmp_ctx); 184 torture_fail(torture, "Failed to open test.ldb"); 184 torture_result(torture, TORTURE_FAIL, "Failed to open test.ldb"); 185 goto failed; 185 186 } 186 187 187 188 /* add an index */ 188 189 ldif = ldb_ldif_read_string(ldb, &init_ldif); 189 if (ldif == NULL) goto failed; 190 if (ldb_add(ldb, ldif->msg) != LDB_SUCCESS) goto failed; 190 if (ldif == NULL) { 191 torture_result(torture, TORTURE_FAIL, "Didn't get LDIF data!"); 192 goto failed; 193 } 194 if (ldb_add(ldb, ldif->msg) != LDB_SUCCESS) { 195 torture_result(torture, TORTURE_FAIL, "Couldn't apply LDIF data!"); 196 talloc_free(ldif); 197 goto failed; 198 } 191 199 talloc_free(ldif); 192 200 … … 195 203 for (i=0;i<torture_entries;i++) { 196 204 if (!ldb_add_record(ldb, i)) { 197 torture_result(torture, TORTURE_FAIL, "Failed to add SID %d \n", i);198 goto failed; 199 } 200 } 201 202 if (talloc_total_blocks(t orture) > 100) {203 torture_result(torture, TORTURE_FAIL, "memory leak in ldb add \n");205 torture_result(torture, TORTURE_FAIL, "Failed to add SID %d", i); 206 goto failed; 207 } 208 } 209 210 if (talloc_total_blocks(tmp_ctx) > 100) { 211 torture_result(torture, TORTURE_FAIL, "memory leak in ldb add"); 204 212 goto failed; 205 213 } … … 216 224 dn = ldb_dn_new_fmt(tmp_ctx, ldb, "SID=S-1-5-21-53173311-3623041448-2049097239-%u", i); 217 225 if (ldb_search(ldb, tmp_ctx, &res, dn, LDB_SCOPE_BASE, NULL, NULL) != LDB_SUCCESS || res->count != 1) { 218 torture_fail(torture, talloc_asprintf(torture, "Failed to find SID %d", i)); 226 torture_result(torture, TORTURE_FAIL, "Failed to find SID %d!", i); 227 goto failed; 219 228 } 220 229 talloc_free(res); 221 230 talloc_free(dn); 222 231 if (ldb_search(ldb, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, NULL, "(UID=%u)", i) != LDB_SUCCESS || res->count != 1) { 223 torture_fail(torture, talloc_asprintf(torture, "Failed to find UID %d", i)); 232 torture_result(torture, TORTURE_FAIL, "Failed to find UID %d!", i); 233 goto failed; 224 234 } 225 235 talloc_free(res); 226 236 } 227 237 228 if (talloc_total_blocks(torture) > 100) { 229 unlink("./test.ldb"); 230 talloc_free(tmp_ctx); 231 torture_fail(torture, "memory leak in ldb search"); 238 if (talloc_total_blocks(tmp_ctx) > 100) { 239 torture_result(torture, TORTURE_FAIL, "memory leak in ldb search"); 240 goto failed; 232 241 } 233 242 … … 237 246 torture_comment(torture, "ldb/tdb speed ratio is %.2f%%\n", (100*ldb_speed/tdb_speed)); 238 247 239 248 talloc_free(tmp_ctx); 240 249 unlink("./test.ldb"); 241 talloc_free(tmp_ctx);242 250 return true; 243 251 244 252 failed: 253 talloc_free(tmp_ctx); 245 254 unlink("./test.ldb"); 246 talloc_free(tmp_ctx);247 255 return false; 248 256 } … … 250 258 struct torture_suite *torture_local_dbspeed(TALLOC_CTX *mem_ctx) 251 259 { 252 struct torture_suite *s = torture_suite_create(mem_ctx, " DBSPEED");260 struct torture_suite *s = torture_suite_create(mem_ctx, "dbspeed"); 253 261 torture_suite_add_simple_tcase_const(s, "tdb_speed", test_tdb_speed, 254 262 NULL); -
trunk/server/source4/torture/local/local.c
r414 r745 21 21 #include "torture/smbtorture.h" 22 22 #include "torture/local/proto.h" 23 #include "torture/ndr/ndr.h"24 23 #include "torture/ndr/proto.h" 25 24 #include "torture/auth/proto.h" 26 25 #include "../lib/crypto/test_proto.h" 27 26 #include "lib/registry/tests/proto.h" 27 #include "lib/replace/replace-test.h" 28 28 29 29 /* ignore me */ static struct torture_suite * … … 40 40 torture_local_util_time, 41 41 torture_local_util_data_blob, 42 torture_local_util_asn1, 43 torture_local_util_anonymous_shared, 42 44 torture_local_idtree, 45 torture_local_dlinklist, 43 46 torture_local_genrand, 44 47 torture_local_iconv, 45 48 torture_local_socket, 49 #ifdef SOCKET_WRAPPER 46 50 torture_local_socket_wrapper, 51 #endif 52 #ifdef NSS_WRAPPER 47 53 torture_local_nss_wrapper, 54 #endif 48 55 torture_pac, 49 56 torture_local_resolve, … … 60 67 torture_local_credentials, 61 68 torture_ldb, 69 torture_dsdb_dn, 70 torture_dsdb_syntax, 62 71 torture_registry, 63 72 NULL … … 68 77 int i; 69 78 struct torture_suite *suite = torture_suite_create( 70 talloc_autofree_context(), 71 "LOCAL"); 79 talloc_autofree_context(), "local"); 72 80 73 torture_suite_add_simple_test(suite, " TALLOC", torture_local_talloc);74 torture_suite_add_simple_test(suite, " REPLACE", torture_local_replace);81 torture_suite_add_simple_test(suite, "talloc", torture_local_talloc); 82 torture_suite_add_simple_test(suite, "replace", torture_local_replace); 75 83 76 84 torture_suite_add_simple_test(suite, 77 " CRYPTO-MD4", torture_local_crypto_md4);78 torture_suite_add_simple_test(suite, " CRYPTO-MD5",85 "crypto.md4", torture_local_crypto_md4); 86 torture_suite_add_simple_test(suite, "crypto.md5", 79 87 torture_local_crypto_md5); 80 torture_suite_add_simple_test(suite, " CRYPTO-HMACMD5",88 torture_suite_add_simple_test(suite, "crypto.hmacmd5", 81 89 torture_local_crypto_hmacmd5); 82 90 -
trunk/server/source4/torture/local/torture.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "torture/torture.h"24 23 #include "system/wait.h" 25 #include "lib/events/events.h"26 24 #include "libcli/raw/libcliraw.h" 27 25 #include "torture/util.h" … … 77 75 struct torture_suite *torture_local_torture(TALLOC_CTX *mem_ctx) 78 76 { 79 struct torture_suite *suite = torture_suite_create(mem_ctx, 80 "TORTURE"); 77 struct torture_suite *suite = torture_suite_create(mem_ctx, "torture"); 81 78 82 79 torture_suite_add_simple_test(suite, "tempdir", test_tempdir);
Note:
See TracChangeset
for help on using the changeset viewer.