]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: never use -o pipefail
authorRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 21 Apr 2015 08:41:01 +0000 (10:41 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 21 Apr 2015 12:58:30 +0000 (14:58 +0200)
It was hard to find out that pipefail was the reason why our
test-suite could have random failures for aribtrary tests,
for example the ones which are using ts_device_has_uuid() or
ts_mount().

Bash's pipefall option is evil! It may return error for such a
simple line like this one
$ echo -e "xxx\nyyy" | grep -q "xxx"
because the left echo command will get SIGPIPE when grep exits after
the first match. So the command line above could return an error
eventhough it does exactly what we want.

This patch removes any pipefail from our tests. The funny thing is
that I couldn't find any case where we relied on this feature anyway.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
48 files changed:
tests/ts/blkdiscard/offsets
tests/ts/blkid/md-raid0-whole
tests/ts/blkid/md-raid1-whole
tests/ts/cal/1m
tests/ts/cal/1mw
tests/ts/cal/3m
tests/ts/cal/3mw
tests/ts/cal/bigyear
tests/ts/cal/bigyearw
tests/ts/cal/color
tests/ts/cal/colorw
tests/ts/cal/sep1752
tests/ts/cal/sep1752w
tests/ts/cal/weekarg
tests/ts/cal/weeknum
tests/ts/cal/year
tests/ts/cal/yearw
tests/ts/cramfs/doubles
tests/ts/cramfs/fsck-endianness
tests/ts/cramfs/mkfs
tests/ts/cramfs/mkfs-endianness
tests/ts/fsck/ismounted
tests/ts/minix/fsck
tests/ts/minix/mkfs
tests/ts/mount/devname
tests/ts/mount/fslists
tests/ts/mount/fstab-broken
tests/ts/mount/fstab-devname
tests/ts/mount/fstab-devname2label
tests/ts/mount/fstab-devname2uuid
tests/ts/mount/fstab-label
tests/ts/mount/fstab-label2devname
tests/ts/mount/fstab-label2uuid
tests/ts/mount/fstab-none
tests/ts/mount/fstab-symlink
tests/ts/mount/fstab-uuid
tests/ts/mount/fstab-uuid2devname
tests/ts/mount/fstab-uuid2label
tests/ts/mount/label
tests/ts/mount/regfile
tests/ts/mount/rlimit
tests/ts/mount/uuid
tests/ts/script/race
tests/ts/swapon/devname
tests/ts/swapon/fixpgsz
tests/ts/swapon/fixsig
tests/ts/swapon/label
tests/ts/swapon/uuid

index a1c899547a0186a6b8aca04f3df7130069ef1527..eb0097ec8f42f058efd1474be41e47a501e83ef8 100755 (executable)
@@ -26,8 +26,6 @@ ts_check_test_command "$TS_CMD_BLKDISCARD"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ORIGPWD=$(pwd)
 IMAGE_NAME="${TS_TESTNAME}-loop.img"
 IMAGE_PATH="$TS_OUTDIR/$IMAGE_NAME"
index e8b92320e2a54ee7664665b2c0673aaf2733d1d1..cbfb1eb7ccc8d23bc77dfbe57aafe16864de715d 100755 (executable)
@@ -29,8 +29,6 @@ ts_skip_nonroot
 ts_check_losetup
 ts_check_prog "mdadm"
 
-set -o pipefail
-
 ts_log "Initialize devices"
 IMGNAME="${TS_OUTDIR}/${TS_TESTNAME}"
 
index bd5f628a9ab038a143115ee29499f8ae0f914d4d..76ff8f83893820f1161fe094c0a2a4cf015c711e 100755 (executable)
@@ -29,8 +29,6 @@ ts_skip_nonroot
 ts_check_losetup
 ts_check_prog "mdadm"
 
-set -o pipefail
-
 ts_log "Initialize devices"
 IMGNAME="${TS_OUTDIR}/${TS_TESTNAME}"
 
index 295758aadf99ab9161ed71002d6f5a5963585b45..9f691e1370de6b12ff0d67dd2ce175e9f5ca2ab5 100755 (executable)
@@ -24,7 +24,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 66649487a158da262e6eab2775d2ab1d2b7976d5..3234a6adb92ae2ffdb6427a84650591ae5f3e413 100755 (executable)
@@ -24,7 +24,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 50f284ec24d57a7fe3f01e4acd60d82976ea8920..baa9ba314cb3bb4119642606a69bd4c9b5ddd1fa 100755 (executable)
@@ -23,7 +23,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 5ea951e494ad4a454b4fb63743ef59b9bdbd59b6..cb3905b189a76f6e88f8cc2d2663cb846ed23579 100755 (executable)
@@ -23,8 +23,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
-
 USETERM=$( ts_has_option "useterm" "$*" )
 MYTIME="27 09 2006"
 
index b5e415ca162aa8f49a1a3b19ab31be3a0180ed38..5dced2a0fbd412189be8571ca6ce0a6d130bf6c1 100755 (executable)
@@ -20,7 +20,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 75a18ddee2eb0a186ed3816f07ef197000e06533..2ce9fc73d45f7b52a852945a0d64f212485f5019 100755 (executable)
@@ -20,7 +20,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 44e9381e290698815935d450ed3041319be382fa..00e9c188a9ff7ee2d50a000cda92ea4fdee4dace 100755 (executable)
@@ -25,8 +25,6 @@ ts_check_test_command "$TS_CMD_CAL"
 # --color output depends on terminal type
 export TERM=linux
 
-set -o pipefail
-
 USETERM=$( ts_has_option "useterm" "$*" )
 
 [ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
index 0092e133e0895014ffde093dc25ae03c396fb74d..8e8ba0139e7fa37ab265bd1825432abf0a3ae018 100755 (executable)
@@ -25,8 +25,6 @@ ts_check_test_command "$TS_CMD_CAL"
 # --color output depends on terminal type
 export TERM=linux
 
-set -o pipefail
-
 USETERM=$( ts_has_option "useterm" "$*" )
 
 [ "$USETERM" == "yes" ] && TS_VERBOSE="yes"
index fa57b9b8ba32887a0a2e744dda33e9e1ebd23c16..8db7e3cac2737a3cc966f8fbf23c39f9dc091d3d 100755 (executable)
@@ -20,7 +20,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index b229e8369b4ff6ec8a0acfb987541adccefa254f..d2d0d316649a4fcc129e213a430619b341ff2cde 100755 (executable)
@@ -20,7 +20,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index a7987051c88396410880e10b38eb5cdc36d6d478..55dc327e2f91a0b7657f66239b14fc30e85e565c 100755 (executable)
@@ -23,7 +23,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 0bea00de1375cf40393ae3295183ba587eb722bd..3a8f376e69ea6e1ba75d4f80cfc53ccb92d8645f 100755 (executable)
@@ -23,7 +23,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 1204b5ffbc25d7568af2b63b818696b188ac3f65..77e847e28d655c3b15ae9d40c21b1a2b45a07dd8 100755 (executable)
@@ -23,7 +23,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index c05b1c2b7a2d280e031fad13a3d6b9cf56cc913e..2f5d2c40c2aa95ffd2ebbca6c348f4e053be47ef 100755 (executable)
@@ -23,7 +23,6 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_CAL"
 
-set -o pipefail
 export TERM=linux
 
 USETERM=$( ts_has_option "useterm" "$*" )
index 43fc60330eadfbc76aaa80a041d61fb645b07c90..c815b2750612c22e1e1777160f549abc73aed2c2 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_test_command "$TS_CMD_UMOUNT"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ORIGPWD=$(pwd)
 IMAGE_NAME="${TS_TESTNAME}.img"
 IMAGE_PATH="$TS_OUTDIR/$IMAGE_NAME"
index 87addef76511f6ffa99ea83867a3c11315e24d60..1ea8f51238e62ed3e916542350be70f434654eb9 100755 (executable)
@@ -26,8 +26,6 @@ ts_check_test_command "$TS_CMD_FSCKCRAMFS"
 
 ts_skip_nonroot
 
-set -o pipefail
-
 IMAGE_LITTLE="$TS_SELF/cramfs-little.img"      #Known good little endian image
 IMAGE_BIG="$TS_SELF/cramfs-big.img"            #Known good big endian image
 
index eff9d455c1de58683f8ac514a2e9a33309ac5a16..c4abb7977cc895c68d028a4e69182ec437ee42a3 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_test_command "$TS_CMD_UMOUNT"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ORIGPWD=$(pwd)
 IMAGE_NAME="${TS_TESTNAME}-loop.img"
 IMAGE_PATH="$TS_OUTDIR/$IMAGE_NAME"
index 34d6bbfccc16828a3fc23c67ae66b43c17dba692..e6707ca66efda62b323c24bf9e5e638e93ae813b 100755 (executable)
@@ -25,8 +25,6 @@ ts_check_test_command "$TS_CMD_MKCRAMFS"
 
 ts_skip_nonroot
 
-set -o pipefail
-
 IMAGE_DATA="$TS_OUTDIR/${TS_TESTNAME}-data"
 IMAGE_CREATED="$TS_OUTDIR/${TS_TESTNAME}-cramfs.img"   #Image created during the test and compared against the known images.
 
index 25bcff9e4085b51466fd785b2711f508cae60151..8edda4b6e40407b42712c53d5e4b568a7d5182e5 100755 (executable)
@@ -27,8 +27,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 > $TS_OUTPUT
 
 ts_device_init
index f64d83cfe81d590de296690df813f0a540a076f6..7a0bb8417097ec6ba2289b5071780165cbe6354b 100755 (executable)
@@ -25,8 +25,6 @@ ts_check_test_command "$TS_CMD_MKMINIX"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
 ts_device_init
 DEVICE=$TS_LODEV
index 3872135364be59a50b4cce3239a1150a544d46eb..bbb38e459e814557efbb108292bbafee7a656c60 100755 (executable)
@@ -25,8 +25,6 @@ ts_check_test_command "$TS_CMD_MKMINIX"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
 ts_device_init
 DEVICE=$TS_LODEV
index f4bfebd0fc6905e7b982dc25b48700be34626f67..2ba5effb6be35edc772bce6bb8cf55171af1df64 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 28bba6c484cb7feea0cafc3be5ec1a7e3773eb2d..599173002f62282b0595d4a3bafe123b7a72e75a 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 57d5d2d4f55e714908904f05e957ed7a59e6c7bb..f67d35cb14ee1b4e542a82da402d8396b8a1636e 100755 (executable)
@@ -27,8 +27,6 @@ ts_check_test_command "$TS_CMD_FINDMNT"
 
 ts_skip_nonroot
 
-set -o pipefail
-
 # Let's use the same mountpoint for all subtests
 MNT=$TS_MOUNTPOINT
 mkdir -p $MNT
index a80934330bf06cf07dd297291fb6a31aadf9c4a7..05704969b97e32b373e438030a22efdfeb689cc3 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 8519b498c0fe96abde42551e23e2a550d6ab3ce3..f55d2056b539d6dccd825087cb25625ac937bb0d 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 31bb3d0535e1bbac7cc6bb81eabba9e97affeb0d..66d9046dce6c0f390525090e31697a1124e6fda6 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 2c925fb09a9805739e6d9378a3acb6c631b0304c..e0d819b9a42336260709248d2b014f752be4cd2c 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 4cb34d764375843d4bf5538f142b01d739cdcd16..6bb23a5f950f3bc1b70030cf7c1dab829250e219 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index a02ba41f873c7e2faf5376221bba97617896d316..08a2927bf87e87c88f583e26d675e1c0bee634b4 100755 (executable)
@@ -30,8 +30,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 082afe9059358177b7fd5d9e64f0b7ff287373e2..b90008f0058c35bfd601171abbe40f5b45519b2c 100755 (executable)
@@ -12,8 +12,6 @@ ts_check_test_command "$TS_CMD_FINDMNT"
 
 ts_skip_nonroot
 
-set -o pipefail
-
 ts_fstab_add "none" "$TS_MOUNTPOINT" "tmpfs" "rw,nosuid,nodev,relatime"
 
 mkdir -p $TS_MOUNTPOINT
index 2579c85afd407dc508ccadf09139e58cb2daff31..bf00e13556f965aeb86fbdf5f073ebb450a87e61 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 LINKNAME="$TS_OUTDIR/${TS_TESTNAME}_lnk"
 
 ts_device_init
index e3bb1e7f55146d66751b9b017ec27bbd8b9c7b1b..6d7c5bf3cd21a828edd32e52224ebf70b9b18afe 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index ac0b932e3be1d43c7db2bf9e3beb0451f93c10d2..6c90097205c9b3a08319bad3190e5b3739960e13 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index edcdc0c5357285a588baef866e2c83729280e682..77895e31c2eec815ad99e15f01f84230409b0c3a 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 2becdb58907a349df924c10521c2831e9e973d7a..5e935c032c1816ce123b03b55c3a5c185ec0b497 100755 (executable)
@@ -30,8 +30,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index fd908356da8f2d4a27bfe9b6c1b6e9fc8f7f9ae8..8278e84b1e796a97336ac2a2af80c777d13ac978 100755 (executable)
@@ -16,8 +16,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 IMAGE=$(ts_image_init)
 mkfs.ext3 -F $IMAGE &> /dev/null || ts_die "Cannot make ext3 on $IMAGE"
 
index 223f717dd7828474b00713059e41578e2b64aee6..5e6880c4feb9717ab846f37f17e20c59d32f0103 100755 (executable)
@@ -39,8 +39,6 @@ ts_check_losetup
 [ -L /etc/mtab ] && ts_skip "mtab is symlink"
 [ "$(stat --format '%s' /etc/mtab)" -gt "1024" ] || ts_skip "mtab is too small"
 
-set -o pipefail
-
 function mtab_checksum()
 {
        md5sum /etc/mtab | awk '{printf $1}'
index 4dec89a79131bf6532ba83587a62b28712862110..6af358c7db2110fb55ce2e0a142e1a1747751a6f 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_prog "mkfs.ext3"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index a1e35b8f25dd691a61cf08bd66e1805d7eaff9f3..02c8187d6ad661ebe7f58bf71aad80a1ce13030c 100755 (executable)
@@ -33,8 +33,6 @@ TS_KNOWN_FAIL="yes"
 
 bingofile="$TS_OUTDIR/${TS_TESTNAME}-bingo"
 
-set -o pipefail
-
 count=1000
 for i in `seq 1 $count`; do
        $TS_CMD_SCRIPT -q -c "printf 'Bingo\n'" $bingofile
index e1ae4f5a470932273d91af25a31fcc32f1424c00..a4cf99f419b6ba91d5c126f9e053ed1b77945ce1 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index b1f4035fd1f84eba38c41f17deba5e79f6d4bab5..2e1aa57d31685e24a7378704fd2796f8f8eb0f21 100755 (executable)
@@ -13,8 +13,6 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 PAGESIZE=$($TS_HELPER_SYSINFO pagesize)
 
 #
index 3d1bf6355eba1ff50dc532c512f18759eb2c802d..6fceb79f801d5b382e0b9279ba2f7e93183d381c 100755 (executable)
@@ -13,8 +13,6 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 PAGESIZE=$($TS_HELPER_SYSINFO pagesize)
 
 #
index 2018f9cfb91981064093dd493e4d469dde048e18..187ccf9c6c9050c540f55f810694b7846fe325fa 100755 (executable)
@@ -29,8 +29,6 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV
 
index 65d019c29b3e11c6775461087d258638f29a61bb..2a8d78f30a2c2d1dbbdf9997b49ed279b101f1a8 100755 (executable)
@@ -28,8 +28,6 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
 ts_skip_nonroot
 ts_check_losetup
 
-set -o pipefail
-
 ts_device_init
 DEVICE=$TS_LODEV