summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-10-02 15:44:41 +0200
committerVolker Lendecke <vl@samba.org>2012-10-06 17:16:39 +0200
commit9fc42daf75d0eee9fd22e66a3eeb687b178e29e3 (patch)
tree0871f881284a287867553a1c26350c4b0cee5dc4 /source3/torture
parentc62f8baff878001ead921112dd653ff69d1cfe7d (diff)
downloadsamba-9fc42daf75d0eee9fd22e66a3eeb687b178e29e3.tar.gz
samba-9fc42daf75d0eee9fd22e66a3eeb687b178e29e3.tar.bz2
samba-9fc42daf75d0eee9fd22e66a3eeb687b178e29e3.zip
s3: Add two tests a CLEAR_IF_FIRST crash
Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sat Oct 6 17:16:39 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 525484719b..0cca680f6b 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -8882,6 +8882,60 @@ static bool run_local_remove_duplicate_addrs2(int dummy)
return true;
}
+static bool run_local_tdb_opener(int dummy)
+{
+ TDB_CONTEXT *t;
+ unsigned v = 0;
+
+ while (1) {
+ t = tdb_open("test.tdb", 1000, TDB_CLEAR_IF_FIRST,
+ O_RDWR|O_CREAT, 0755);
+ if (t == NULL) {
+ perror("tdb_open failed");
+ return false;
+ }
+ tdb_close(t);
+
+ v += 1;
+ printf("\r%u", v);
+ }
+ return true;
+}
+
+static bool run_local_tdb_writer(int dummy)
+{
+ TDB_CONTEXT *t;
+ unsigned v = 0;
+ TDB_DATA val;
+
+ t = tdb_open("test.tdb", 1000, 0, O_RDWR|O_CREAT, 0755);
+ if (t == 0) {
+ perror("tdb_open failed");
+ return 1;
+ }
+
+ val.dptr = (uint8_t *)&v;
+ val.dsize = sizeof(v);
+
+ while (1) {
+ TDB_DATA data;
+ int ret;
+
+ ret = tdb_store(t, val, val, 0);
+ if (ret != 0) {
+ printf("%s\n", tdb_errorstr(t));
+ }
+ v += 1;
+ printf("\r%u", v);
+
+ data = tdb_fetch(t, val);
+ if (data.dptr != NULL) {
+ SAFE_FREE(data.dptr);
+ }
+ }
+ return true;
+}
+
static double create_procs(bool (*fn)(int), bool *result)
{
int i, status;
@@ -9094,6 +9148,8 @@ static struct {
{ "LOCAL-hex_encode_buf", run_local_hex_encode_buf, 0},
{ "LOCAL-IDMAP-TDB-COMMON", run_idmap_tdb_common_test, 0},
{ "LOCAL-remove_duplicate_addrs2", run_local_remove_duplicate_addrs2, 0},
+ { "local-tdb-opener", run_local_tdb_opener, 0 },
+ { "local-tdb-writer", run_local_tdb_writer, 0 },
{NULL, NULL, 0}};