summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-04-19 21:16:53 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-27 16:32:42 +0900
commitff56124b119ebc7734c479887f71c0a6f2574b09 (patch)
tree52577b440a88a7ffa279eb3741591d755ef93ba8 /src
parent9409710097b56d42bcbd2e373bc368d0e2622079 (diff)
downloadsystemd-ff56124b119ebc7734c479887f71c0a6f2574b09.tar.gz
test: exclude "bdi" subsystem and loop block devices
On several CI environments, it seems that some loop block devices and corresponding bdi devices are sometimes removed during the test is running. Let's exclude them. Fixes #22970.
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-device/test-sd-device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd/sd-device/test-sd-device.c b/src/libsystemd/sd-device/test-sd-device.c
index 7bc6135406..3bd3761f3b 100644
--- a/src/libsystemd/sd-device/test-sd-device.c
+++ b/src/libsystemd/sd-device/test-sd-device.c
@@ -182,6 +182,10 @@ TEST(sd_device_enumerator_devices) {
assert_se(sd_device_enumerator_new(&e) >= 0);
assert_se(sd_device_enumerator_allow_uninitialized(e) >= 0);
+ /* On some CI environments, it seems some loop block devices and corresponding bdi devices sometimes
+ * 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);
FOREACH_DEVICE(e, d)
test_sd_device_one(d);
}
@@ -208,6 +212,8 @@ 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);
FOREACH_DEVICE(e, d) {
const char *syspath;
@@ -250,6 +256,9 @@ TEST(sd_device_enumerator_filter_subsystem) {
assert_se(subsystems = hashmap_new(&string_hash_ops));
assert_se(sd_device_enumerator_new(&e) >= 0);
+ /* 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);
FOREACH_DEVICE(e, d) {
const char *syspath, *subsystem;