]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add a test case for issue #21817 21839/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 Dec 2021 14:47:52 +0000 (23:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 Dec 2021 15:28:39 +0000 (00:28 +0900)
test/units/testsuite-58.sh

index 62d0a29cb5e84b655521c2cc39840e5191214e1c..78c25051a2d3c25d0a2377150b0122dfb8710795 100755 (executable)
@@ -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