From bd847cd71b48f25a98c8f8e2ac0f02d1fcc509bc Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 24 May 2013 13:12:14 +0200 Subject: tests: osmux_test: exercise osmux_replay_lost_packets Emulate RTP message loss to test osmux_replay_lost_packets code in src/osmux.c. After this test, lcov reports 90.3% line coverage of osmux.c --- tests/osmux/osmux_test.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/osmux/osmux_test.c') diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c index 4036f2d..44620cd 100644 --- a/tests/osmux/osmux_test.c +++ b/tests/osmux/osmux_test.c @@ -118,7 +118,7 @@ int main(void) char buf[1024]; struct rtp_hdr *rtph = (struct rtp_hdr *)rtp_pkt; uint16_t seq; - int i, j; + int i, j, k = 0; if (signal(SIGALRM, sigalarm_handler) == SIG_ERR) { perror("signal"); @@ -151,7 +151,13 @@ int main(void) fprintf(stderr, "adding %s\n", buf); rtp_pkts++; + /* Intentionally skip RTP message to test replay RTP */ + if (i % 3 == 0) + continue; + + k++; osmux_xfrm_input(&h_input, msg, 0); + if (i % 4 == 0) { gettimeofday(&last, NULL); @@ -164,8 +170,10 @@ int main(void) * wait until the three RTP messages that are extracted * from OSMUX has been delivered. */ - for (j=0; j<3; j++) + for (j=0; j