Skip to contentSkip to conversation

NFC: nci: Extend virtual NCI deinit test

PATCH Applied Dmitry Vyukov 2 participants 2 messages Nov 17, 2022 – Nov 21, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 NFC: nci: Extend virtual NCI deinit test

Extend the test to check the scenario when NCI core tries to send data to already closed device to ensure that nothing bad happens.

Cc Bongsu Jeon <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Jakub Kicinski <[email protected]>

---

Changes in v2:
- use C multi-line comment style instead of C++ style

---
 tools/testing/selftests/nci/nci_dev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/testing/selftests/nci/nci_dev.c +11 -0
index 162c41e9bcae8..1562aa7d60b0f 100644
@@ -888,6 +888,17 @@ TEST_F(NCI, deinit)
 			   &msg);
 	ASSERT_EQ(rc, 0);
 	EXPECT_EQ(get_dev_enable_state(&msg), 0);
+
+	/* Test that operations that normally send packets to the driver
+	 * don't cause issues when the device is already closed.
+	 * Note: the send of NFC_CMD_DEV_UP itself still succeeds it's just
+	 * that the device won't actually be up.
+	 */
+	close(self->virtual_nci_fd);
+	self->virtual_nci_fd = -1;
+	rc = send_cmd_with_idx(self->sd, self->fid, self->pid,
+			       NFC_CMD_DEV_UP, self->dev_idex);
+	EXPECT_EQ(rc, 0);
 }
 
 TEST_HARNESS_MAIN

base-commit: f12ed9c04804eec4f1819097a0fd0b4800adac2f
prerequisite-patch-id: 214c5357c652cee65ee803d0f45f4b15cfcc9861

Signature · 1 line
2.38.1.431.g37b22c650d-goog
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Thu, 17 Nov 2022 17:21:01 +0100 you wrote:

Extend the test to check the scenario when NCI core tries to send data to already closed device to ensure that nothing bad happens.

Cc Bongsu Jeon <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Jakub Kicinski <[email protected]>

[...]

Here is the summary with links:
- [net-next,v2] NFC: nci: Extend virtual NCI deinit test

    https://git.kernel.org/netdev/net-next/c/d9e8da558580

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html