- /* We don't want the hash to expand, so we use one alloc to
- * chew up over 90% of the space first. */
- j = -1;
- d.dsize = (1 << INITIAL_ZONE_BITS) * 9 / 10;
- d.dptr = malloc(d.dsize);
- ok1(tdb_store(tdb, k, d, TDB_INSERT) == 0);
- ok1(tdb->map_size == sizeof(struct tdb_header)
- + (1 << INITIAL_ZONE_BITS)+1);
+ ok1(empty_freetable(tdb));
+ /* Need some hash lock for expand. */
+ ok1(tdb_lock_hashes(tdb, 0, 1, F_WRLCK, TDB_LOCK_WAIT) == 0);
+ /* Create some free space. */
+ ok1(tdb_expand(tdb, 1) == 0);
+ ok1(tdb_unlock_hashes(tdb, 0, 1, F_WRLCK) == 0);
+ ok1(tdb_check(tdb, NULL, NULL) == 0);
+ ok1(!empty_freetable(tdb));