- /* Second expand, add another zone of same size. */
- ok1(tdb_expand(tdb, 1) == 0);
- ok1(tdb->map_size == 3 * val + 1 + sizeof(struct tdb_header));
- ok1(tdb_check(tdb, NULL, NULL) == 0);
-
- /* Large expand, but can only add 4th zone of same size. */
- ok1(tdb_expand(tdb, 4*val) == 0);
- ok1(tdb->map_size == 4 * val + 1 + sizeof(struct tdb_header));
- ok1(tdb_check(tdb, NULL, NULL) == 0);
-
- /* Large expand now will double file. */
- ok1(tdb_expand(tdb, 4*val) == 0);
- ok1(tdb->map_size == 8 * val + 1 + sizeof(struct tdb_header));
- ok1(tdb_check(tdb, NULL, NULL) == 0);
-
- /* And again? */
- ok1(tdb_expand(tdb, 4*val) == 0);
- ok1(tdb->map_size == 16 * val + 1 + sizeof(struct tdb_header));
+ val = tdb->map_size;
+ ok1(tdb_lock_hashes(tdb, 0, 1, F_WRLCK, TDB_LOCK_WAIT) == 0);
+ ok1(tdb_expand(tdb, 1024) == 0);
+ ok1(tdb_unlock_hashes(tdb, 0, 1, F_WRLCK) == 0);
+ ok1(tdb->map_size >= val + 1024 * TDB_EXTENSION_FACTOR);