Attention is currently required from: neels.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35306?usp=email )
Change subject: sdp: allow more space for fmtp
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35306?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ib9b9608d8d8f7ce34596a950dbc480e8a72ebf97
Gerrit-Change-Number: 35306
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Sun, 10 Dec 2023 11:21:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35292?usp=email )
Change subject: tests/soft_uart: assert that osmo_soft_uart_rx_ubits() returns 0
......................................................................
tests/soft_uart: assert that osmo_soft_uart_rx_ubits() returns 0
According to Coverity, we check return value of this function in
all other cases except this one (9 out of 10 times), so let's add
the missing assert(), just to be sure.
Change-Id: I675f4089cc990be5fcda792276b6808742f6f0d7
Fixes: CID#336557
---
M tests/soft_uart/soft_uart_test.c
1 file changed, 17 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/tests/soft_uart/soft_uart_test.c b/tests/soft_uart/soft_uart_test.c
index 0e84d5a..9ca9bd9 100644
--- a/tests/soft_uart/soft_uart_test.c
+++ b/tests/soft_uart/soft_uart_test.c
@@ -68,12 +68,14 @@
{
for (unsigned int i = 0; input[i] != '\0'; i++) {
ubit_t ubit;
+ int rc;
switch (input[i]) {
case '0':
case '1':
ubit = input[i] - '0';
- osmo_soft_uart_rx_ubits(suart, &ubit, 1);
+ rc = osmo_soft_uart_rx_ubits(suart, &ubit, 1);
+ OSMO_ASSERT(rc == 0); /* 0 on success */
break;
case 'F':
printf("%s() @ %u: flush the Rx buffer\n", __func__, i);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35292?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I675f4089cc990be5fcda792276b6808742f6f0d7
Gerrit-Change-Number: 35292
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35296?usp=email )
Change subject: tests/soft_uart: cosmetic: improve readability of the test output
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35296?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icf5410f0b292d41532e0cbd17e6ca0509c76cbd5
Gerrit-Change-Number: 35296
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sun, 10 Dec 2023 11:20:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35295?usp=email )
Change subject: soft_uart: cosmetic: use consistent naming for the Rx buffer msgb
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35295?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id637a39bab8ecd04bca5580bb48f965b501f5b2e
Gerrit-Change-Number: 35295
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Sun, 10 Dec 2023 11:19:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35294?usp=email )
Change subject: core: fix wrong logic in _osmo_it_q_dequeue()
......................................................................
core: fix wrong logic in _osmo_it_q_dequeue()
If the given queue is empty, queue->list.next points to &queue->list.
Current implementation would call llist_del() on the queue's llist_head,
decrement queue->current_length (which will be 0), and return a pointer
to &queue->list to the caller. This is completely wrong.
- Use the existing item_dequeue(), which does exactly what we need.
- Do not decrement the current_length if nothing was dequeued.
- Uncomment code in the unit test, we should not crash anymore.
Change-Id: I63094df73b166b549616c869ad908e9f4f7d46d1
Fixes: CID#336557
---
M src/core/it_q.c
M tests/it_q/it_q_test.c
M tests/it_q/it_q_test.ok
3 files changed, 25 insertions(+), 11 deletions(-)
Approvals:
jolly: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/core/it_q.c b/src/core/it_q.c
index a3ff420..810dc90 100644
--- a/src/core/it_q.c
+++ b/src/core/it_q.c
@@ -245,7 +245,7 @@
/*! Thread-safe de-queue from an inter-thread message queue.
* \param[in] queue Inter-thread queue from which to dequeue
- * \returns dequeued message buffer; NULL if none available
+ * \returns llist_head of dequeued message; NULL if none available
*/
struct llist_head *_osmo_it_q_dequeue(struct osmo_it_q *queue)
{
@@ -254,12 +254,9 @@
pthread_mutex_lock(&queue->mutex);
- if (llist_empty(&queue->list))
- l = NULL;
- l = queue->list.next;
- OSMO_ASSERT(l);
- llist_del(l);
- queue->current_length--;
+ l = item_dequeue(&queue->list);
+ if (l != NULL)
+ queue->current_length--;
pthread_mutex_unlock(&queue->mutex);
diff --git a/tests/it_q/it_q_test.c b/tests/it_q/it_q_test.c
index 9545183..6025e39 100644
--- a/tests/it_q/it_q_test.c
+++ b/tests/it_q/it_q_test.c
@@ -81,11 +81,9 @@
q1 = osmo_it_q_alloc(OTC_GLOBAL, "q1", 12, NULL, NULL);
OSMO_ASSERT(q1);
-#if 0
printf("try dequeueing from an empty queue\n");
osmo_it_q_dequeue(q1, &item, list);
OSMO_ASSERT(item == NULL);
-#endif
printf("adding queue entries up to the limit\n");
for (unsigned int i = 0; i < qlen; i++) {
@@ -101,11 +99,9 @@
talloc_free(item);
}
-#if 0
printf("try dequeueing from an empty queue\n");
osmo_it_q_dequeue(q1, &item, list);
OSMO_ASSERT(item == NULL);
-#endif
osmo_it_q_destroy(q1);
}
diff --git a/tests/it_q/it_q_test.ok b/tests/it_q/it_q_test.ok
index 91ba0ce..e89b78d 100644
--- a/tests/it_q/it_q_test.ok
+++ b/tests/it_q/it_q_test.ok
@@ -11,8 +11,10 @@
== Entering test case tc_enqueue_dequeue
allocating q1
+try dequeueing from an empty queue
adding queue entries up to the limit
removing queue entries up to the limit
+try dequeueing from an empty queue
== Entering test case tc_eventfd
allocating q1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35294?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I63094df73b166b549616c869ad908e9f4f7d46d1
Gerrit-Change-Number: 35294
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35293?usp=email )
Change subject: tests/it_q: add tc_enqueue/dequeue testcase
......................................................................
tests/it_q: add tc_enqueue/dequeue testcase
This patch is adding a simple testcase, which does the following:
* enqueue up to the limit (12 items),
* dequeue up to the limit (12 items).
Everything works as expected, unless you attempt to dequeue from
an empty queue: the test binary segfaults. The problem is explained
and fixed in a subsequent patch.
Change-Id: Ie0edbf00e656fbe231952bdbccfd37d143e8b2b1
Related: CID#336557
---
M tests/it_q/it_q_test.c
M tests/it_q/it_q_test.ok
2 files changed, 67 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/tests/it_q/it_q_test.c b/tests/it_q/it_q_test.c
index 28e32d8..9545183 100644
--- a/tests/it_q/it_q_test.c
+++ b/tests/it_q/it_q_test.c
@@ -68,6 +68,48 @@
osmo_it_q_destroy(q1);
}
+static void tc_enqueue_dequeue(void)
+{
+ const unsigned int qlen = 12;
+ struct it_q_test1 *item;
+ struct osmo_it_q *q1;
+ int rc;
+
+ ENTER_TC;
+
+ printf("allocating q1\n");
+ q1 = osmo_it_q_alloc(OTC_GLOBAL, "q1", 12, NULL, NULL);
+ OSMO_ASSERT(q1);
+
+#if 0
+ printf("try dequeueing from an empty queue\n");
+ osmo_it_q_dequeue(q1, &item, list);
+ OSMO_ASSERT(item == NULL);
+#endif
+
+ printf("adding queue entries up to the limit\n");
+ for (unsigned int i = 0; i < qlen; i++) {
+ item = talloc_zero(OTC_GLOBAL, struct it_q_test1);
+ rc = osmo_it_q_enqueue(q1, item, list);
+ OSMO_ASSERT(rc == 0);
+ }
+
+ printf("removing queue entries up to the limit\n");
+ for (unsigned int i = 0; i < qlen; i++) {
+ osmo_it_q_dequeue(q1, &item, list);
+ OSMO_ASSERT(item != NULL);
+ talloc_free(item);
+ }
+
+#if 0
+ printf("try dequeueing from an empty queue\n");
+ osmo_it_q_dequeue(q1, &item, list);
+ OSMO_ASSERT(item == NULL);
+#endif
+
+ osmo_it_q_destroy(q1);
+}
+
static int g_read_cb_count;
static void q_read_cb(struct osmo_it_q *q, struct llist_head *item)
@@ -115,6 +157,7 @@
{
tc_alloc();
tc_queue_length();
+ tc_enqueue_dequeue();
tc_eventfd();
return 0;
}
diff --git a/tests/it_q/it_q_test.ok b/tests/it_q/it_q_test.ok
index 7f102c6..91ba0ce 100644
--- a/tests/it_q/it_q_test.ok
+++ b/tests/it_q/it_q_test.ok
@@ -9,6 +9,11 @@
adding queue entries up to the limit
attempting to add more than the limit
+== Entering test case tc_enqueue_dequeue
+allocating q1
+adding queue entries up to the limit
+removing queue entries up to the limit
+
== Entering test case tc_eventfd
allocating q1
adding 30 queue entries up to the limit
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35293?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie0edbf00e656fbe231952bdbccfd37d143e8b2b1
Gerrit-Change-Number: 35293
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged