aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2013-05-24 13:12:14 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2013-05-24 13:12:14 +0200
commitbd847cd71b48f25a98c8f8e2ac0f02d1fcc509bc (patch)
tree020cb8a97084883d3dd29928ee9718462743f227 /tests
parent390872055d5b306b55974918ee35ae5c902d7905 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/osmux/osmux_test.c12
1 files changed, 10 insertions, 2 deletions
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<k; j++)
osmo_select_main(0);
+
+ k = 0;
}
}
fprintf(stdout, "OK: Test passed\n");