tdb2: test: fix run-57-die-during-transaction.c to be more efficient.
[ccan] / ccan / tdb2 / test / run-firstkey-nextkey.c
index b8a12bd38c8ae0bbb79a19855ac6c4f44834ec7c..1eb265ef926b4e87834c733c9bff8ddde77fd1ac 100644 (file)
@@ -1,11 +1,4 @@
-#include <ccan/tdb2/tdb.c>
-#include <ccan/tdb2/free.c>
-#include <ccan/tdb2/lock.c>
-#include <ccan/tdb2/io.c>
-#include <ccan/tdb2/hash.c>
-#include <ccan/tdb2/check.c>
-#include <ccan/tdb2/traverse.c>
-#include <ccan/tdb2/transaction.c>
+#include "tdb2-source.h"
 #include <ccan/tap/tap.h>
 #include "logging.h"
 
@@ -56,10 +49,14 @@ int main(int argc, char *argv[])
        struct tdb_context *tdb;
        union tdb_attribute seed_attr;
        enum TDB_ERROR ecode;
-
        int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
                        TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, 
-                       TDB_NOMMAP|TDB_CONVERT };
+                       TDB_NOMMAP|TDB_CONVERT,
+                       TDB_INTERNAL|TDB_VERSION1, TDB_VERSION1,
+                       TDB_NOMMAP|TDB_VERSION1,
+                       TDB_INTERNAL|TDB_CONVERT|TDB_VERSION1,
+                       TDB_CONVERT|TDB_VERSION1,
+                       TDB_NOMMAP|TDB_CONVERT|TDB_VERSION1 };
 
        seed_attr.base.attr = TDB_ATTRIBUTE_SEED;
        seed_attr.base.next = &tap_log_attr;
@@ -69,7 +66,8 @@ int main(int argc, char *argv[])
                   * (NUM_RECORDS*6 + (NUM_RECORDS-1)*3 + 22) + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
                tdb = tdb_open("run-traverse.tdb", flags[i],
-                              O_RDWR|O_CREAT|O_TRUNC, 0600, &seed_attr);
+                              O_RDWR|O_CREAT|O_TRUNC, 0600,
+                              flags[i] & TDB_VERSION1 ? NULL : &seed_attr);
                ok1(tdb);
                if (!tdb)
                        continue;