diff mbox series

qmi unit: Ignore QRTR control packets

Message ID 20240408194605.11666-1-steve.schrock@getcruise.com (mailing list archive)
State Accepted
Commit 6d4a89bbf07cf13d70009955ac613754259c754c
Headers show
Series qmi unit: Ignore QRTR control packets | expand

Commit Message

Steve Schrock April 8, 2024, 7:46 p.m. UTC
Sometimes the test server will receive a QRTR_TYPE_DEL_CLIENT control
packet which is broadcast when the prior test client is destroyed. It
is entirely schdeduler-dependent as to whether this broadcast will
occur before or after the subsequent test's servers are created. If
the test server receives a control packet, then test_send_data will
fail. There is no need for the tests to be aware of any control
packets at this time so it should simply ignore them.

Fixes: 728db12daa68 ("qmi: Add unit test for QRTR qmi_service_send")
---
 unit/test-qmimodem-qmi.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

patchwork-bot+ofono@kernel.org April 8, 2024, 10:40 p.m. UTC | #1
Hello:

This patch was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Mon,  8 Apr 2024 19:46:05 +0000 you wrote:
> Sometimes the test server will receive a QRTR_TYPE_DEL_CLIENT control
> packet which is broadcast when the prior test client is destroyed. It
> is entirely schdeduler-dependent as to whether this broadcast will
> occur before or after the subsequent test's servers are created. If
> the test server receives a control packet, then test_send_data will
> fail. There is no need for the tests to be aware of any control
> packets at this time so it should simply ignore them.
> 
> [...]

Here is the summary with links:
  - qmi unit: Ignore QRTR control packets
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=6d4a89bbf07c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/unit/test-qmimodem-qmi.c b/unit/test-qmimodem-qmi.c
index 3c5418be2e60..d04f50041c51 100644
--- a/unit/test-qmimodem-qmi.c
+++ b/unit/test-qmimodem-qmi.c
@@ -269,6 +269,11 @@  static bool received_data(struct l_io *io, void *user_data)
 	addr_size = sizeof(addr);
 	bytes_read = recvfrom(l_io_get_fd(io), buf, sizeof(buf), 0,
 				(struct sockaddr *) &addr, &addr_size);
+
+	/* Ignore control messages */
+	if (addr.sq_port == QRTR_PORT_CTRL)
+		return true;
+
 	memcpy(&info->sender, &addr, sizeof(addr));
 
 	assert(!info->received); /* Only expect one message */