]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: avoid hanging forever waiting for udev if not a booted system
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 20 Feb 2026 19:28:34 +0000 (19:28 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 24 Feb 2026 19:53:20 +0000 (04:53 +0900)
test_sd_device_enumerator_filter_subsystem hangs forever in OBS builds,
as it waits for the udev queue to be drained. But this is not a booted
system, with systemd and udev, so nothing will do that.
Skip the test in that case.

src/libsystemd/sd-device/test-sd-device.c

index 40a40a70bf01ebffad0f5eec3137e1975d831881..db7c9420cc605fbf247fc2f0ef06eec5e7e64599 100644 (file)
@@ -3,6 +3,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include "sd-daemon.h"
 #include "sd-event.h"
 
 #include "capability-util.h"
@@ -466,6 +467,10 @@ TEST(sd_device_enumerator_filter_subsystem) {
                 return;
         }
 
+        /* The rest of this test depends on a full booted system with a working udev and so on */
+        if (!sd_booted())
+                return (void) log_tests_skipped("Test requires fully booted system with udev/etc, skipping to avoid hanging forever.");
+
         _cleanup_(sd_event_unrefp) sd_event *event = NULL;
         ASSERT_OK(sd_event_default(&event));
         ASSERT_OK(sd_event_add_inotify(event, NULL, "/run/udev" , IN_DELETE, on_inotify, NULL));