diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-16 22:55:02 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2017-11-20 17:22:42 +0100 |
commit | 9541a683780d23b260c5c0f6b9a9572a7ac16a66 (patch) | |
tree | 91c0938a6ddbe4050d8e9717499f686f36cdb568 /tests/gb/bssgp_fc_test.c | |
parent | 568f8e20175a21da4e4537a2f5a4f7fedec8c6d6 (diff) |
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
Diffstat (limited to 'tests/gb/bssgp_fc_test.c')
-rw-r--r-- | tests/gb/bssgp_fc_test.c | 22 |
1 files changed, 19 insertions, 3 deletions
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(); |