coverage: fix injection in test_fellow_cache_obj_iter_fina()

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