1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

s3:torture: add traverse testing to LOCAL-RBTREE

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11375
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11394

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Nov 27 13:16:59 CET 2015 on sn-devel-104

(cherry picked from commit bb9f13ab4165f150e01a88ddcc51605a7c176f5d)
This commit is contained in:
Stefan Metzmacher 2015-11-25 00:13:17 +01:00 committed by Karolin Seeger
parent 49f04d1924
commit 97d39ca80e

View File

@ -8348,11 +8348,29 @@ static bool rbt_testval(struct db_context *db, const char *key,
return ret;
}
static int local_rbtree_traverse_read(struct db_record *rec, void *private_data)
{
int *count2 = (int *)private_data;
(*count2)++;
return 0;
}
static int local_rbtree_traverse_delete(struct db_record *rec, void *private_data)
{
int *count2 = (int *)private_data;
(*count2)++;
dbwrap_record_delete(rec);
return 0;
}
static bool run_local_rbtree(int dummy)
{
struct db_context *db;
bool ret = false;
int i;
NTSTATUS status;
int count = 0;
int count2 = 0;
db = db_open_rbt(NULL);
@ -8395,6 +8413,27 @@ static bool run_local_rbtree(int dummy)
}
ret = true;
count = 0; count2 = 0;
status = dbwrap_traverse_read(db, local_rbtree_traverse_read,
&count2, &count);
printf("%s: read1: %d %d, %s\n", __func__, count, count2, nt_errstr(status));
if ((count != count2) || (count != 1000)) {
ret = false;
}
count = 0; count2 = 0;
status = dbwrap_traverse(db, local_rbtree_traverse_delete,
&count2, &count);
printf("%s: delete: %d %d, %s\n", __func__, count, count2, nt_errstr(status));
if ((count != count2) || (count != 1000)) {
ret = false;
}
count = 0; count2 = 0;
status = dbwrap_traverse_read(db, local_rbtree_traverse_read,
&count2, &count);
printf("%s: read2: %d %d, %s\n", __func__, count, count2, nt_errstr(status));
if ((count != count2) || (count != 0)) {
ret = false;
}
done:
TALLOC_FREE(db);