Running a test against a reserved BAR will result in the pci-epf-test
driver returning -ENOBUFS.

Make sure that the pci_endpoint_test selftest will return skip instead of
failure or success for reserved BARs.

Signed-off-by: Niklas Cassel <[email protected]>
---
 tools/testing/selftests/pci_endpoint/pci_endpoint_test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c 
b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
index eecb776c33af..e506359cdded 100644
--- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
+++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
@@ -67,6 +67,8 @@ TEST_F(pci_ep_bar, BAR_TEST)
        pci_ep_ioctl(PCITEST_BAR, variant->barno);
        if (ret == -ENODATA)
                SKIP(return, "BAR is disabled");
+       if (ret == -ENOBUFS)
+               SKIP(return, "BAR is reserved");
        EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
 }
 
@@ -84,6 +86,8 @@ TEST_F(pci_ep_bar, BAR_SUBRANGE_TEST)
                SKIP(return, "BAR is test register space");
        if (ret == -EOPNOTSUPP)
                SKIP(return, "Subrange map is not supported");
+       if (ret == -ENOBUFS)
+               SKIP(return, "BAR is reserved");
        EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
 }
 
-- 
2.53.0


Reply via email to