]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: collect information about loopback device on failure 32944/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 May 2024 20:35:50 +0000 (05:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 21 May 2024 14:13:45 +0000 (23:13 +0900)
test/units/TEST-74-AUX-UTILS.mount.sh

index 98c388a272c6aa7b8697b601d49d97fce722bd68..ba47b5384db89d9a84d46c70fe8f9bd2a6d0961a 100755 (executable)
@@ -162,7 +162,15 @@ LOOP="$(losetup --show --find "$WORK_DIR/owner-vfat.img")"
 udevadm wait --timeout 60 --settle "$LOOP"
 # Also wait for the .device unit for the loop device is active. Otherwise, the .device unit activation
 # that is triggered by the .mount unit introduced by systemd-mount below may time out.
-timeout 60 bash -c "until systemctl is-active $LOOP; do sleep 1; done"
+if ! timeout 60 bash -c "until systemctl is-active $LOOP; do sleep 1; done"; then
+    # For debugging issue like
+    # https://github.com/systemd/systemd/issues/32680#issuecomment-2120959238
+    # https://github.com/systemd/systemd/issues/32680#issuecomment-2122074805
+    udevadm info "$LOOP"
+    udevadm info --attribute-walk "$LOOP"
+    cat /sys/"$(udevadm info --query property --property DEVPATH --value "$LOOP")"/loop/backing_file || :
+    false
+fi
 # Mount it and check the UID/GID
 [[ "$(stat -c "%U:%G" "$WORK_DIR/mnt")" == "root:root" ]]
 systemd-mount --owner=testuser "$LOOP" "$WORK_DIR/mnt"