/* We save the locks so we can reaquire them. */
+#include "../common/tdb_private.h"
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
#include "tap-interface.h"
-#include "../common/tdb_private.h"
#include "lock-tracking.h"
struct lock {
ok1(tdb);
tdb->methods = &large_io_methods;
- /* Enlarge the file (internally multiplies by 100). */
- ok1(tdb_expand(tdb, 30000000) == 0);
+ /* Enlarge the file (internally multiplies by 2). */
+ ok1(tdb_expand(tdb, 1500000000) == 0);
/* Put an entry in, and check it. */
key.dsize = strlen("hi");
key.dptr = (void *)"hi";
tdb = tdb_open_ex("run-nested-transactions.tdb",
- 1024, TDB_CLEAR_IF_FIRST,
+ 1024, TDB_CLEAR_IF_FIRST|TDB_DISALLOW_NESTING,
O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL);
ok1(tdb);
- /* No nesting by default. */
+ /* Nesting disallowed. */
ok1(tdb_transaction_start(tdb) == 0);
data.dptr = (void *)"world";
data.dsize = strlen("world");
free(data.dptr);
tdb_close(tdb);
+ /* Nesting allowed by default */
tdb = tdb_open_ex("run-nested-transactions.tdb",
- 1024, TDB_ALLOW_NESTING, O_RDWR, 0, &taplogctx, NULL);
+ 1024, TDB_DEFAULT, O_RDWR, 0, &taplogctx, NULL);
ok1(tdb);
ok1(tdb_transaction_start(tdb) == 0);
-#define _XOPEN_SOURCE 500
-#include <unistd.h>
+#include "../common/tdb_private.h"
#include "lock-tracking.h"
static ssize_t pwrite_check(int fd, const void *buf, size_t count, off_t offset);
#define fcntl fcntl_with_lockcheck
#define ftruncate ftruncate_check
-#include "../common/tdb_private.h"
#include "../common/io.c"
#include "../common/tdb.c"
#include "../common/lock.c"
-/* We need this otherwise fcntl locking fails. */
-#define _FILE_OFFSET_BITS 64
-#define _XOPEN_SOURCE 500
#include "../common/tdb_private.h"
/* Speed up the tests: setting TDB_NOSYNC removed recovery altogether. */
#define msync fake_msync
#endif
-#include "../common/tdb_private.h"
+#ifdef HAVE_FDATASYNC
+static inline int fake_fdatasync(int fd)
+{
+ return 0;
+}
+#define fdatasync fake_fdatasync
+#endif
+
#include "../common/io.c"
#include "../common/tdb.c"
#include "../common/lock.c"