test: avoid hanging forever waiting for udev if not a booted system

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.
This commit is contained in:
Luca Boccassi
2026-02-25 04:53:20 +09:00
committed by Yu Watanabe
parent e4f72956b6
commit a851c5118b
@@ -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));