#include "../common/tdb_private.h"
-/* Speed up the tests: setting TDB_NOSYNC removed recovery altogether. */
+/* Speed up the tests, but do the actual sync tests. */
+static unsigned int sync_counts = 0;
static inline int fake_fsync(int fd)
{
+ sync_counts++;
return 0;
}
#define fsync fake_fsync
#ifdef MS_SYNC
static inline int fake_msync(void *addr, size_t length, int flags)
{
+ sync_counts++;
return 0;
}
#define msync fake_msync
#ifdef HAVE_FDATASYNC
static inline int fake_fdatasync(int fd)
{
+ sync_counts++;
return 0;
}
#define fdatasync fake_fdatasync
struct tdb_record rec;
tdb_off_t off;
- plan_tests(4);
+ /* Do *not* suppress sync for this test; we do it ourselves. */
+ unsetenv("TDB_NO_FSYNC");
+
+ plan_tests(5);
tdb = tdb_open_ex("run-transaction-expand.tdb",
1024, TDB_CLEAR_IF_FIRST,
O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL);
/* We should only be about 4 times larger than largest record. */
ok1(tdb->map_size < 5 * i * getpagesize());
+
+ /* We should have synchronized multiple times. */
+ ok1(sync_counts);
tdb_close(tdb);
free(data.dptr);