Skip to content

Commit

Permalink
test: call - add cancel_rules_debug()
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Oct 13, 2023
1 parent eae3332 commit 02f4fb4
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,49 @@ static struct cancel_rule *cancel_rule_add_and(struct cancel_rule *cr,
}


static int cancel_rule_debug(struct re_printf *pf,
const struct cancel_rule *cr)
{
int err;
if (!cr)
return 0;

err = re_hprintf(pf, "--- %s ---\n", uag_event_str(cr->ev));
err |= re_hprintf(pf, " prm: %s\n", cr->prm);
err |= re_hprintf(pf, " ua: %s\n", account_aor(ua_account(cr->ua)));
err |= re_hprintf(pf, " n_incoming: %u\n", cr->n_incoming);
err |= re_hprintf(pf, " n_progress: %u\n", cr->n_progress);
err |= re_hprintf(pf, " n_established: %u\n", cr->n_established);
err |= re_hprintf(pf, " n_audio_estab: %u\n", cr->n_audio_estab);
err |= re_hprintf(pf, " n_video_estab: %u\n", cr->n_video_estab);
err |= re_hprintf(pf, " n_offer_cnt: %u\n", cr->n_offer_cnt);
err |= re_hprintf(pf, " n_answer_cnt: %u\n", cr->n_answer_cnt);
err |= re_hprintf(pf, " n_vidframe: %u\n", cr->n_vidframe);
err |= re_hprintf(pf, " met: %s\n", cr->met ? "yes": "no");
if (err)
return err;

if (cr->cr_and) {
err |= re_hprintf(pf, " AND -->\n");
err |= cancel_rule_debug(pf, cr->cr_and);
}

return err;
}


static void cancel_rules_debug(struct fixture *f)
{
struct le *le;

LIST_FOREACH(&f->rules, le) {
struct cancel_rule *cr = le->data;

re_printf("%H", cancel_rule_debug, cr);
}
}


static void cancel_rule_reset(struct cancel_rule *cr)
{
cr->met = false;
Expand Down Expand Up @@ -1310,6 +1353,9 @@ int test_call_100rel_video(void)
ASSERT_TRUE(fix.a.n_vidframe >= 3);
ASSERT_TRUE(fix.b.n_vidframe >= 3);
out:
if (err)
cancel_rules_debug(f);

fixture_close(f);
mem_deref(vidisp);
module_unload("fakevideo");
Expand Down

0 comments on commit 02f4fb4

Please sign in to comment.