summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-device/test-sd-device.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-05-11 19:00:38 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-05-12 19:51:00 +0200
commitfc0cbed2db860d163d59d04c32fa6ec30bd0606f (patch)
treefe6fa576c697493d9cad6c9e69d6b0bbfcd49554 /src/libsystemd/sd-device/test-sd-device.c
parentsd-device: always translate sysname to sysfs filename (diff)
downloadsystemd-fc0cbed2db860d163d59d04c32fa6ec30bd0606f.tar.xz
systemd-fc0cbed2db860d163d59d04c32fa6ec30bd0606f.zip
test-sd-device: skip gpio subsystem
There exist /sys/class/gpio and /sys/bus/gpio, and both have gpiochip%N device. However, these point to different devpaths.
Diffstat (limited to '')
-rw-r--r--src/libsystemd/sd-device/test-sd-device.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c
index 3bd3761f3b..5e3536be40 100644
--- a/src/libsystemd/sd-device/test-sd-device.c
+++ b/src/libsystemd/sd-device/test-sd-device.c
@@ -66,7 +66,11 @@ static void test_sd_device_one(sd_device *d) {
assert_se(r == -ENOENT);
r = sd_device_get_subsystem(d, &subsystem);
- if (r >= 0) {
+ if (r < 0)
+ assert_se(r == -ENOENT);
+ else if (!streq(subsystem, "gpio")) { /* Unfortunately, there exist /sys/class/gpio and /sys/bus/gpio.
+ * Hence, sd_device_new_from_subsystem_sysname() and
+ * sd_device_new_from_device_id() may not work as expected. */
const char *name, *id;
if (streq(subsystem, "drivers"))
@@ -102,8 +106,7 @@ static void test_sd_device_one(sd_device *d) {
r = sd_device_get_property_value(d, "ID_NET_DRIVER", &val);
assert_se(r >= 0 || r == -ENOENT);
- } else
- assert_se(r == -ENOENT);
+ }
is_block = streq_ptr(subsystem, "block");