Test reaching objsize_max under simulated memory pressure

Tests #22
parent 871f2565
......@@ -2148,6 +2148,9 @@ fellow_busy_region_alloc(struct fellow_busy *fbo, size_t size, int8_t cram)
assert(fbo->nregion < FCO_MAX_REGIONS);
fdr = &fbo->region[fbo->nregion];
if (cram)
FC_INJ_SZLIM(size);
*fdr = FC_INJ ? buddy_off_extent_nil :
fellow_region_alloc(fc->ffd, FEP_SPC, size, cram);
......@@ -5662,6 +5665,29 @@ t_cache(unsigned chksum)
test_bocdone(fbo, TRUST_ME(hash), 1);
fellow_cache_obj_deref(fc, fco);
// === hit objsize_max under memory pressure
fbo = fellow_busy_obj_alloc(fc, &fco, &priv2, 1234).r.ptr;
CHECK_OBJ_NOTNULL(fbo, FELLOW_BUSY_MAGIC);
do {
char *ptr;
if (fbo->nregion < FCO_MAX_REGIONS - FCO_REGIONS_RESERVE)
FC_INJ_SZLIM_SET(4096);
sz = 1234;
fcr = fellow_busy_obj_getspace(fbo, &sz, (uint8_t **)&ptr);
if (fcr.status == fcr_ok) {
fellow_busy_obj_extend(fbo, sz);
continue;
}
assert(fcr.status == fcr_allocerr);
AZ(strcmp(fcr.r.err, "objsize_max reached"));
} while (fcr.status == fcr_ok);
fellow_busy_obj_trimstore(fbo);
test_bocdone(fbo, TRUST_ME(hash), 1);
fellow_cache_obj_deref(fc, fco);
test_fellow_cache_unbusy_inject(fc);
// === alloc, then evict
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment