File tests-adapt-to-SUSE.patch of Package parted.15765

From: Sebastian Parschauer <sparschauer@suse.de>
Date: Wed Sep 13 11:14:42 2017 +0200
Subject: tests: Adapt to SUSE parted
Patch-mainline: no, custom SUSE patch

msdos type flag
Tests: t0283, t2200, t2310, t3200, t3300, t4100, t6002, t9042
For: parted-type.patch

Change dm partition name from 'pN' to '-partN'
Tests: t6001, t6002, t6004, t6005
For: libparted-partition-naming.patch
---
--- a/tests/t2200-dos-label-recog.sh
+++ b/tests/t2200-dos-label-recog.sh
@@ -45,7 +45,7 @@ printf FAT | dd bs=1c seek=82 count=3 of
 # print the partition table
 parted -m -s $dev unit s p > out || fail=1
 tail -2 out > k && mv k out || fail=1
-printf "1:2048s:4095s:2048s:::;\n2:4096s:8191s:4096s:::;\n" > exp || fail=1
+printf "1:2048s:4095s:2048s:::type=83;\n2:4096s:8191s:4096s:::type=83;\n" > exp || fail=1
 
 compare exp out || fail=1
 
--- a/tests/t2310-dos-extended-2-sector-min-offset.sh
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -33,8 +33,8 @@ p5=${scsi_dev}5
 cat <<EOF > exp || framework_failure
 BYT;
 $scsi_dev:$((2048*512/$ss))s:scsi:$ss:$ss:msdos:Linux scsi_debug:;
-1:64s:128s:65s:::lba;
-5:65s:128s:64s:::;
+1:64s:128s:65s:::lba, type=0f;
+5:65s:128s:64s:::type=83;
 EOF
 
 # Create a DOS label with an extended partition starting at sector 64.
--- a/tests/t3200-resize-partition.sh
+++ b/tests/t3200-resize-partition.sh
@@ -75,7 +75,7 @@ compare /dev/null err || fail=1
 parted -m -s $dev u s p > out 2>&1 || fail=1
 
 sed -n 3p out > k && mv k out || fail=1
-printf "1:$default_start:$new_end:3073s:::$ms;\n" > exp || fail=1
+printf "1:$default_start:$new_end:3073s:::type=83;\n" > exp || fail=1
 compare exp out || fail=1
 
 # Remove the partition explicitly, so that mklabel doesn't evoke a warning.
--- a/tests/t3300-palo-prep.sh
+++ b/tests/t3300-palo-prep.sh
@@ -20,9 +20,9 @@
 ss=$sector_size_
 
 cat > exp <<EOF || framework_failure
-1:2048s:4095s:2048s:ext2::lba, palo;
-1:2048s:4095s:2048s:ext2::lba, prep;
-1:2048s:4095s:2048s:ext2::lba, palo;
+1:2048s:4095s:2048s:ext2::lba, palo, type=f0;
+1:2048s:4095s:2048s:ext2::lba, prep, type=41;
+1:2048s:4095s:2048s:ext2::lba, palo, type=f0;
 EOF
 
 dev=dev-file
@@ -37,7 +37,7 @@ parted -m -s $dev mklabel msdos \
   set 1 palo on u s print \
     > out 2> err || fail=1
 
-grep -E '^1:2048s:4095s:2048s:ext2::lba, p...;$' out > k; mv k out
+grep -E '^1:2048s:4095s:2048s:ext2::lba, p..., type=..;$' out > k; mv k out
 
 compare exp out || fail=1
 
--- a/tests/t4100-msdos-starting-sector.sh
+++ b/tests/t4100-msdos-starting-sector.sh
@@ -56,7 +56,7 @@ cat <<EOF > exp || fail=1
 BYT;
 path:${N}s:file:$ss:$ss:msdos::;
 1:32s:2047s:2016s:free;
-1:2048s:4095s:2048s:::;
+1:2048s:4095s:2048s:::type=83;
 EOF
 
 # create a partition at the end of the label
--- a/tests/t6001-psep.sh
+++ b/tests/t6001-psep.sh
@@ -31,9 +31,9 @@ linear2_=plinear-$$foo
 d1= d2=
 f1= f2=
 cleanup_fn_() {
-    dmsetup remove ${linear_}p1
+    dmsetup remove ${linear_}-part1
     dmsetup remove $linear_
-    dmsetup remove ${linear2_}1
+    dmsetup remove ${linear2_}-part1
     dmsetup remove $linear2_
     test -n "$d1" && losetup -d "$d1"
     test -n "$d2" && losetup -d "$d2"
@@ -56,7 +56,7 @@ parted -s $dev mklabel msdos mkpart prim
 compare /dev/null out || fail=1
 
 #make sure device name is correct
-wait_for_dev_to_appear_ ${dev}p1 || fail=1
+wait_for_dev_to_appear_ ${dev}-part1 || fail=1
 
 #repeat on name not ending in a digit
 # setup: create a mapping
@@ -68,7 +68,7 @@ parted -s $dev mklabel msdos mkpart prim
 compare /dev/null out || fail=1
 
 #make sure device name is correct
-wait_for_dev_to_appear_ ${dev}1 || fail=1
+wait_for_dev_to_appear_ ${dev}-part1 || fail=1
 
 if [ -n "$fail" ]; then
     ls /dev/mapper
--- a/tests/t6004-dm-many-partitions.sh
+++ b/tests/t6004-dm-many-partitions.sh
@@ -50,10 +50,10 @@ parted -m -a min -s /dev/mapper/$dm_name
 
 # Make sure all the partitions appeared under /dev/mapper/
 for ((i=1; i<=$n_partitions; i+=1)); do
-    wait_for_dev_to_appear_ "/dev/mapper/${dm_name}p$i" || { fail=1; break; }
+    wait_for_dev_to_appear_ "/dev/mapper/${dm_name}-part$i" || { fail=1; break; }
 
     # remove the partitions as we go, otherwise cleanup won't work.
-    dmsetup remove /dev/mapper/${dm_name}p$i
+    dmsetup remove /dev/mapper/${dm_name}-part$i
 done
 
 Exit $fail
--- a/tests/t6005-dm-uuid.sh
+++ b/tests/t6005-dm-uuid.sh
@@ -47,14 +47,14 @@ for ((i=1; i<=$n_partitions; i+=1)); do
   cmd="$cmd mkpart p$i ${s}s ${s}s"
 done
 parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1
-wait_for_dev_to_appear_ /dev/mapper/${dm_name}p${n_partitions} || fail=1
+wait_for_dev_to_appear_ /dev/mapper/${dm_name}-part${n_partitions} || fail=1
 
 # Make sure all the partitions have UUIDs
 for ((i=1; i<=$n_partitions; i+=1)); do
-    dmsetup info /dev/mapper/${dm_name}p$i | grep UUID || fail=1
+    dmsetup info /dev/mapper/${dm_name}-part$i | grep UUID || fail=1
 
     # remove the partitions as we go, otherwise cleanup won't work.
-    dmsetup remove /dev/mapper/${dm_name}p$i
+    dmsetup remove /dev/mapper/${dm_name}-part$i
 done
 
 Exit $fail
--- a/tests/t0283-overlap-partitions.sh
+++ b/tests/t0283-overlap-partitions.sh
@@ -54,8 +54,8 @@ Partition Table: msdos
 Disk Flags:
 
 Number  Start   End     Size    Type     File system  Flags
- 1      1049kB  5243kB  4194kB  primary
- 2      5242kB  8000kB  2758kB  primary
+ 1      1049kB  5243kB  4194kB  primary               type=83
+ 2      5242kB  8000kB  2758kB  primary               type=83
 
 (parted) rm
 Partition number? 2
@@ -94,7 +94,7 @@ Partition Table: msdos
 Disk Flags:
 
 Number  Start   End     Size    Type     File system  Flags
- 1      1049kB  5243kB  4194kB  primary
+ 1      1049kB  5243kB  4194kB  primary               type=83
 
 (parted) rm
 Partition number? 1
--- a/tests/t6002-dm-busy.sh
+++ b/tests/t6002-dm-busy.sh
@@ -35,9 +35,9 @@ d1=
 f1=
 dev=
 cleanup_fn_() {
-    umount "${dev}p2" > /dev/null 2>&1
-    dmsetup remove ${linear_}p1
-    dmsetup remove ${linear_}p2
+    umount "${dev}-part2" > /dev/null 2>&1
+    dmsetup remove ${linear_}-part1
+    dmsetup remove ${linear_}-part2
     dmsetup remove $linear_
     test -n "$d1" && losetup -d "$d1"
     rm -f "$f1"
@@ -62,14 +62,14 @@ parted -s $dev -a none mkpart primary fa
 compare /dev/null out || fail=1
 
 # wait for new partition device to appear
-wait_for_dev_to_appear_ ${dev}p2 || fail_ ${dev}p2 did not appear
+wait_for_dev_to_appear_ ${dev}-part2 || fail_ ${dev}-part2 did not appear
 
-mkfs.vfat -F 32 ${dev}p2 || fail_ mkfs.vfat failed
+mkfs.vfat -F 32 ${dev}-part2 || fail_ mkfs.vfat failed
 
 mount_point=$(pwd)/mnt
 
 mkdir $mount_point || fail=1
-mount "${dev}p2" "$mount_point" || fail=1
+mount "${dev}-part2" "$mount_point" || fail=1
 
 # Removal of unmounted partition must succeed.
 parted -s "$dev" rm 1 > /dev/null 2>&1 || fail=1
@@ -84,7 +84,7 @@ sed "s,^$dev,DEV," out > k; mv k out
 cat <<EOF >> exp || fail=1
 BYT;
 DEV:${n}s:dm:512:512:msdos:Linux device-mapper (linear):;
-2:1001s:200000s:199000s:fat32::lba;
+2:1001s:200000s:199000s:fat32::lba, type=0c;
 EOF
 
 compare exp out || fail=1
--- a/tests/t9042-dos-partition-limit.sh
+++ b/tests/t9042-dos-partition-limit.sh
@@ -41,7 +41,7 @@ scsi_dev=$(cat dev-name)
 n=$((n_MiB * sectors_per_MiB))
 printf '%s\n' "BYT;" \
     "$scsi_dev:${n}s:scsi:$ss:$ss:msdos:Linux scsi_debug:;" \
-    "1:$((start-2))s:$((n-1))s:$((n-start+2))s:::lba;" \
+    "1:$((start-2))s:$((n-1))s:$((n-start+2))s:::lba, type=0f;" \
   > exp || fail=1
 
 parted -s $scsi_dev mklabel msdos || fail=1
@@ -51,7 +51,7 @@ i=1
 while :; do
     end=$((start + partition_sectors - 2))
     parted -s -a min $scsi_dev mkpart logical ${start}s ${end}s || fail=1
-    printf "$((i+4)):${start}s:${end}s:$((end-start+1))s:::;\n" >> exp
+    printf "$((i+4)):${start}s:${end}s:$((end-start+1))s:::type=83;\n" >> exp
     test $i = $((n_partitions - 1)) && break
     start=$((start + partition_sectors))
     i=$((i+1))
--- a/tests/t4100-msdos-partition-limits.sh
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -81,7 +81,7 @@ do_mkpart $n $end || fail=1
 # print the result
 parted -s $dev unit s p > out 2>&1 || fail=1
 sed -n "/^  *1  *$n/s/  */ /gp" out|sed "s/  *\$//" > k && mv k out || fail=1
-echo " 1 ${n}s ${end}s 4294967295s primary" > exp || fail=1
+echo " 1 ${n}s ${end}s 4294967295s primary type=83" > exp || fail=1
 compare exp out || fail=1
 
 # a partition length of exactly 2^32 sectors provokes failure.
@@ -121,7 +121,7 @@ Partition Table: $table_type
 Disk Flags:
 
 Number  Start        End          Size   Type     File system  Flags
- 1      4294967295s  4294968294s  1000s  primary
+ 1      4294967295s  4294968294s  1000s  primary               type=83
 
 EOF
openSUSE Build Service is sponsored by