Skip to content

Commit a28d2f2

Browse files
khayash1kwilczynski
authored andcommitted
selftests: pci_endpoint: Add GET_IRQTYPE checks to each interrupt test
Add GET_IRQTYPE API checks to each interrupt test. While at it, change pci_ep_ioctl() to get the appropriate return value from ioctl(). Suggested-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Kunihiko Hayashi <[email protected]> Link: https://lore.kernel.org/r/[email protected] [kwilczynski: commit log] Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent af1451b commit a28d2f2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/testing/selftests/pci_endpoint/pci_endpoint_test.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define pci_ep_ioctl(cmd, arg) \
2626
({ \
2727
ret = ioctl(self->fd, cmd, arg); \
28-
ret = ret < 0 ? -errno : 0; \
28+
ret = ret < 0 ? -errno : ret; \
2929
})
3030

3131
static const char *test_device = "/dev/pci-endpoint-test.0";
@@ -102,6 +102,9 @@ TEST_F(pci_ep_basic, LEGACY_IRQ_TEST)
102102
pci_ep_ioctl(PCITEST_SET_IRQTYPE, 0);
103103
ASSERT_EQ(0, ret) TH_LOG("Can't set Legacy IRQ type");
104104

105+
pci_ep_ioctl(PCITEST_GET_IRQTYPE, 0);
106+
ASSERT_EQ(0, ret) TH_LOG("Can't get Legacy IRQ type");
107+
105108
pci_ep_ioctl(PCITEST_LEGACY_IRQ, 0);
106109
EXPECT_FALSE(ret) TH_LOG("Test failed for Legacy IRQ");
107110
}
@@ -113,6 +116,9 @@ TEST_F(pci_ep_basic, MSI_TEST)
113116
pci_ep_ioctl(PCITEST_SET_IRQTYPE, 1);
114117
ASSERT_EQ(0, ret) TH_LOG("Can't set MSI IRQ type");
115118

119+
pci_ep_ioctl(PCITEST_GET_IRQTYPE, 0);
120+
ASSERT_EQ(1, ret) TH_LOG("Can't get MSI IRQ type");
121+
116122
for (i = 1; i <= 32; i++) {
117123
pci_ep_ioctl(PCITEST_MSI, i);
118124
EXPECT_FALSE(ret) TH_LOG("Test failed for MSI%d", i);
@@ -126,6 +132,9 @@ TEST_F(pci_ep_basic, MSIX_TEST)
126132
pci_ep_ioctl(PCITEST_SET_IRQTYPE, 2);
127133
ASSERT_EQ(0, ret) TH_LOG("Can't set MSI-X IRQ type");
128134

135+
pci_ep_ioctl(PCITEST_GET_IRQTYPE, 0);
136+
ASSERT_EQ(2, ret) TH_LOG("Can't get MSI-X IRQ type");
137+
129138
for (i = 1; i <= 2048; i++) {
130139
pci_ep_ioctl(PCITEST_MSIX, i);
131140
EXPECT_FALSE(ret) TH_LOG("Test failed for MSI-X%d", i);

0 commit comments

Comments
 (0)