[PATCH] libosmocore[master]: bssgp_fc_test: clarify by outputting ok / failure messages

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Nov 17 00:27:52 UTC 2017


Review at  https://gerrit.osmocom.org/4870

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
---
M tests/gb/bssgp_fc_test.c
M tests/gb/bssgp_fc_tests.ok
2 files changed, 99 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/70/4870/1

diff --git a/tests/gb/bssgp_fc_test.c b/tests/gb/bssgp_fc_test.c
index 4719872..6e4f747 100644
--- a/tests/gb/bssgp_fc_test.c
+++ b/tests/gb/bssgp_fc_test.c
@@ -39,17 +39,31 @@
 	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 @@
 
 	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 fda96f3..f8fca3c 100644
--- a/tests/gb/bssgp_fc_tests.ok
+++ b/tests/gb/bssgp_fc_tests.ok
@@ -3,34 +3,54 @@
 
 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 @@
 
 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=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 @@
 
 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

-- 
To view, visit https://gerrit.osmocom.org/4870
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57d6fce2515a65f6dd037e75af5397079215cb46
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list