Commit d9e8da55 authored by Dmitry Vyukov's avatar Dmitry Vyukov Committed by David S. Miller
Browse files

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.

Signed-off-by: default avatarDmitry Vyukov <dvyukov@google.com>
Cc: Bongsu Jeon <bongsu.jeon@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 148b1da8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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