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 +++++++++++-- tests/gb/bssgp_fc_tests.ok | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 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(); diff --git a/tests/gb/bssgp_fc_tests.ok b/tests/gb/bssgp_fc_tests.ok index fda96f30..f8fca3cf 100644 --- a/tests/gb/bssgp_fc_tests.ok +++ b/tests/gb/bssgp_fc_tests.ok @@ -3,34 +3,54 @@ size-max=100 oct, leak-rate=100 oct/s, queue-len=5 msgs, pdu_len=10 oct, pdu_cnt 0: FC IN Nr 1 0: FC OUT Nr 1 + -> 0: ok 0: FC IN Nr 2 0: FC OUT Nr 2 + -> 0: ok 0: FC IN Nr 3 0: FC OUT Nr 3 + -> 0: ok 0: FC IN Nr 4 0: FC OUT Nr 4 + -> 0: ok 0: FC IN Nr 5 0: FC OUT Nr 5 + -> 0: ok 0: FC IN Nr 6 0: FC OUT Nr 6 + -> 0: ok 0: FC IN Nr 7 0: FC OUT Nr 7 + -> 0: ok 0: FC IN Nr 8 0: FC OUT Nr 8 + -> 0: ok 0: FC IN Nr 9 0: FC OUT Nr 9 + -> 0: ok 0: FC IN Nr 10 0: FC OUT Nr 10 + -> 0: ok 0: FC IN Nr 11 + -> 0: ok 0: FC IN Nr 12 + -> 0: ok 0: FC IN Nr 13 + -> 0: ok 0: FC IN Nr 14 + -> 0: ok 0: FC IN Nr 15 + -> 0: ok 0: FC IN Nr 16 + -> -28: queue full, msg dropped. 0: FC IN Nr 17 + -> -28: queue full, msg dropped. 0: FC IN Nr 18 + -> -28: queue full, msg dropped. 0: FC IN Nr 19 + -> -28: queue full, msg dropped. 0: FC IN Nr 20 + -> -28: queue full, msg dropped. 10: FC OUT Nr 11 20: FC OUT Nr 12 30: FC OUT Nr 13 @@ -43,34 +63,54 @@ size-max=100 oct, leak-rate=100 oct/s, queue-len=100 msgs, pdu_len=10 oct, pdu_c 0: FC IN Nr 1 0: FC OUT Nr 1 + -> 0: ok 0: FC IN Nr 2 0: FC OUT Nr 2 + -> 0: ok 0: FC IN Nr 3 0: FC OUT Nr 3 + -> 0: ok 0: FC IN Nr 4 0: FC OUT Nr 4 + -> 0: ok 0: FC IN Nr 5 0: FC OUT Nr 5 + -> 0: ok 0: FC IN Nr 6 0: FC OUT Nr 6 + -> 0: ok 0: FC IN Nr 7 0: FC OUT Nr 7 + -> 0: ok 0: FC IN Nr 8 0: FC OUT Nr 8 + -> 0: ok 0: FC IN Nr 9 0: FC OUT Nr 9 + -> 0: ok 0: FC IN Nr 10 0: FC OUT Nr 10 + -> 0: ok 0: FC IN Nr 11 + -> 0: ok 0: FC IN Nr 12 + -> 0: ok 0: FC IN Nr 13 + -> 0: ok 0: FC IN Nr 14 + -> 0: ok 0: FC IN Nr 15 + -> 0: ok 0: FC IN Nr 16 + -> 0: ok 0: FC IN Nr 17 + -> 0: ok 0: FC IN Nr 18 + -> 0: ok 0: FC IN Nr 19 + -> 0: ok 0: FC IN Nr 20 + -> 0: ok 10: FC OUT Nr 11 20: FC OUT Nr 12 30: FC OUT Nr 13 @@ -87,25 +127,45 @@ size-max=100 oct, leak-rate=100 oct/s, queue-len=100 msgs, pdu_len=10 oct, pdu_c size-max=100 oct, leak-rate=100 oct/s, queue-len=5 msgs, pdu_len=1000 oct, pdu_cnt=20 0: FC IN Nr 1 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 2 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 3 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 4 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 5 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 6 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 7 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 8 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 9 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 10 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 11 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 12 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 13 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 14 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 15 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 16 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 17 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 18 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 19 + -> -5: PDU too large, msg dropped. 0: FC IN Nr 20 + -> -5: PDU too large, msg dropped. ===== BSSGP flow-control test END ===== BSSGP flow-control test START @@ -113,34 +173,54 @@ size-max=100 oct, leak-rate=100 oct/s, queue-len=5 msgs, pdu_len=10 oct, pdu_cnt 0: FC IN Nr 1 0: FC OUT Nr 1 + -> 0: ok 0: FC IN Nr 2 0: FC OUT Nr 2 + -> 0: ok 0: FC IN Nr 3 0: FC OUT Nr 3 + -> 0: ok 0: FC IN Nr 4 0: FC OUT Nr 4 + -> 0: ok 0: FC IN Nr 5 0: FC OUT Nr 5 + -> 0: ok 0: FC IN Nr 6 0: FC OUT Nr 6 + -> 0: ok 0: FC IN Nr 7 0: FC OUT Nr 7 + -> 0: ok 0: FC IN Nr 8 0: FC OUT Nr 8 + -> 0: ok 0: FC IN Nr 9 0: FC OUT Nr 9 + -> 0: ok 0: FC IN Nr 10 0: FC OUT Nr 10 + -> 0: ok 0: FC IN Nr 11 + -> 0: ok 0: FC IN Nr 12 + -> 0: ok 0: FC IN Nr 13 + -> 0: ok 0: FC IN Nr 14 + -> 0: ok 0: FC IN Nr 15 + -> 0: ok 0: FC IN Nr 16 + -> -28: queue full, msg dropped. 0: FC IN Nr 17 + -> -28: queue full, msg dropped. 0: FC IN Nr 18 + -> -28: queue full, msg dropped. 0: FC IN Nr 19 + -> -28: queue full, msg dropped. 0: FC IN Nr 20 + -> -28: queue full, msg dropped. 10: FC OUT Nr 11 20: FC OUT Nr 12 30: FC OUT Nr 13 -- cgit v1.2.3