Hello community, here is the log from the commit of package parted for openSUSE:Factory checked in at 2017-09-15 21:08:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/parted (Old) and /work/SRC/openSUSE:Factory/.parted.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "parted" Fri Sep 15 21:08:51 2017 rev:118 rq:525902 version:3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/parted/parted.changes 2017-09-04 12:26:07.005608656 +0200 +++ /work/SRC/openSUSE:Factory/.parted.new/parted.changes 2017-09-15 21:08:51.340341144 +0200 @@ -1,0 +2,18 @@ +Wed Sep 13 13:54:45 UTC 2017 - [email protected] + +- Make SUSE parted pass all tests in upstream test suite + - add: tests-set-optimal-blocks-for-scsi_debug.patch + - add: tests-increase-scsi_debug-tmo.patch + - add: tests-use-wait_for_dev_to_-functions.patch + - add: tests-wait_for_-loop.patch + - add: tests-update-t0220-t0280-for-swap-flag.patch + - add: tests-adapt-to-SUSE.patch + +------------------------------------------------------------------- +Wed Sep 13 10:30:16 CEST 2017 - [email protected] + +- Fix partition naming for dm devices not ending in a digit and + also fix resizing of dm partitions (bsc#1056508) + - amend: libparted-partition-naming.patch + +------------------------------------------------------------------- New: ---- tests-adapt-to-SUSE.patch tests-increase-scsi_debug-tmo.patch tests-set-optimal-blocks-for-scsi_debug.patch tests-update-t0220-t0280-for-swap-flag.patch tests-use-wait_for_dev_to_-functions.patch tests-wait_for_-loop.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ parted.spec ++++++ --- /var/tmp/diff_new_pack.i0LWHD/_old 2017-09-15 21:08:52.748143488 +0200 +++ /var/tmp/diff_new_pack.i0LWHD/_new 2017-09-15 21:08:52.752142927 +0200 @@ -79,6 +79,14 @@ Patch51: parted-mkpart-allow-empty-gpt-part-name.patch Patch52: libparted-fix-starting-CHS-in-protective-MBR.patch Patch100: parted-fatresize-autoconf.patch +# Upstream tests patches +Patch150: tests-set-optimal-blocks-for-scsi_debug.patch +Patch151: tests-increase-scsi_debug-tmo.patch +Patch152: tests-use-wait_for_dev_to_-functions.patch +Patch153: tests-wait_for_-loop.patch +Patch154: tests-update-t0220-t0280-for-swap-flag.patch +# SUSE tests patches +Patch200: tests-adapt-to-SUSE.patch BuildRequires: check-devel BuildRequires: device-mapper-devel >= 1.02.33 BuildRequires: e2fsprogs-devel @@ -171,6 +179,12 @@ %patch51 -p1 %patch52 -p1 %patch100 -p1 +%patch150 -p1 +%patch151 -p1 +%patch152 -p1 +%patch153 -p1 +%patch154 -p1 +%patch200 -p1 %build export CFLAGS="%{optflags} `ncursesw6-config --cflags`" ++++++ libparted-partition-naming.patch ++++++ --- /var/tmp/diff_new_pack.i0LWHD/_old 2017-09-15 21:08:52.876125519 +0200 +++ /var/tmp/diff_new_pack.i0LWHD/_new 2017-09-15 21:08:52.880124958 +0200 @@ -1,11 +1,26 @@ +From: Petr Uzel <[email protected]> +Subject: libparted: Change partition naming for SUSE needs +References: bsc#1056508 +Patch-mainline: no, custom SUSE patch + +Device mapper partitions should always use the suffix "-part%d" +for partition names. CPQ arrays and SDMMC devices should always +use the "p%d" suffix. DAC960, ATARAID, and devices with a trailing +number in their name should always use the "_part%d" suffix. +All other devices should use the "%d" suffix. + +YaST depends on this. + +[mwilck: Fixed dm part name in _dm_add_partition(), bsc#1056508] +[sparschauer: Fixed dm part name in _dm_resize_partition(), bsc#1056508] +[sparschauer: Wrote the patch description] +Signed-off-by: Sebastian Parschauer <[email protected]> --- libparted/arch/linux.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -Index: parted-3.2/libparted/arch/linux.c -=================================================================== ---- parted-3.2.orig/libparted/arch/linux.c -+++ parted-3.2/libparted/arch/linux.c +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c @@ -2342,11 +2342,17 @@ _device_get_part_path (PedDevice const * result = zasprintf ("%.*s/part%d", (int) (path_len - 5), devpath, num); @@ -32,7 +47,16 @@ vol_name = zasprintf ("%s%s%d", dev_name, - isdigit (dev_name[name_len - 1]) ? "p" : "", -+ isdigit (dev_name[name_len - 1]) ? "-part" : "", ++ "-part", + part->num); + if (vol_name == NULL) + goto err; +@@ -2870,7 +2876,7 @@ _dm_resize_partition (PedDisk* disk, con + size_t name_len = strlen (dev_name); + vol_name = zasprintf ("%s%s%d", + dev_name, +- isdigit (dev_name[name_len - 1]) ? "p" : "", ++ "-part", part->num); if (vol_name == NULL) goto err; ++++++ tests-adapt-to-SUSE.patch ++++++ From: Sebastian Parschauer <[email protected]> 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 ++++++ tests-increase-scsi_debug-tmo.patch ++++++ From: "Brian C. Lane" <[email protected]> Date: Fri, 24 Feb 2017 11:06:20 -0800 Subject: Increase timeout for rmmod scsi_debug and make it a framework failure For: upstream code Patch-mainline: v3.3 Git-commit: 40e55a0819862d5dbe2098803735f8c48fb30b6d On some hardware scsi_debug can take longer to remove. If this fails it inevitably results in the next test failing since it cannot load scsi_debug. Increse the timeout to 40 loops (8 seconds), and if it hits the limit without succeeding call framework_failure_ Acked-by: Sebastian Parschauer <[email protected]> --- tests/t-local.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/t-local.sh b/tests/t-local.sh index 5655e0f..fb6a7e3 100644 --- a/tests/t-local.sh +++ b/tests/t-local.sh @@ -27,13 +27,14 @@ scsi_debug_cleanup_() # "Module scsi_debug is in use". i=0 udevadm settle - while [ $i -lt 10 ] ; do + while [ $i -lt 40 ] ; do rmmod scsi_debug \ && { test "$VERBOSE" = yes && warn_ $ME_ rmmod scsi_debug...; break; } sleep .2 || sleep 1 i=$((i + 1)) done udevadm settle + test $i = 40 && framework_failure_ rmmod scsi_debug failed. fi rm -fr $scsi_debug_lock_dir_ } ++++++ tests-set-optimal-blocks-for-scsi_debug.patch ++++++ From: "Brian C. Lane" <[email protected]> Date: Tue, 23 Aug 2016 08:55:18 -0700 Subject: tests: Set optimal blocks to 64 for scsi_debug devices For: upstream code Patch-mainline: v3.3 Git-commit: da36186cb4c2c0470a6490aed424a8d51a2b1085 The Linux kernel 4.5 changed the optimal blocks count from 64 to 1024 This causes tests using scsi_debug devices to fail because of alignment issues. Set the opt_blks to 64 so that we have consistent behavior across kernels. Acked-by: Sebastian Parschauer <[email protected]> --- tests/t-local.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/t-local.sh b/tests/t-local.sh index b40a5a0..5655e0f 100644 --- a/tests/t-local.sh +++ b/tests/t-local.sh @@ -97,7 +97,7 @@ scsi_debug_setup_() # It is not trivial to determine the name of the device we're creating. # Record the names of all /sys/block/sd* devices *before* probing: touch stamp - modprobe scsi_debug "$@" || { rm -f stamp; return 1; } + modprobe scsi_debug opt_blks=64 "$@" || { rm -f stamp; return 1; } scsi_debug_modprobe_succeeded_=1 test "$VERBOSE" = yes \ && echo $ME_ modprobe scsi_debug succeeded 1>&2 ++++++ tests-update-t0220-t0280-for-swap-flag.patch ++++++ From: "Brian C. Lane" <[email protected]> Date: Thu, 22 Dec 2016 16:59:27 -0800 Subject: tests: Update t0220 and t0280 for the swap flag. For: libparted-set-swap-flag-on-GPT-partitions.patch For: parted-mkpart-set-a-swap-flag-if-available.patch For: libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch Patch-mainline: v3.3 Git-commit: 5a9a49776ee98ca86cfe123b79bbee2279f93961 Acked-by: Sebastian Parschauer <[email protected]> --- tests/t0220-gpt-msftres.sh | 6 +++++- tests/t0280-gpt-corrupt.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh index 79518ae6b342..6721a470b111 100755 --- a/tests/t0220-gpt-msftres.sh +++ b/tests/t0220-gpt-msftres.sh @@ -56,7 +56,11 @@ printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt::;\n" > exp i=1 for type in $fs_types; do end=$(expr $start + $part_size - 1) - case $type in fat*|NTFS) flag=msftdata;; *) flag=;; esac + case $type in + fat*|NTFS) flag=msftdata;; + linux-swap) flag=swap;; + *) flag=;; + esac echo "$i:${start}s:${end}s:${part_size}s::$type:$flag;" >> exp || fail=1 parted -s $dev mkpart p-name $type ${start}s ${end}s > err 2>&1 || fail=1 compare /dev/null err || fail=1 diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh index a7c8d82291e5..1b4d86b094ea 100755 --- a/tests/t0280-gpt-corrupt.sh +++ b/tests/t0280-gpt-corrupt.sh @@ -89,7 +89,7 @@ compare exp err || fail=1 parted -m -s $dev u s print > out 2>&1 || fail=1 # check for expected output -printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:;\n" > exp || fail=1 +printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:swap;\n" > exp || fail=1 sed "s/.*gpt::;/file/" out > k && mv k out || fail=1 compare exp out || fail=1 ++++++ tests-use-wait_for_dev_to_-functions.patch ++++++ From: "Brian C. Lane" <[email protected]> Date: Fri, 7 Aug 2015 11:43:17 -0700 Subject: tests: Use wait_for_dev_to_ functions For: upstream code Patch-mainline: v3.3 Git-commit: db1728e6402a27fe64e8e132f810c22160ab8bcc Recent changes to udev have made some long-standing problems appear more frequently. udev executes various actions when changes are made to devices. Sometimes this can result in device nodes not appearing immediately. Other times it can result in EBUSY being returned. This patch only addresses devices that are slow to appear/disappear. It is best to use the wait_for_dev_to_appear_ and wait_for_dev_to_disappear_ functions than to test for existance. These will loop and wait for up to 2 seconds for it to appear. This also changes t9041 to fail if mkfs doesn't work since using skip here may hide cases when the device node doesn't appear. [sparschauer: remove hunks for non-existing tests] Signed-off-by: Sebastian Parschauer <[email protected]> --- tests/t1100-busy-label.sh | 10 ++-------- tests/t1102-loop-label.sh | 25 +++++-------------------- tests/t2320-dos-extended-noclobber.sh | 1 + tests/t6001-psep.sh | 4 ++-- tests/t6004-dm-many-partitions.sh | 6 ++---- tests/t6006-dm-512b-sectors.sh | 1 + tests/t6100-mdraid-partitions.sh | 5 +++-- tests/t9041-undetected-in-use-16th-partition.sh | 2 +- 8 files changed, 17 insertions(+), 37 deletions(-) diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh index 4e256d32a010..70e8edec8a60 100755 --- a/tests/t1100-busy-label.sh +++ b/tests/t1100-busy-label.sh @@ -27,22 +27,16 @@ dev=$(cat dev-name) parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1 compare /dev/null out || fail=1 -mkfs.vfat ${dev}1 || skip_ "mkfs.vfat failed" +wait_for_dev_to_appear_ ${dev}1 || fail=1 +mkfs.vfat ${dev}1 || fail=1 mount_point="`pwd`/mnt" # Be sure to unmount upon interrupt, failure, etc. cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } -# There's a race condition here: on udev-based systems, the partition#1 -# device, ${dev}1 (i.e., /dev/sdd1) is not created immediately, and -# without some delay, this mount command would fail. Using a flash card -# as $dev, the loop below typically iterates 7-20 times. - # create mount point dir. and mount the just-created partition on it mkdir $mount_point || fail=1 -i=0; while :; do test -e "${dev}1" && break; test $i = 90 && break; - i=$(expr $i + 1); done; mount "${dev}1" $mount_point || fail=1 # now that a partition is mounted, mklabel attempt must fail diff --git a/tests/t1102-loop-label.sh b/tests/t1102-loop-label.sh index 97520021004d..68b9af45b428 100644 --- a/tests/t1102-loop-label.sh +++ b/tests/t1102-loop-label.sh @@ -44,15 +44,9 @@ mv out o2 && sed -e "s,$dev,DEVICE,;s/ *$//" o2 > out compare exp out || fail=1 parted -s $dev rm 1 || fail=1 -if [ -e ${dev}1 ]; then - echo "Partition should not exist on loop device" - fail=1 -fi +wait_for_dev_to_disappear_ ${dev}1 2 || fail=1 partprobe $dev || fail=1 -if [ -e ${dev}1 ]; then - echo "Partition should not exist on loop device" - fail=1 -fi +wait_for_dev_to_disappear_ ${dev}1 2 || fail=1 mount_point="`pwd`/mnt" @@ -80,24 +74,15 @@ umount "$mount_point" # make sure partprobe cleans up stale partition devices parted -s $dev mklabel msdos mkpart primary ext2 0% 100% || fail=1 -if [ ! -e ${dev}1 ]; then - echo "Partition doesn't exist on loop device" - fail=1 -fi +wait_for_dev_to_appear_ ${dev}1 || fail=1 mke2fs -F $dev partprobe $dev || fail=1 -if [ -e ${dev}1 ]; then - echo "Partition should not exist on loop device" - fail=1 -fi +wait_for_dev_to_disappear_ ${dev}1 2 || fail=1 # make sure new loop label removes old partitions > 1 parted -s $dev mklabel msdos mkpart primary ext2 0% 50% mkpart primary ext2 50% 100% || fail=1 parted -s $dev mklabel loop || fail=1 -if [ -e ${dev}2 ]; then - echo "Partition 2 not removed" - fail=1 -fi +wait_for_dev_to_disappear_ ${dev}2 2 || fail=1 Exit $fail diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh index f15090abb3e7..4c758e8fbc73 100644 --- a/tests/t6001-psep.sh +++ b/tests/t6001-psep.sh @@ -54,7 +54,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 compare /dev/null out || fail=1 #make sure device name is correct -test -e ${dev}p1 || fail=1 +wait_for_dev_to_appear_ ${dev}p1 || fail=1 #repeat on name not ending in a digit # setup: create a mapping @@ -66,7 +66,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 compare /dev/null out || fail=1 #make sure device name is correct -test -e ${dev}1 || fail=1 +wait_for_dev_to_appear_ ${dev}1 || fail=1 if [ -n "$fail" ]; then ls /dev/mapper diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh index 8d291ef55664..7ebc48a18db8 100755 --- a/tests/t6004-dm-many-partitions.sh +++ b/tests/t6004-dm-many-partitions.sh @@ -49,10 +49,8 @@ parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fa # Make sure all the partitions appeared under /dev/mapper/ for ((i=1; i<=$n_partitions; i+=1)); do - if [ ! -e "/dev/mapper/${dm_name}p$i" ]; then - fail=1 - break - fi + wait_for_dev_to_appear_ "/dev/mapper/${dm_name}p$i" || { fail=1; break; } + # remove the partitions as we go, otherwise cleanup won't work. dmsetup remove /dev/mapper/${dm_name}p$i done diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh index 6f08442dd66d..dbc5986b9019 100755 --- a/tests/t6100-mdraid-partitions.sh +++ b/tests/t6100-mdraid-partitions.sh @@ -54,13 +54,14 @@ parted -s $md_dev mklabel gpt \ compare /dev/null out || fail=1 # Verify that kernel has been informed about the second device. -grep "${md_name}p2" /proc/partitions || { fail=1; cat /proc/partitions; } +wait_for_dev_to_appear_ ${md_dev}p2 || { fail=1; cat /proc/partitions; } # Remove partitions from the raid device. parted -s $md_dev rm 2 rm 1 > out 2>&1 || fail=1 compare /dev/null out || fail=1 # Verify that kernel has been informed about those removals. -grep "${md_name}p[12]" /proc/partitions && { fail=1; cat /proc/partitions; } +wait_for_dev_to_disappear_ ${md_dev}p1 2 || { fail=1; cat /proc/partitions; } +wait_for_dev_to_disappear_ ${md_dev}p2 2 || { fail=1; cat /proc/partitions; } Exit $fail diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh index edaae1bf8116..673e508319a3 100644 --- a/tests/t9041-undetected-in-use-16th-partition.sh +++ b/tests/t9041-undetected-in-use-16th-partition.sh @@ -72,7 +72,7 @@ wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear partitions="${scsi_dev}14 ${scsi_dev}15 ${scsi_dev}16" for i in $partitions; do - mkfs.ext3 $i || skip_ mkfs.ext3 $i failed + mkfs.ext3 $i || fail=1 done # be sure to unmount upon interrupt, failure, etc. ++++++ tests-wait_for_-loop.patch ++++++ From: "Brian C. Lane" <[email protected]> Date: Tue, 1 Mar 2016 10:38:26 -0800 Subject: tests: Add udevadm settle to wait_for_ loop (#1260664) For: upstream code Patch-mainline: v3.3 Git-commit: f5cc84cdb5a607449c339cad50fe8be5dd77eb6c Sometimes the device will vanish after the wait_for_dev_to_appear exits. Add udevadm settle in an attempt to make sure the udev system is done flapping around and the device will stay in place. Related: rhbz#1260664 Acked-by: Sebastian Parschauer <[email protected]> --- tests/t-lib-helpers.sh | 2 ++ tests/t-local.sh | 2 ++ tests/t6001-psep.sh | 2 ++ tests/t6004-dm-many-partitions.sh | 1 + tests/t6005-dm-uuid.sh | 2 ++ tests/t6100-mdraid-partitions.sh | 1 + 6 files changed, 10 insertions(+) diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh index c8684bbd264e..93123432922b 100644 --- a/tests/t-lib-helpers.sh +++ b/tests/t-lib-helpers.sh @@ -377,6 +377,7 @@ wait_for_dev_to_appear_() local i=0 local incr=1 while :; do + udevadm settle ls "$file" > /dev/null 2>&1 && return 0 sleep .1 2>/dev/null || { sleep 1; incr=10; } i=$(expr $i + $incr); test $i = 20 && break @@ -392,6 +393,7 @@ wait_for_dev_to_disappear_() local i=0 local incr=1 while :; do + udevadm settle ls "$file" > /dev/null 2>&1 || return 0 sleep .1 2>/dev/null || { sleep 1; incr=10; } i=$(expr $i + $incr); test $i -ge $(expr $n_sec \* 10) && break diff --git a/tests/t-local.sh b/tests/t-local.sh index b40a5a0ebbf5..a7d5226a3956 100644 --- a/tests/t-local.sh +++ b/tests/t-local.sh @@ -47,6 +47,7 @@ wait_for_dev_to_appear_() local i=0 local incr=1 while :; do + udevadm settle ls "$file" > /dev/null 2>&1 && return 0 sleep .1 2>/dev/null || { sleep 1; incr=10; } i=$(expr $i + $incr); test $i = 20 && break @@ -110,6 +111,7 @@ scsi_debug_setup_() local i=0 local new_dev while :; do + udevadm settle new_dev=$(new_sdX_) && break sleep .1 2>/dev/null || { sleep 1; incr=10; } i=$(expr $i + $incr); test $i = 20 && break diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh index 4c758e8fbc73..2985cf5e7d0e 100644 --- a/tests/t6001-psep.sh +++ b/tests/t6001-psep.sh @@ -19,6 +19,8 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../parted require_root_ +require_udevadm_settle_ + (dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" # Device maps names - should be random to not conflict with existing ones on diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh index 7ebc48a18db8..01d7fc0da8f3 100755 --- a/tests/t6004-dm-many-partitions.sh +++ b/tests/t6004-dm-many-partitions.sh @@ -20,6 +20,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../parted require_root_ +require_udevadm_settle_ (dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ss=$sector_size_ diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh index ce1251a9f16a..a48ae727f940 100755 --- a/tests/t6005-dm-uuid.sh +++ b/tests/t6005-dm-uuid.sh @@ -20,6 +20,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../parted require_root_ +require_udevadm_settle_ (dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ss=$sector_size_ @@ -46,6 +47,7 @@ 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 # Make sure all the partitions have UUIDs for ((i=1; i<=$n_partitions; i+=1)); do diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh index dbc5986b9019..dbb16861f9f3 100755 --- a/tests/t6100-mdraid-partitions.sh +++ b/tests/t6100-mdraid-partitions.sh @@ -38,6 +38,7 @@ parted -s "$scsi_dev" mklabel gpt \ mkpart p1 ext2 1M 4M \ mkpart p2 ext2 5M 8M > out 2>&1 || fail=1 compare /dev/null out || fail=1 +wait_for_dev_to_appear_ ${scsi_dev}2 || { fail=1; cat /proc/partitions; } cleanup_fn_() { # stop mdraid array
