summaryrefslogtreecommitdiff
path: root/lib/tdb2/test
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:58:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:58:13 +0930
commit5d9dd8d541a761e0af2c8d50ee55485f2cef3e01 (patch)
tree292d92329072b4e5e4e091544ca499903bcba276 /lib/tdb2/test
parent014ca657e600ee2b3b4dc9d2ef482d050cd0917d (diff)
downloadsamba-5d9dd8d541a761e0af2c8d50ee55485f2cef3e01.tar.gz
samba-5d9dd8d541a761e0af2c8d50ee55485f2cef3e01.tar.bz2
samba-5d9dd8d541a761e0af2c8d50ee55485f2cef3e01.zip
tdb2: unify tdb1_transaction_start etc. into tdb_transaction_start.
Switch on the TDB_VERSION1 flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 6bc8ea012391198bc3898ae2937558b60dd55906)
Diffstat (limited to 'lib/tdb2/test')
-rw-r--r--lib/tdb2/test/run-tdb1-3G-file.c4
-rw-r--r--lib/tdb2/test/run-tdb1-die-during-transaction.c4
-rw-r--r--lib/tdb2/test/run-tdb1-nested-transactions.c26
-rw-r--r--lib/tdb2/test/run-tdb1-open-during-transaction.c4
-rw-r--r--lib/tdb2/test/run-tdb1-readonly-check.c2
-rw-r--r--lib/tdb2/test/run-tdb1-traverse-in-transaction.c4
-rw-r--r--lib/tdb2/test/tdb1-external-agent.c4
7 files changed, 24 insertions, 24 deletions
diff --git a/lib/tdb2/test/run-tdb1-3G-file.c b/lib/tdb2/test/run-tdb1-3G-file.c
index 074901857f..f3403dd1b8 100644
--- a/lib/tdb2/test/run-tdb1-3G-file.c
+++ b/lib/tdb2/test/run-tdb1-3G-file.c
@@ -109,14 +109,14 @@ int main(int argc, char *argv[])
ok1(tdb_traverse(tdb, test_traverse, NULL) == 0);
/* Transactions should work. */
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
ok1(tdb_store(tdb, key, orig_data, TDB_INSERT) == TDB_SUCCESS);
ok1(tdb_fetch(tdb, key, &data) == TDB_SUCCESS);
ok1(data.dsize == strlen("world"));
ok1(memcmp(data.dptr, "world", strlen("world")) == 0);
free(data.dptr);
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
ok1(tdb_traverse(tdb, test_traverse, &orig_data) == 1);
tdb_close(tdb);
diff --git a/lib/tdb2/test/run-tdb1-die-during-transaction.c b/lib/tdb2/test/run-tdb1-die-during-transaction.c
index f42513953a..f45fcedc7a 100644
--- a/lib/tdb2/test/run-tdb1-die-during-transaction.c
+++ b/lib/tdb2/test/run-tdb1-die-during-transaction.c
@@ -170,13 +170,13 @@ reset:
errx(1, "Agent failed find key: %s", agent_return_name1(ret));
in_transaction = true;
- if (tdb1_transaction_start(tdb) != 0)
+ if (tdb_transaction_start(tdb) != TDB_SUCCESS)
return false;
if (tdb_store(tdb, key, key, TDB_INSERT) != TDB_SUCCESS)
return false;
- if (tdb1_transaction_commit(tdb) != 0)
+ if (tdb_transaction_commit(tdb) != TDB_SUCCESS)
return false;
in_transaction = false;
diff --git a/lib/tdb2/test/run-tdb1-nested-transactions.c b/lib/tdb2/test/run-tdb1-nested-transactions.c
index 408987b58e..a6a815363c 100644
--- a/lib/tdb2/test/run-tdb1-nested-transactions.c
+++ b/lib/tdb2/test/run-tdb1-nested-transactions.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
hsize.base.next = &tap_log_attr;
hsize.tdb1_hashsize.hsize = 1024;
- plan_tests(30);
+ plan_tests(29);
key.dsize = strlen("hi");
key.dptr = (void *)"hi";
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
ok1(tdb);
/* No nesting by default. */
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
data.dptr = (void *)"world";
data.dsize = strlen("world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == TDB_SUCCESS);
@@ -32,14 +32,13 @@ int main(int argc, char *argv[])
ok1(data.dsize == strlen("world"));
ok1(memcmp(data.dptr, "world", strlen("world")) == 0);
free(data.dptr);
- ok1(tdb1_transaction_start(tdb) != 0);
- ok1(tdb_error(tdb) == TDB_ERR_EINVAL);
+ ok1(tdb_transaction_start(tdb) == TDB_ERR_EINVAL);
ok1(tdb_fetch(tdb, key, &data) == TDB_SUCCESS);
ok1(data.dsize == strlen("world"));
ok1(memcmp(data.dptr, "world", strlen("world")) == 0);
free(data.dptr);
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
ok1(tdb_fetch(tdb, key, &data) == TDB_SUCCESS);
ok1(data.dsize == strlen("world"));
ok1(memcmp(data.dptr, "world", strlen("world")) == 0);
@@ -50,21 +49,22 @@ int main(int argc, char *argv[])
TDB_ALLOW_NESTING, O_RDWR, 0, &tap_log_attr);
ok1(tdb);
- ok1(tdb1_transaction_start(tdb) == 0);
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
ok1(tdb_delete(tdb, key) == TDB_SUCCESS);
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
ok1(!tdb_exists(tdb, key));
- ok1(tdb1_transaction_cancel(tdb) == 0);
+ tdb_transaction_cancel(tdb);
+ ok1(tap_log_messages == 0);
/* Surprise! Kills inner "committed" transaction. */
ok1(tdb_exists(tdb, key));
- ok1(tdb1_transaction_start(tdb) == 0);
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
ok1(tdb_delete(tdb, key) == TDB_SUCCESS);
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
ok1(!tdb_exists(tdb, key));
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
ok1(!tdb_exists(tdb, key));
tdb_close(tdb);
diff --git a/lib/tdb2/test/run-tdb1-open-during-transaction.c b/lib/tdb2/test/run-tdb1-open-during-transaction.c
index 879d790647..d03f7d95a0 100644
--- a/lib/tdb2/test/run-tdb1-open-during-transaction.c
+++ b/lib/tdb2/test/run-tdb1-open-during-transaction.c
@@ -156,14 +156,14 @@ int main(int argc, char *argv[])
ok1(tdb);
opened = true;
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
key.dsize = strlen("hi");
key.dptr = (void *)"hi";
data.dptr = (void *)"world";
data.dsize = strlen("world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == TDB_SUCCESS);
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
ok(!errors, "We had %u open errors", errors);
opened = false;
diff --git a/lib/tdb2/test/run-tdb1-readonly-check.c b/lib/tdb2/test/run-tdb1-readonly-check.c
index 6e1b57323c..471f813da2 100644
--- a/lib/tdb2/test/run-tdb1-readonly-check.c
+++ b/lib/tdb2/test/run-tdb1-readonly-check.c
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
ok1(tdb1_check(tdb, NULL, NULL) == 0);
/* We are also allowed to do a check inside a transaction. */
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
ok1(tdb1_check(tdb, NULL, NULL) == 0);
ok1(tdb_close(tdb) == 0);
diff --git a/lib/tdb2/test/run-tdb1-traverse-in-transaction.c b/lib/tdb2/test/run-tdb1-traverse-in-transaction.c
index c4fd89dfe4..691aaf9444 100644
--- a/lib/tdb2/test/run-tdb1-traverse-in-transaction.c
+++ b/lib/tdb2/test/run-tdb1-traverse-in-transaction.c
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
ok1(external_agent_operation1(agent, OPEN, tdb->name) == SUCCESS);
- ok1(tdb1_transaction_start(tdb) == 0);
+ ok1(tdb_transaction_start(tdb) == TDB_SUCCESS);
ok1(external_agent_operation1(agent, TRANSACTION_START, tdb->name)
== WOULD_HAVE_BLOCKED);
tdb_traverse(tdb, traverse, NULL);
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
/* That should *not* release the transaction lock! */
ok1(external_agent_operation1(agent, TRANSACTION_START, tdb->name)
== WOULD_HAVE_BLOCKED);
- ok1(tdb1_transaction_commit(tdb) == 0);
+ ok1(tdb_transaction_commit(tdb) == TDB_SUCCESS);
/* Now we should be fine. */
ok1(external_agent_operation1(agent, TRANSACTION_START, tdb->name)
== SUCCESS);
diff --git a/lib/tdb2/test/tdb1-external-agent.c b/lib/tdb2/test/tdb1-external-agent.c
index 6f80b1933c..6b6f87dea5 100644
--- a/lib/tdb2/test/tdb1-external-agent.c
+++ b/lib/tdb2/test/tdb1-external-agent.c
@@ -48,7 +48,7 @@ static enum agent_return do_operation(enum operation op, const char *name)
ret = SUCCESS;
break;
case TRANSACTION_START:
- ret = tdb1_transaction_start(tdb) == 0 ? SUCCESS : OTHER_FAILURE;
+ ret = tdb_transaction_start(tdb) == TDB_SUCCESS ? SUCCESS : OTHER_FAILURE;
break;
case FETCH:
if (tdb_fetch(tdb, k, &data) != TDB_SUCCESS) {
@@ -71,7 +71,7 @@ static enum agent_return do_operation(enum operation op, const char *name)
ret = OTHER_FAILURE;
break;
case TRANSACTION_COMMIT:
- ret = tdb1_transaction_commit(tdb)==0 ? SUCCESS : OTHER_FAILURE;
+ ret = tdb_transaction_commit(tdb) == TDB_SUCCESS ? SUCCESS : OTHER_FAILURE;
break;
case CHECK:
ret = tdb1_check(tdb, NULL, NULL) == 0 ? SUCCESS : OTHER_FAILURE;