From 9541a683780d23b260c5c0f6b9a9572a7ac16a66 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 16 Nov 2017 22:55:02 +0100 Subject: bssgp_fc_test: clarify by outputting ok / failure messages The test fills up the queue / sends too large PDUs on purpose. Make that obvious by outputting returned errors in the expected output. Cosmetic: - fc_in()'s return value is ignored, hence don't return anything. - add comment. Change-Id: I57d6fce2515a65f6dd037e75af5397079215cb46 --- tests/gb/bssgp_fc_test.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'tests/gb/bssgp_fc_test.c') diff --git a/tests/gb/bssgp_fc_test.c b/tests/gb/bssgp_fc_test.c index 47198726..6e4f747b 100644 --- a/tests/gb/bssgp_fc_test.c +++ b/tests/gb/bssgp_fc_test.c @@ -39,17 +39,31 @@ static int fc_out_cb(struct bssgp_flow_control *fc, struct msgb *msg, return 0; } -static int fc_in(struct bssgp_flow_control *fc, unsigned int pdu_len) +static void fc_in(struct bssgp_flow_control *fc, unsigned int pdu_len) { struct msgb *msg; unsigned int csecs = get_centisec_diff(); + int rc; msg = msgb_alloc(1, "fc test"); msg->cb[0] = in_ctr++; printf("%u: FC IN Nr %lu\n", csecs, msg->cb[0]); - bssgp_fc_in(fc, msg, pdu_len, NULL); - return 0; + rc = bssgp_fc_in(fc, msg, pdu_len, NULL); + switch (rc) { + case 0: + printf(" -> %d: ok\n", rc); + break; + case -ENOSPC: + printf(" -> %d: queue full, msg dropped.\n", rc); + break; + case -EIO: + printf(" -> %d: PDU too large, msg dropped.\n", rc); + break; + default: + printf(" -> %d: error, msg dropped.\n", rc); + break; + } } @@ -71,6 +85,8 @@ static void test_fc(uint32_t bucket_size_max, uint32_t bucket_leak_rate, osmo_gettimeofday(&tv_start, NULL); + /* Fill the queue with PDUs, possibly beyond the queue being full. If it is full, additional PDUs + * are discarded. */ for (i = 0; i < pdu_count; i++) { fc_in(fc, pdu_len); osmo_timers_check(); -- cgit v1.2.3