* [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent
@ 2026-09-10 3:21 Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eva Kurchatova @ 2026-09-10 3:21 UTC (permalink / raw)
To: khorenko; +Cc: devel
Every fixture opens /dev/pci-endpoint-test.0 and asserts on the result,
so on a machine that has no PCI endpoint test device all 17 cases fail
in fixture setup rather than saying the hardware is not there.
Fix by checking the device once before handing over to the harness.
Doing it that way returns one SKIP line from the kselftest.
https://virtuozzo.atlassian.net/browse/VSTOR-142446
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../selftests/pci_endpoint/pci_endpoint_test.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
index da0db0e7c969..a6106b6c52e3 100644
--- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
+++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
@@ -257,4 +257,20 @@ TEST_F(pcie_ep_doorbell, DOORBELL_TEST)
pci_ep_ioctl(PCITEST_DOORBELL, 0);
EXPECT_FALSE(ret) TH_LOG("Test failed for Doorbell\n");
}
-TEST_HARNESS_MAIN
+
+static bool test_device_available(void)
+{
+ return access(test_device, F_OK) == 0;
+}
+
+int main(int argc, char **argv)
+{
+ /*
+ * Only the plain invocation, which is the one kselftest uses, turns
+ * into a skip, so that -l and -h keep working without the hardware.
+ */
+ if (argc == 1 && !test_device_available())
+ ksft_exit_skip("no PCI endpoint test device %s\n", test_device);
+
+ return test_harness_run(argc, argv);
+}
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent
2026-09-10 3:21 [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent Eva Kurchatova
@ 2026-09-23 18:03 ` Konstantin Khorenko
2026-09-23 18:18 ` Konstantin Khorenko
2026-09-23 18:23 ` Konstantin Khorenko
2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:03 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
changelog v1-> v2?
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 9/10/26 05:21, Eva Kurchatova wrote:
> Every fixture opens /dev/pci-endpoint-test.0 and asserts on the result,
> so on a machine that has no PCI endpoint test device all 17 cases fail
> in fixture setup rather than saying the hardware is not there.
>
> Fix by checking the device once before handing over to the harness.
> Doing it that way returns one SKIP line from the kselftest.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-142446
> Feature: fix selftests
>
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> ---
> .../selftests/pci_endpoint/pci_endpoint_test.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
> index da0db0e7c969..a6106b6c52e3 100644
> --- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
> +++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
> @@ -257,4 +257,20 @@ TEST_F(pcie_ep_doorbell, DOORBELL_TEST)
> pci_ep_ioctl(PCITEST_DOORBELL, 0);
> EXPECT_FALSE(ret) TH_LOG("Test failed for Doorbell\n");
> }
> -TEST_HARNESS_MAIN
> +
> +static bool test_device_available(void)
> +{
> + return access(test_device, F_OK) == 0;
> +}
> +
> +int main(int argc, char **argv)
> +{
> + /*
> + * Only the plain invocation, which is the one kselftest uses, turns
> + * into a skip, so that -l and -h keep working without the hardware.
> + */
> + if (argc == 1 && !test_device_available())
> + ksft_exit_skip("no PCI endpoint test device %s\n", test_device);
> +
> + return test_harness_run(argc, argv);
> +}
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent
2026-09-10 3:21 [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
@ 2026-09-23 18:18 ` Konstantin Khorenko
2026-09-23 18:23 ` Konstantin Khorenko
2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:18 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
On Thu, 10 Sep 2026 06:21:19 +0300, Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:
> Every fixture opens /dev/pci-endpoint-test.0 and asserts on the result,
> so on a machine that has no PCI endpoint test device all 17 cases fail
> in fixture setup rather than saying the hardware is not there.
>
> Fix by checking the device once before handing over to the harness.
> Doing it that way returns one SKIP line from the kselftest.
>
> [...]
Reviewed-by: Konstantin Khorenko <khorenko@virtuozzo.com>
--
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent
2026-09-10 3:21 [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
2026-09-23 18:18 ` Konstantin Khorenko
@ 2026-09-23 18:23 ` Konstantin Khorenko
2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 18:23 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
On Thu, 10 Sep 2026 06:21:19 +0300, Eva Kurchatova wrote:
> selftests: pci_endpoint: skip when the test device is absent
Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.3.vz10, thanks!
[1/1] selftests: pci_endpoint: skip when the test device is absent
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/e019ab580cca
--
Konstantin Khorenko <khorenko@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-23 18:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 3:21 [Devel] [PATCH vz10 v2] selftests: pci_endpoint: skip when the test device is absent Eva Kurchatova
2026-09-23 18:03 ` Konstantin Khorenko
2026-09-23 18:18 ` Konstantin Khorenko
2026-09-23 18:23 ` Konstantin Khorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox