trivial: try harder to make sure mtdram is set up

the autopkgtest environment in Ubuntu seems to not be preparing the mtdram
device properly. Sometimes the udev node "exists" but the /dev/mtd0 does not
exist.

Look for this explicitly and skip the test if it happens.
This commit is contained in:
Mario Limonciello 2022-09-07 08:08:26 -05:00
parent aebf33c4f6
commit d6a455e856

View File

@ -39,6 +39,15 @@ fu_test_mtd_device_func(void)
g_test_skip("could not find mtdram device");
return;
}
dev_name = g_udev_device_get_property(udev_device, "DEVNAME");
if (g_strcmp0(dev_name, "/dev/mtd0") != 0) {
g_test_skip("DEVNAME not /dev/mtd0");
return;
}
if (!g_file_test(dev_name, G_FILE_TEST_EXISTS)) {
g_test_skip("/dev/mtd0 doesn't exist");
return;
}
/* create device */
device = g_object_new(FU_TYPE_MTD_DEVICE, "context", ctx, "udev-device", udev_device, NULL);