From f9e090b16db7356ed95e16467128401b89b82abe Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 10 Jun 2022 15:36:17 +0900 Subject: [PATCH 1/2] test: always exclude devices named loop* Not only block subsystem, but also misc has device named "loop*", and the test always said that the following device is newly found: --- /* test_sd_device_enumerator_filter_subsystem */ New device found: subsystem:misc syspath:/sys/devices/virtual/misc/loop-control 1 new devices are found in re-scan --- --- src/libsystemd/sd-device/test-sd-device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c index 5e3536be40..62e10ad651 100644 --- a/src/libsystemd/sd-device/test-sd-device.c +++ b/src/libsystemd/sd-device/test-sd-device.c @@ -215,8 +215,7 @@ static void test_sd_device_enumerator_filter_subsystem_one( assert_se(sd_device_enumerator_new(&e) >= 0); assert_se(sd_device_enumerator_add_match_subsystem(e, subsystem, true) >= 0); - if (streq(subsystem, "block")) - assert_se(sd_device_enumerator_add_nomatch_sysname(e, "loop*") >= 0); + assert_se(sd_device_enumerator_add_nomatch_sysname(e, "loop*") >= 0); FOREACH_DEVICE(e, d) { const char *syspath; From 3284dd91591d3c21191cf05e90ac990835503e67 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 10 Jun 2022 15:38:51 +0900 Subject: [PATCH 2/2] test: exclude network interfaces After https://github.com/systemd/systemd-centos-ci/pull/492 is merged, the networkd test may be running when test-sd-device is invoked. Let's exclude net subsystem. --- src/libsystemd/sd-device/test-sd-device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c index 62e10ad651..ba7767ee49 100644 --- a/src/libsystemd/sd-device/test-sd-device.c +++ b/src/libsystemd/sd-device/test-sd-device.c @@ -189,6 +189,9 @@ TEST(sd_device_enumerator_devices) { * disappear during running this test. Let's exclude them here for stability. */ assert_se(sd_device_enumerator_add_match_subsystem(e, "bdi", false) >= 0); assert_se(sd_device_enumerator_add_nomatch_sysname(e, "loop*") >= 0); + /* On CentOS CI, systemd-networkd-tests.py may be running when this test is invoked. The networkd + * test creates and removes many network interfaces, and may interfere with this test. */ + assert_se(sd_device_enumerator_add_match_subsystem(e, "net", false) >= 0); FOREACH_DEVICE(e, d) test_sd_device_one(d); } @@ -261,6 +264,7 @@ TEST(sd_device_enumerator_filter_subsystem) { /* See comments in TEST(sd_device_enumerator_devices). */ assert_se(sd_device_enumerator_add_match_subsystem(e, "bdi", false) >= 0); assert_se(sd_device_enumerator_add_nomatch_sysname(e, "loop*") >= 0); + assert_se(sd_device_enumerator_add_match_subsystem(e, "net", false) >= 0); FOREACH_DEVICE(e, d) { const char *syspath, *subsystem;