From 3d495d1455624a0dbfed8002de9e02f70e53be71 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Sat, 7 Nov 2026 16:37:29 +0100 Subject: [PATCH] fix: skip camera integration tests without libudev --- .../webrtc/client/CameraIntegrationTest.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/webrtc/src/test/java/dev/onvoid/webrtc/client/CameraIntegrationTest.java b/webrtc/src/test/java/dev/onvoid/webrtc/client/CameraIntegrationTest.java index a786fc263..a6e933251 100644 --- a/webrtc/src/test/java/dev/onvoid/webrtc/client/CameraIntegrationTest.java +++ b/webrtc/src/test/java/dev/onvoid/webrtc/client/CameraIntegrationTest.java @@ -37,10 +37,11 @@ import dev.onvoid.webrtc.media.video.VideoDevice; import org.junit.jupiter.api.Test; +import org.opentest4j.TestAbortedException; /** - * Captures real cameras, so it skips on machines without one, as CI runners - * are. + * Captures real cameras, so it skips on machines without one or without + * the optional camera backend libraries, as CI runners are. */ class CameraIntegrationTest extends ClientTestBase { @@ -248,11 +249,31 @@ public String getDescriptor() { } private List cameras(int needed) { - List cameras = rtc.media().devices().cameras(); + List cameras; + + try { + cameras = rtc.media().devices().cameras(); + } + catch (MediaException e) { + // The ARM32 CI lane deliberately runs without optional libudev. + // Other device failures must still fail these tests. + if (missingUdev(e)) { + // Watching can report the same missing backend to the error handler. + errors.removeIf(CameraIntegrationTest::missingUdev); + throw new TestAbortedException("Camera backend needs libudev", e); + } + throw e; + } assumeTrue(cameras.size() >= needed, "Needs " + needed + " camera(s), found " + cameras.size()); return cameras; } + private static boolean missingUdev(Throwable failure) { + return failure instanceof MediaException + && failure.getCause() instanceof RuntimeException + && "V4l2: libudev not found on system.".equals(failure.getCause().getMessage()); + } + private static void waitFor(java.util.function.BooleanSupplier condition, String what) throws InterruptedException { long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(TIMEOUT_SECONDS);