mirror of
https://github.com/Jeffrey-Sardina/liberated-systemd.git
synced 2026-10-19 01:29:53 -05:00
test-sd-device: tolerate devices disappearing during enumeration test
On CI (Azure runners) the accelerated networking PCI VF behind the Hyper-V vmbus PCI bridge may be hot-unplugged while the test runs, causing sd_device_new_from_syspath() to fail with ENODEV for a device we just enumerated: test_sd_device_one(/sys/devices/LNXSYSTM:00/.../pci7870:00/7870:00:00.0) Assertion failed: Expected "sd_device_new_from_syspath(&dev, syspath)" to succeed, but got error: -19/ENODEV Skip devices whose syspath vanished since enumeration rather than failing.
This commit is contained in:
1 parent
3d367b352b
commit
b43136ffcd
1 file changed
+9
-1
@@ -110,7 +110,15 @@ static void test_sd_device_one(sd_device *d) {
|
||||
|
||||
log_info("%s(%s)", __func__, syspath);
|
||||
|
||||
ASSERT_OK(sd_device_new_from_syspath(&dev, syspath));
|
||||
r = sd_device_new_from_syspath(&dev, syspath);
|
||||
if (ERRNO_IS_DEVICE_ABSENT(r)) {
|
||||
/* Devices may be hot-unplugged while we are running, e.g. on Azure the accelerated
|
||||
* networking PCI VF behind a Hyper-V vmbus PCI bridge may be removed and re-added
|
||||
* during host servicing. Don't fail the test if a device vanished since enumeration. */
|
||||
log_device_notice_errno(d, r, "Device disappeared while running the test, skipping: %m");
|
||||
return;
|
||||
}
|
||||
ASSERT_OK(r);
|
||||
ASSERT_OK(sd_device_get_syspath(dev, &val));
|
||||
ASSERT_STREQ(syspath, val);
|
||||
ASSERT_NULL(dev = sd_device_unref(dev));
|
||||
|
||||
Reference in new issue
Block a user