} else
assert_se(r == -ENOENT);
- r = sd_device_get_sysattr_value(d, "name_assign_type", &val);
- assert_se(r >= 0 || ERRNO_IS_PRIVILEGE(r) || IN_SET(r, -ENOENT, -EINVAL));
-
- if (r > 0) {
+ r = sd_device_get_sysattr_value(d, "nsid", NULL);
+ if (r >= 0) {
unsigned x;
- assert_se(device_get_sysattr_unsigned(d, "name_assign_type", NULL) >= 0);
- assert_se(device_get_sysattr_unsigned(d, "name_assign_type", &x) >= 0);
- }
+ assert_se(device_get_sysattr_unsigned(d, "nsid", NULL) >= 0);
+ r = device_get_sysattr_unsigned(d, "nsid", &x);
+ assert_se(r >= 0);
+ assert_se((x > 0) == (r > 0));
+ } else
+ assert_se(ERRNO_IS_PRIVILEGE(r) || IN_SET(r, -ENOENT, -EINVAL));
}
TEST(sd_device_enumerator_devices) {
/* The test test_sd_device_enumerator_filter_subsystem_trial() is quite racy. Let's run the function
* several times after the udev queue becomes empty. */
- if (!udev_available()) {
+ if (!udev_available() || (access("/run/udev", F_OK) < 0 && errno == ENOENT)) {
assert_se(test_sd_device_enumerator_filter_subsystem_trial_many());
return;
}
_cleanup_(sd_device_unrefp) sd_device *device = NULL, *from_nulstr = NULL;
_cleanup_free_ char *nulstr_copy = NULL;
- const char *devlink, *nulstr;
+ const char *nulstr;
size_t len;
assert_se(sd_device_new_from_syspath(&device, "/sys/class/net/lo") >= 0);