coverage: fix injection in test_fellow_cache_obj_iter_fina()

parent 2b958cf2
......@@ -5552,18 +5552,15 @@ static void test_fellow_cache_obj_iter_final(
VSHA256_Final(h2, &sha256ctx);
AZ(memcmp(h1, h2, sizeof *h1));
injcount = fc_inj_count();
DBG("injcount %d", injcount);
if (injcount == 0)
return;
fcsc_init(&c, &(*fcop)->seglist);
if ((fcs = FCSC_NEXT(&c)) != NULL) {
while (fcs->state == FCS_READING || fcs->state == FCS_WRITING)
usleep(100);
assert(fcs->state == FCS_INCORE);
AZ(fcs->refcnt);
AN(fcs->fcs_onlru);
if (fcs->state != FCS_DISK) {
assert(fcs->state == FCS_INCORE);
AZ(fcs->refcnt);
AN(fcs->fcs_onlru);
}
} else
WRONG("no seg");
fellow_cache_obj_slim(fc, *fcop);
......@@ -5575,8 +5572,13 @@ static void test_fellow_cache_obj_iter_final(
(void) fellow_cache_obj_deref(fc, *fcop);
*fcop = NULL;
fc_inj_reset();
injcount = -1;
AN(injcount);
while (injcount) {
DBG("injcount %d", injcount);
fc_inj_set(0);
toc = ocmem;
fcr = fellow_cache_obj_get(fc, &toc, priv2, 0);
assert(fcr.status == fcr_ok);
......@@ -5586,9 +5588,12 @@ static void test_fellow_cache_obj_iter_final(
VSHA256_Init(&sha256ctx);
fcr = fellow_cache_obj_iter(fc, fco, &sha256ctx,
iter_sha256, 0);
assert (fcr.status != fcr_ok);
DBG("inj %d err %s", injcount, fcr.r.err);
injcount--;
if (fcr.status == fcr_ok) {
assert(injcount == -1);
injcount = fc_inj_count();
} else
injcount--;
assert(FCO_REFCNT(fco) == 1);
fellow_cache_obj_deref(fc, fco);
......
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