From: Yu Watanabe Date: Mon, 14 Mar 2022 13:02:37 +0000 (+0900) Subject: test: wait for loopback device being actually created X-Git-Tag: v251-rc1~145^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F22745%2Fhead;p=thirdparty%2Fsystemd.git test: wait for loopback device being actually created It seems there exists a short time period that we cannot see the loopback device after `losetup` is finished: ``` testsuite-58.sh[367]: ++ losetup -b 1024 -P --show -f /tmp/testsuite-58-sector-1024.img kernel: loop1: detected capacity change from 0 to 204800 testsuite-58.sh[285]: + LOOP=/dev/loop1 testsuite-58.sh[285]: + systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no /dev/loop1 testsuite-58.sh[368]: Device '/dev/loop1' has no dm-crypt/dm-verity device, no need to look for underlying block device. testsuite-58.sh[368]: Failed to determine canonical path for '/dev/loop1': No such file or directory testsuite-58.sh[368]: Failed to open file or determine backing device of /dev/loop1: No such file or directory ``` --- diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh index cc755a4f86d..cef7d094fd5 100755 --- a/test/units/testsuite-58.sh +++ b/test/units/testsuite-58.sh @@ -174,6 +174,10 @@ rm -r /tmp/testsuite-58.3-defs/ mkdir -p /tmp/testsuite-58-issue-21817-defs/ truncate -s 100m /var/tmp/testsuite-58-issue-21817.img LOOP=$(losetup -P --show -f /var/tmp/testsuite-58-issue-21817.img) +while : ; do + test -e "$LOOP" && break + sleep .2 +done printf 'size=50M,type=%s\n,\n' "${root_guid}" | sfdisk -X gpt "$LOOP" cat >/tmp/testsuite-58-issue-21817-defs/test.conf <