1
0
mirror of https://github.com/systemd/systemd synced 2026-04-22 23:15:20 +02:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Frantisek Sumsal
c8a4306e63
Merge pull request #22745 from yuwata/test-repart-fixes
test: fixes for TEST-58-REPART
2022-03-15 11:52:50 +00:00
Yu Watanabe
6626ea08f6 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
```
2022-03-15 12:35:50 +09:00
Yu Watanabe
8c166c962d test: format disk image through loopback device
It seems that the change on the image file sometimes not propagated on
the loopback device immediately.
2022-03-15 12:35:50 +09:00
Yu Watanabe
cc75e1f7c9 test: use /var/tmp for storing disk images
The Ubuntu CI on ppc64el seems to have a issue on tmpfs, and files
may not be fsynced. See c10caebb98803b812ebc4dd6cdeaab2ca17826d7.
For safety, let's use /var/tmp to store disk images.
2022-03-15 12:35:50 +09:00

View File

@ -172,9 +172,13 @@ rm -r /tmp/testsuite-58.3-defs/
# testcase for #21817 # testcase for #21817
mkdir -p /tmp/testsuite-58-issue-21817-defs/ mkdir -p /tmp/testsuite-58-issue-21817-defs/
truncate -s 100m /tmp/testsuite-58-issue-21817.img truncate -s 100m /var/tmp/testsuite-58-issue-21817.img
LOOP=$(losetup -P --show -f /tmp/testsuite-58-issue-21817.img) LOOP=$(losetup -P --show -f /var/tmp/testsuite-58-issue-21817.img)
printf 'size=50M,type=%s\n,\n' "${root_guid}" | sfdisk -X gpt /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 cat >/tmp/testsuite-58-issue-21817-defs/test.conf <<EOF
[Partition] [Partition]
Type=root Type=root
@ -187,7 +191,7 @@ grep -qiF "p1 : start= 2048, size= 102400, type=${root_guid}," /tmp/
# Accept both unpadded (pre-v2.38 util-linux) and padded (v2.38+ util-linux) sizes # Accept both unpadded (pre-v2.38 util-linux) and padded (v2.38+ util-linux) sizes
grep -qE "p2 : start= 104448, size= (100319| 98304)," /tmp/testsuite-58-issue-21817.dump grep -qE "p2 : start= 104448, size= (100319| 98304)," /tmp/testsuite-58-issue-21817.dump
rm /tmp/testsuite-58-issue-21817.img /tmp/testsuite-58-issue-21817.dump rm /var/tmp/testsuite-58-issue-21817.img /tmp/testsuite-58-issue-21817.dump
rm -r /tmp/testsuite-58-issue-21817-defs/ rm -r /tmp/testsuite-58-issue-21817-defs/
testsector() testsector()
@ -215,6 +219,10 @@ EOF
truncate -s 100m "/tmp/testsuite-58-sector-$1.img" truncate -s 100m "/tmp/testsuite-58-sector-$1.img"
LOOP=$(losetup -b "$1" -P --show -f "/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" systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no "$LOOP"
rm -rf /tmp/testsuite-58-sector rm -rf /tmp/testsuite-58-sector
sfdisk --verify "$LOOP" sfdisk --verify "$LOOP"