Merge pull request #21839 from yuwata/repart-issue-reproducer-21817

test: add test case for #21817
This commit is contained in:
Yu Watanabe 2021-12-21 02:30:53 +09:00 committed by GitHub
commit a2482eb290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 3 deletions

View file

@ -21,7 +21,6 @@ test_append_files() {
instmods overlay =overlayfs
install_dmevent
generate_module_dependencies
inst_binary losetup
inst_binary mksquashfs
inst_binary unsquashfs
install_verity_minimal

View file

@ -27,7 +27,6 @@ test_append_files() {
instmods overlay =overlayfs
install_dmevent
generate_module_dependencies
inst_binary losetup
inst_binary wc
if command -v openssl >/dev/null 2>&1; then
inst_binary openssl

View file

@ -15,7 +15,6 @@ test_append_files() {(
instmods loop =block
instmods dm_integrity =md
inst_binary losetup
inst_binary integritysetup
inst_binary blkid
install_dmevent

View file

@ -154,6 +154,7 @@ BASICTOOLS=(
ln
loadkeys
login
losetup
lz4cat
mkfifo
mktemp

View file

@ -116,6 +116,25 @@ grep -qxF '/var/tmp/testsuite-58.3.img3 : start= 3662944, size= 17308536,
rm /var/tmp/testsuite-58.3.img /tmp/testsuite-58.3.dump
rm -r /tmp/testsuite-58.3-defs/
# testcase for #21817
mkdir -p /tmp/testsuite-58-issue-21817-defs/
truncate -s 100m /tmp/testsuite-58-issue-21817.img
LOOP=$(losetup -P --show -f /tmp/testsuite-58-issue-21817.img)
printf 'size=50M,type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709\n,\n' | sfdisk -X gpt /tmp/testsuite-58-issue-21817.img
cat >/tmp/testsuite-58-issue-21817-defs/test.conf <<EOF
[Partition]
Type=root
EOF
systemd-repart --pretty=yes --definitions /tmp/testsuite-58-issue-21817-defs/ "$LOOP"
sfdisk --dump "$LOOP" | tee /tmp/testsuite-58-issue-21817.dump
losetup -d "$LOOP"
grep -qF 'p1 : start= 2048, size= 102400, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709,' /tmp/testsuite-58-issue-21817.dump
grep -qF 'p2 : start= 104448, size= 100319,' /tmp/testsuite-58-issue-21817.dump
rm /tmp/testsuite-58-issue-21817.img /tmp/testsuite-58-issue-21817.dump
rm -r /tmp/testsuite-58-issue-21817-defs/
echo OK >/testok
exit 0