[PATCH] selftests/nci: skip when the virtual NCI device is absent

From: Eva Kurchatova

Date: Fri Sep 25 2026 - 09:45:55 EST


All 8 tests fail in setup without CONFIG_NFC_VIRTUAL_NCI.

Skip only when the device node is missing, so that a real open()
failure, EPERM or EBUSY, still fails the test instead of being
reported as a skip.

Signed-off-by: Eva Kurchatova <eva.kurchatova@xxxxxxxxxxxxx>
---
tools/testing/selftests/nci/nci_dev.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c
index 07427fa42888..cb567d6f32ed 100644
--- a/tools/testing/selftests/nci/nci_dev.c
+++ b/tools/testing/selftests/nci/nci_dev.c
@@ -430,6 +430,8 @@ FIXTURE_SETUP(NCI)
ASSERT_NE(self->fid, -1);

self->virtual_nci_fd = open("/dev/virtual_nci", O_RDWR);
+ if (self->virtual_nci_fd < 0 && errno == ENOENT)
+ SKIP(return, "virtual NCI device is not available");
ASSERT_GT(self->virtual_nci_fd, -1);

rc = setsockopt(self->sd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &event_group,
--
2.55.0