diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-14 22:02:37 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-15 12:35:50 +0900 |
commit | 6626ea08f6db3c050b5e05fa760cf0e371862173 (patch) | |
tree | 73a0baec764b2290ec8e688d5ec89d2eaa4d0c5a | |
parent | 8c166c962d9fdb69ec3333e4587d716a68a043fc (diff) | |
download | systemd-6626ea08f6db3c050b5e05fa760cf0e371862173.tar.gz |
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
```
-rwxr-xr-x | test/units/testsuite-58.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh index cc755a4f86..cef7d094fd 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 <<EOF [Partition] @@ -215,6 +219,10 @@ EOF truncate -s 100m "/tmp/testsuite-58-sector-$1.img" LOOP=$(losetup -b "$1" -P --show -f "/tmp/testsuite-58-sector-$1.img" ) + while : ; do + test -e "$LOOP" && break + sleep .2 + done systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no "$LOOP" rm -rf /tmp/testsuite-58-sector sfdisk --verify "$LOOP" |