OSDN Git Service

tests: use "compare exp out", not "compare out exp"
authorJim Meyering <meyering@redhat.com>
Tue, 29 Nov 2011 17:05:31 +0000 (18:05 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 29 Nov 2011 17:06:07 +0000 (18:06 +0100)
Likewise, when an empty file is expected, use "compare /dev/null out",
not "compare out /dev/null". I.e., specify the expected/desired contents
via the first file name.  Prompted by a suggestion from Bruno Haible
in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154

Run these commands:

    git grep -l -E 'compare [^ ]+ exp' \
      |xargs perl -pi -e 's/\b(compare) (\S+) (exp\S*)/$1 $3 $2/'
    git grep -l -E 'compare [^ ]+ /dev/null' \
      |xargs perl -pi -e 's,\b(compare) (\S+) (/dev/null),$1 $3 $2,'

43 files changed:
tests/t0000-basic.sh
tests/t0001-tiny.sh
tests/t0010-script-no-ctrl-chars.sh
tests/t0100-print.sh
tests/t0101-print-empty.sh
tests/t0200-gpt.sh
tests/t0201-gpt.sh
tests/t0202-gpt-pmbr.sh
tests/t0203-gpt-tiny-device-abort.sh
tests/t0207-IEC-binary-notation.sh
tests/t0208-mkpart-end-in-IEC.sh
tests/t0210-gpt-resized-partition-entry-array.sh
tests/t0220-gpt-msftres.sh
tests/t0300-dos-on-gpt.sh
tests/t0400-loop-clobber-infloop.sh
tests/t1100-busy-label.sh
tests/t1101-busy-partition.sh
tests/t2200-dos-label-recog.sh
tests/t2201-pc98-label-recog.sh
tests/t2300-dos-label-extended-bootcode.sh
tests/t2310-dos-extended-2-sector-min-offset.sh
tests/t2400-dos-hfs-partition-type.sh
tests/t2500-probe-corrupt-hfs.sh
tests/t3300-palo-prep.sh
tests/t3310-flags.sh
tests/t3400-whole-disk-FAT-partition.sh
tests/t4000-sun-raid-type.sh
tests/t4001-sun-vtoc.sh
tests/t4100-dvh-partition-limits.sh
tests/t4100-msdos-partition-limits.sh
tests/t4100-msdos-starting-sector.sh
tests/t4200-partprobe.sh
tests/t6000-dm.sh
tests/t8000-loop.sh
tests/t8001-loop-blkpg.sh
tests/t9010-big-sector.sh
tests/t9020-alignment.sh
tests/t9021-maxima.sh
tests/t9022-one-unit-snap.sh
tests/t9023-value-lt-one.sh
tests/t9030-align-check.sh
tests/t9040-many-partitions.sh
tests/t9041-undetected-in-use-16th-partition.sh

index d07177e..f28d15f 100755 (executable)
@@ -32,7 +32,7 @@ dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null || fail=1
 
 # run parted -s FILE mklabel msdos
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # ----------------------------------------------
 # Now, ensure that a simple mklabel command succeeds.
@@ -49,7 +49,7 @@ parted $dev mklabel msdos > out 2>&1 || fail=1
 emit_superuser_warning > exp || fail=1
 
 # check its "interactive" output
-compare out exp || fail=1
+compare exp out || fail=1
 
 # create interactive input
 printf 'y\n' > in || fail=1
@@ -73,6 +73,6 @@ Yes/No? y
 EOF
 
 # check its output -- slightly different here, due to prompts
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index c6434e4..af852e6 100755 (executable)
@@ -37,7 +37,7 @@ for opt in '' -s; do
   # When run as root, there are just curses-related control chars. Remove them.
   sed 's/^.\{1,12\}$//;/^$/d' out > k && mv k out \
       || fail=1
-  compare out /dev/null || fail=1
+  compare /dev/null out || fail=1
 
   parted -s $dev p || fail=1
   rm -f $dev
index 49b3ff1..9c1b104 100755 (executable)
@@ -26,7 +26,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # print partition table in --script mode
 TERM=xterm parted -m -s $dev u s p > out 2>&1 || fail=1
@@ -34,6 +34,6 @@ TERM=xterm parted -m -s $dev u s p > out 2>&1 || fail=1
 sed "s,.*/$dev:,$dev:," out > k && mv k out || fail=1
 printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos:;\n" > exp || fail=1
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index d09b8ed..7b6bee5 100755 (executable)
@@ -53,6 +53,6 @@ parted -s $dev unit s print >out 2>&1 || fail=1
 mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:," o2 > out || fail=1
 
 # check for expected output
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index b8ff5ed..26d8da0 100755 (executable)
@@ -42,6 +42,6 @@ mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:,; \
                   s,^Error: .*/$dev:,Error: .../$dev:," o2 > out || fail=1
 
 # check for expected output
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 5326532..598324d 100755 (executable)
@@ -26,7 +26,7 @@ dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
 # create a GPT partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # save a copy of the original primary GPT table
 dd if=$dev of=before count=1 skip=1 || fail=1
@@ -38,7 +38,7 @@ printf x >> $dev || fail=1
 parted -m -s $dev u s p > out 2> err || fail=1
 # don't bother comparing stdout
 # expect no stderr
-compare err /dev/null || fail=1
+compare /dev/null err || fail=1
 
 # extract the primary GPT table again
 dd if=$dev of=after count=1 skip=1 || fail=1
index 60f284e..f282250 100755 (executable)
@@ -26,7 +26,7 @@ dd if=/dev/null of=$dev seek=4001 2> /dev/null || fail=1
 # create a GPT partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # shrink the backing file
 dd if=/dev/null of=$dev seek=4000 2> /dev/null || fail=1
@@ -34,6 +34,6 @@ dd if=/dev/null of=$dev seek=4000 2> /dev/null || fail=1
 # create a new GPT table on top of the shrunken backing file
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 Exit $fail
index d8973bb..9e003dd 100755 (executable)
@@ -26,7 +26,7 @@ dd if=/dev/null of=$dev bs=1 seek=1M || framework_failure
 # create a GPT partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # Fill the first $bootcode_size bytes with 0's.
 # This affects only the protective MBR, so doesn't affect validity of gpt table.
@@ -38,7 +38,7 @@ parted -s $dev p || fail=1
 # create a GPT partition table on top of the existing one.
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # Extract the first $bootcode_size Bytes after GPT creation
 dd if=$dev of=after bs=1c count=$bootcode_size > /dev/null 2>&1 || fail=1
index 694bc9a..16b040c 100644 (file)
@@ -27,7 +27,7 @@ dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
 # create a GPT partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # truncate it to 34 sectors.
 for i in 33 34 35 67 68 69 101 102 103; do
index 343b8c1..b85ca65 100644 (file)
@@ -25,16 +25,16 @@ dev=dev-file
 dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 parted --align=none -s $dev mklabel gpt mkpart p1 $((64*1024))B $((1024*1024-$ss))B \
     > err 2>&1 || fail=1
-compare err /dev/null || fail=1
+compare /dev/null err || fail=1
 parted -m -s $dev u s p > exp || fail=1
 
 rm $dev
 dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1MiB \
     > err 2>&1 || fail=1
-compare err /dev/null || fail=1
+compare /dev/null err || fail=1
 parted -m -s $dev u s p > out || fail=1
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 475190b..f58d3eb 100644 (file)
@@ -26,22 +26,22 @@ dev=dev-file
 dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
 # create 1st partition
 parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2MiB > err 2>&1 || fail=1
-compare err /dev/null || fail=1  # expect no output
+compare /dev/null err || fail=1  # expect no output
 #parted -m -s $dev u s p > exp || fail=1
 
 # create 2nd partition - they should not overlap
 # this time specify default unit
 parted --align=none -s $dev unit MiB mkpart p2 2 3 > err 2>&1 || fail=1
-compare err /dev/null || fail=1  # expect no output
+compare /dev/null err || fail=1  # expect no output
 
 # create 3rd partition - expect no overlap
 # specify default unit, but explicitly override it
 parted --align=none -s $dev unit TB mkpart p3 3MiB 4MiB > err 2>&1 || fail=1
-compare err /dev/null || fail=1  # expect no output
+compare /dev/null err || fail=1  # expect no output
 
 # Specify default unit of MiB, yet use explicit ending sector number.
 parted --align=none -s $dev unit MiB mkpart p4 4MiB 10239s > err 2>&1 || fail=1
-compare err /dev/null || fail=1  # expect no output
+compare /dev/null err || fail=1  # expect no output
 
 # check boundaries of the partitions
 parted -m -s $dev u s p > out || fail=1
@@ -56,6 +56,6 @@ EOF
 
 # compare expected and actual outputs
 sed -e "1,2d" out > k; mv k out
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 7c8b57f..64e3d3a 100755 (executable)
@@ -29,13 +29,13 @@ dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
 # create a GPT partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 gpt-header-munge --sector-size=$ss --n=9 $dev || fail=1
 
 parted -m -s $dev u s p > out 2>&1 || fail=1
 sed 's/.*:gpt:/:gpt:/' out > k && mv k out
 printf 'BYT;\n:gpt:;\n' > exp || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 1247ee0..240383b 100755 (executable)
@@ -50,7 +50,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 # create a gpt partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt:;\n" > exp
 i=1
@@ -58,9 +58,9 @@ for type in $fs_types; do
   end=$(expr $start + $part_size - 1)
   echo "$i:${start}s:${end}s:${part_size}s::$type:;" >> exp || fail=1
   parted -s $dev mkpart primary $type ${start}s ${end}s > err 2>&1 || fail=1
-  compare err /dev/null || fail=1
+  compare /dev/null err || fail=1
   parted -s $dev name $i $type > err 2>&1 || fail=1
-  compare err /dev/null || fail=1
+  compare /dev/null err || fail=1
   start=$(expr $end + 1)
   i=$(expr $i + 1)
 done
@@ -70,6 +70,6 @@ parted -m -s $dev u s p > out 2>&1 || fail=1
 
 sed "s,.*/$dev:,$dev:," out > k && mv k out && ok=1 || ok=0
 # match against expected output
-test $ok = 1 && { compare out exp || fail=1; }
+test $ok = 1 && { compare exp out || fail=1; }
 
 Exit $fail
index 4b5d426..f3689f0 100755 (executable)
@@ -28,11 +28,11 @@ dd if=/dev/null of=$dev seek=4001 2> /dev/null || framework_failure
 # create a GPT partition table
 parted -s $dev mklabel gpt > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # create a DOS partition table on top of it
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 Exit $fail
index a7bf7a2..bf5dba5 100644 (file)
@@ -30,6 +30,6 @@ mkswap $dev || fail=1
 # create a dos partition table
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
 
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 Exit $fail
index b88adaa..18b220f 100755 (executable)
@@ -26,7 +26,7 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=90 > dev-name ||
 dev=$(cat dev-name)
 
 parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 mkfs.vfat ${dev}1 || skip_ "mkfs.vfat failed"
 
 mount_point="`pwd`/mnt"
@@ -50,12 +50,12 @@ parted -s "$dev" mklabel msdos > out 2>&1; test $? = 1 || fail=1
 
 # create expected output file
 echo "Error: Partition(s) on $dev are being used." > exp
-compare out exp || fail=1
+compare exp out || fail=1
 
 # Adding a partition must succeed, even though another
 # on this same device is mounted (active).
 parted -s "$dev" mkpart primary fat32 41 85 > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 parted -s "$dev" u s print
 
 # ==================================================
@@ -78,6 +78,6 @@ mv out o2 && sed -e 's,\r   *\r,,g;s, $,,;s/^.*Warning/Warning/' \
                  -e 's,^.*/lt-parted: ,parted: ,' o2 > out
 
 # check for expected failure diagnostic
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 116d326..ea8a5db 100755 (executable)
@@ -35,13 +35,13 @@ EOF
 parted -s "$dev" mklabel msdos > out 2>&1 || fail=1
 
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 parted -s "$dev" mkpart primary fat32 1 40 > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 parted -s "$dev" mkpart primary fat32 40 80 > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # wait for new partition device to appear
 wait_for_dev_to_appear_ ${dev}2 || fail_ ${dev}2 did not appear
@@ -63,6 +63,6 @@ parted -s "$dev" rm 1 > out 2>&1 || fail=1
 parted -s "$dev" rm 2 > out 2>&1 && fail=1
 
 # expect error
-compare out exp-error || fail=1
+compare exp-error out || fail=1
 
 Exit $fail
index f62e2ad..0e95956 100755 (executable)
@@ -32,12 +32,12 @@ dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null || fail=1
 
 # label the test disk
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # expect no output
+compare /dev/null out || fail=1 # expect no output
 
 # create two partitions
 parted -s $dev mkpart primary 2048s 4095s \
                mkpart primary 4096s 8191s > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # expect no output
+compare /dev/null out || fail=1 # expect no output
 
 # write "FAT" where it would cause trouble
 printf FAT | dd bs=1c seek=82 count=3 of=$dev conv=notrunc || fail=1
@@ -47,6 +47,6 @@ 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
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 6228159..1f7e8cf 100755 (executable)
@@ -29,7 +29,7 @@ dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null || fail=1
 
 # label the test disk
 parted -s $dev mklabel pc98 > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # expect no output
+compare /dev/null out || fail=1 # expect no output
 
 parted -s $dev p | grep "^Partition Table: pc98" || fail=1
 
index dcb9790..909d470 100755 (executable)
@@ -28,15 +28,15 @@ dd if=/dev/zero of=$dev bs=1M count=4 || fail=1
 
 # Create msdos label
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # Expect no output
+compare /dev/null out || fail=1 # Expect no output
 
 # Create extended partition
 parted -s $dev mkpart extended 2048s 8191s > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # Expect no output
+compare /dev/null out || fail=1 # Expect no output
 
 # Create logical partition
 parted -s $dev mkpart logical 4096s 8191s > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # Expect no output
+compare /dev/null out || fail=1 # Expect no output
 
 # Install fake bootcode
 printf %0${bootcode_size}d 0 > in || fail=1
@@ -48,7 +48,7 @@ dd if=$dev of=before bs=1 skip=1M count=$bootcode_size || fail=1
 
 # Do something to the label
 parted -s $dev rm 5 > out 2>&1 || fail=1
-compare out /dev/null || fail=1 # Expect no output
+compare /dev/null out || fail=1 # Expect no output
 
 # Extract the bootcode for comparison
 dd if=$dev of=after bs=1 skip=1M count=$bootcode_size || fail=1
index b86c6bc..aa05099 100644 (file)
@@ -47,7 +47,7 @@ EOF
 parted -s $scsi_dev mklabel msdos || fail=1
 parted --align=min -s $scsi_dev mkpart extended 64s 128s> out 2>&1 || fail=1
 parted -m -s $scsi_dev u s print
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # Provoke a failure by trying to create a partition that starts just
 # one sector after the start of the extended partition.
@@ -58,9 +58,9 @@ compare err err.exp || fail=1
 parted -s $scsi_dev rm 5 || fail=1
 
 parted --align=min -s $scsi_dev mkpart logical 66s 128s > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 parted -m -s $scsi_dev u s print > out 2>&1
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 38aee81..af14180 100644 (file)
@@ -29,12 +29,12 @@ parted -s $dev mklabel msdos \
   mkpart pri hfs  2048s 4095s \
   mkpart pri hfs+ 4096s 6143s > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # Extract the "type" byte of the first partition.
 od -An -j450 -tx1 -N1 $dev  > out || fail=1
 od -An -j466 -tx1 -N1 $dev >> out || fail=1
 printf ' af\n af\n' > exp || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 435af9f..67d0287 100755 (executable)
@@ -25,7 +25,7 @@ dev=loop-file
 dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
 
 parted -s "$dev" mklabel gpt mkpart p1 1MiB 2MiB > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 parted -s "$dev" u s p || fail=1
 
index 21ebc9b..ab75807 100755 (executable)
@@ -39,6 +39,6 @@ parted -m -s $dev mklabel msdos \
 
 grep -E '^1:2048s:4095s:2048s:::p...;$' out > k; mv k out
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 350485c..e3878a1 100644 (file)
@@ -43,7 +43,7 @@ for table_type in msdos gpt; do
   parted -s $dev mklabel $table_type \
     mkpart $pri_or_name ext2 $((1*2048))s $((2*2048-1))s \
       > out 2> err || fail=1
-  compare out /dev/null || fail=1
+  compare /dev/null out || fail=1
 
   for mode in on_only on_and_off ; do
     for flag in $flags; do
@@ -57,7 +57,7 @@ for table_type in msdos gpt; do
       extract_flags raw > out
       grep -F "$flag" out \
         || { warn_ "$ME: flag not turned on: $(cat out)"; fail=1; }
-      compare err /dev/null || fail=1
+      compare /dev/null err || fail=1
 
       if test $mode = on_and_off; then
         # Turn it off
@@ -65,7 +65,7 @@ for table_type in msdos gpt; do
         extract_flags raw > out
         grep -F "$flag" out \
           && { warn_ "$ME: flag not turned off: $(cat out)"; fail=1; }
-        compare err /dev/null || fail=1
+        compare /dev/null err || fail=1
       fi
     done
   done
index 98b4309..e7d28e0 100755 (executable)
@@ -27,6 +27,6 @@ mkfs.vfat -F 16 $dev_file || skip_ "mkfs.vfat failed"
 
 parted -m -s $dev_file u s print > out 2>&1 || fail=1
 grep '^1:' out > k; mv k out
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 91a9f63..9081f57 100755 (executable)
@@ -30,11 +30,11 @@ dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
 
 # label the test disk as a sun disk
 parted -s $dev mklabel sun > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # create a single partition
 parted -s $dev unit s mkpart ext2 0s 127s > out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # print the partition data in machine readable format
 parted -m -s $dev unit s p > out 2>&1 || fail=1
@@ -42,11 +42,11 @@ sed "s,^.*/$dev:,---:," out > k && mv k out
 
 # check for expected values for the partition
 printf "$exp:::;\n" > exp || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 # set the raid flag
 parted -s $dev set 1 raid >out 2>&1 || fail=1
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # print the partition data in machine readable format again
 parted -m -s $dev unit s p > out 2>&1 || fail=1
@@ -54,6 +54,6 @@ sed "s,^.*/$dev:,---:," out > k && mv k out || fail=1
 
 # check for expected values (including raid flag) for the partition
 printf "$exp:::raid;\n" > exp || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 0d07296..b6ea922 100755 (executable)
@@ -28,25 +28,25 @@ dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
 # label the test disk
 parted -s $dev mklabel sun > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # extract version
 od -t x1 -An -j128 -N4 $dev > out || fail=1
 echo " 00 00 00 01" > exp || fail=1
 # expect it to be 00 00 00 01, not 00 00 00 00
-compare out exp || fail=1
+compare exp out || fail=1
 
 # extract nparts
 od -t x1 -An -j140 -N2 $dev > out || fail=1
 echo " 00 08" > exp || fail=1
 
 # expect it to be 00 08, not 00 00
-compare out exp || fail=1
+compare exp out || fail=1
 
 # extract sanity magic
 od -t x1 -An -j188 -N4 $dev > out || fail=1
 echo " 60 0d de ee" > exp
 # expect it to be 60 0d de ee, not 00 00 00 00
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index b57a1c3..c3c4017 100755 (executable)
@@ -82,7 +82,7 @@ do_mkpart $n $end || fail=1
 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
-compare out exp || fail=1
+compare exp out || fail=1
 
 # a partition length of exactly 2^32 sectors provokes failure.
 do_mkpart $n $(echo $n+2^32-1|bc) > err 2>&1
@@ -94,7 +94,7 @@ bad_part_length()
 
 # check for new diagnostic
 bad_part_length 4294967296 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 # FIXME: investigate this.
 # Unexpectedly to me, both of these failed with this same diagnostic:
@@ -113,7 +113,7 @@ test $? = 1 || fail=1
 
 # check for new diagnostic
 bad_part_length 4294967297 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 # =========================================================
 # Now consider partition starting sector numbers.
@@ -142,7 +142,7 @@ EOF
 # print the result
 parted -s $dev unit s p > out 2>&1 || fail=1
 sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 # a partition start sector number of 2^32 must fail
 do_mkpart_start_and_len $(echo 2^32|bc) 1000 > err 2>&1
@@ -150,7 +150,7 @@ test $? = 1 || fail=1
 
 # check for new diagnostic
 bad_start_sector 4294967296 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 # a partition start sector number of 2^32+1 must fail, too.
 do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1
@@ -158,7 +158,7 @@ test $? = 1 || fail=1
 
 # check for new diagnostic
 bad_start_sector 4294967297 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 done
 
index 4ec3c27..40aa925 100755 (executable)
@@ -83,7 +83,7 @@ do_mkpart $n $end || fail=1
 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
-compare out exp || fail=1
+compare exp out || fail=1
 
 # a partition length of exactly 2^32 sectors provokes failure.
 do_mkpart $n $(echo $n+2^32-1|bc) > err 2>&1
@@ -95,7 +95,7 @@ bad_part_length()
 
 # check for new diagnostic
 bad_part_length 4294967296 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 # a partition length of 2^32+1 sectors must provoke failure.
 do_mkpart $n $(echo $n+2^32|bc) > err 2>&1
@@ -103,7 +103,7 @@ test $? = 1 || fail=1
 
 # check for new diagnostic
 bad_part_length 4294967297 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 # =========================================================
 # Now consider partition starting sector numbers.
@@ -128,7 +128,7 @@ EOF
 # print the result
 parted -s $dev unit s p > out 2>&1 || fail=1
 sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out  || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 # a partition start sector number of 2^32 must fail
 do_mkpart_start_and_len $(echo 2^32|bc) 1000 > err 2>&1
@@ -136,7 +136,7 @@ test $? = 1 || fail=1
 
 # check for new diagnostic
 bad_start_sector 4294967296 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 # a partition start sector number of 2^32+1 must fail, too.
 do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1
@@ -144,7 +144,7 @@ test $? = 1 || fail=1
 
 # check for new diagnostic
 bad_start_sector 4294967297 > exp || fail=1
-compare err exp || fail=1
+compare exp err || fail=1
 
 done
 
index f768646..a636f21 100755 (executable)
@@ -33,7 +33,7 @@ dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
 # label the test disk
 parted -s $dev mklabel msdos > out 2>&1 || fail=1
 # expect no output
-compare out /dev/null || fail=1
+compare /dev/null out || fail=1
 
 # Test the output of print free with no partitions.
 cat <<EOF > exp || fail=1
@@ -49,7 +49,7 @@ parted -m -s $dev unit s print free > out 2>&1 || fail=1
 
 # check for expected output
 sed "2s/^[^:]*:/path:/" < out > k; mv k out
-compare out exp || fail=1
+compare exp out || fail=1
 
 # Test the output of print free with one partition.
 cat <<EOF > exp || fail=1
@@ -67,6 +67,6 @@ parted -m -s $dev unit s print free > out 2>&1 || fail=1
 
 # check for expected output
 sed "2s/^[^:]*:/path:/" < out > k; mv k out
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index bd5e15d..88d3c98 100755 (executable)
@@ -44,8 +44,8 @@ grep "^17:.*::data:;\$" out || fail=1
 # Parted 1.8.9 and earlier would mistakenly try to access partition #17.
 # ensure that partprobe succeeds and produces no output"
 partprobe -s $dev > out 2>err || fail=1
-compare err /dev/null || fail=1
+compare /dev/null err || fail=1
 echo "$dev: dvh partitions 9 <17>" > exp || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 03586c7..a6dc36d 100755 (executable)
@@ -69,7 +69,7 @@ for type in linear ; do
 
   # Create msdos partition table
   parted -s $dev mklabel msdos > out 2>&1 || fail=1
-  compare out /dev/null || fail=1
+  compare /dev/null out || fail=1
 
   parted -s "$dev" print > out 2>&1 || fail=1
   sed 's/^Disk .*: /Disk DEV: /' out > k; mv k out
@@ -85,7 +85,7 @@ Number  Start  End  Size  Type  File system  Flags
 
 EOF
 
-  compare out exp || fail=1
+  compare exp out || fail=1
 done
 
 Exit $fail
index 1eb1207..f7774b2 100755 (executable)
@@ -33,10 +33,10 @@ f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \
 
 # Expect this to succeed.
 parted -s $d1 mklabel msdos > err 2>&1 || fail=1
-compare err /dev/null || fail=1     # expect no output
+compare /dev/null err || fail=1     # expect no output
 
 # Create a partition
 parted -s $d1 mkpart primary 1 10 > err 2>&1 || fail=1
-compare err /dev/null || fail=1     # expect no output
+compare /dev/null err || fail=1     # expect no output
 
 Exit $fail
index 08d8f47..20bbdf5 100755 (executable)
@@ -43,7 +43,7 @@ test -z "$loopdev" && fail=1
 
 # Expect this to succeed
 parted -s "$loopdev" mklabel msdos > err 2>&1 || fail=1
-compare err /dev/null || fail=1     # expect no output
+compare /dev/null err || fail=1     # expect no output
 
 # Create a partition
 parted -s "$loopdev" mkpart primary 1M 2M > err 2>&1 || fail=1
index 7122a14..dbfb6ac 100755 (executable)
@@ -36,6 +36,6 @@ parted -s $scsi_dev mklabel gpt print > out 2>&1 || fail=1
 grep '^Sector' out > k 2>&1 || fail=1
 mv k out || fail=1
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 4b5a888..d9f3015 100755 (executable)
@@ -38,6 +38,6 @@ scsi_dev=$(cat dev-name)
 # print alignment info
 "$abs_srcdir/print-align" $scsi_dev > out 2>&1 || fail=1
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 0612c48..02615e0 100755 (executable)
@@ -42,7 +42,7 @@ for t in msdos gpt dvh sun mac bsd amiga loop pc98; do
     print-max $dev > out 2>&1 || fail=1
     printf '%s\n' "max len: $max_len" \
        "max start sector: $max_start" > exp || fail=1
-    compare out exp || fail=1
+    compare exp out || fail=1
 done
 
 Exit $fail
index ce903a5..52a0b57 100644 (file)
@@ -27,16 +27,16 @@ dev=dev-file
 dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 parted --align=none -s $dev mklabel msdos mkpart pri 1s $((1000*1000))B \
     > err 2>&1 || fail=1
-compare err /dev/null || fail=1
+compare /dev/null err || fail=1
 parted -m -s $dev u s p > exp || fail=1
 
 rm $dev
 dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 parted --align=none -s $dev mklabel msdos mkpart pri 0 1MB \
     > err 2>&1 || fail=1
-compare err /dev/null || fail=1
+compare /dev/null err || fail=1
 parted -m -s $dev u s p > out || fail=1
 
-compare out exp || fail=1
+compare exp out || fail=1
 
 Exit $fail
index 67be8d6..96ba24f 100644 (file)
@@ -27,6 +27,6 @@ echo 'Error: Use a smaller unit instead of a value < 1' > exp
 dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
 parted --align=none -s $dev mklabel msdos mkpart pri 0 0.5MB \
     > err 2>&1
-compare err exp || fail=1
+compare exp err || fail=1
 
 Exit $fail
index ac80137..6597ebe 100644 (file)
@@ -42,7 +42,7 @@ while :; do
 
   test $(expr $i % 8) = 7 && exp_result=0 || exp_result=1
   test $result = $exp_result || fail=1
-  compare out /dev/null || fail=1
+  compare /dev/null out || fail=1
 
   parted -s $scsi_dev rm 1
   i=$(expr $i + 1)
index 1282c1f..92e1781 100644 (file)
@@ -66,7 +66,7 @@ $AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\
     || fail=1
 
 parted -m -s $scsi_dev u s p > out || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 # We must remove these partitions before terminating.
 # Otherwise, even though cleanup-driven rmmod will eventually cause
index 74c30fc..7b36c8f 100644 (file)
@@ -66,7 +66,7 @@ $AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\
     || fail=1
 
 parted -m -s $scsi_dev u s p > out || fail=1
-compare out exp || fail=1
+compare exp out || fail=1
 
 wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear
 
@@ -92,7 +92,7 @@ for part_dev in $partitions; do
     > exp-error || framework_failure_
 
   # expect error
-  compare out exp-error || fail=1
+  compare exp-error out || fail=1
 
 done