From 7e37b8cc03e3f99349b46a0d7f43f22ff41930a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Am=C3=A9rico=20Wang?= Date: Wed, 19 Nov 2008 18:11:23 +0000 Subject: [PATCH] tests: remove useless return value checks in testing scripts Signed-off-by: WANG Cong --- tests/ts-fstab-devname | 20 ++++++++------------ tests/ts-fstab-devname2label | 13 +++++-------- tests/ts-fstab-devname2uuid | 12 ++++-------- tests/ts-fstab-label | 30 ++++++++++++------------------ tests/ts-fstab-label2devname | 24 ++++++++++-------------- tests/ts-fstab-label2uuid | 27 +++++++++++---------------- tests/ts-fstab-symlink | 21 +++++++++------------ tests/ts-fstab-uuid | 27 +++++++++------------------ tests/ts-fstab-uuid2devname | 23 +++++++++-------------- tests/ts-fstab-uuid2label | 26 ++++++++++---------------- tests/ts-mount-devname | 12 ++++-------- tests/ts-mount-label | 25 +++++++++++-------------- tests/ts-mount-remount | 18 ++++++++---------- tests/ts-mount-uuid | 22 ++++++++-------------- tests/ts-swapon-devname | 10 ++++------ tests/ts-swapon-label | 14 ++++++-------- tests/ts-swapon-uuid | 13 +++++-------- 17 files changed, 133 insertions(+), 204 deletions(-) diff --git a/tests/ts-fstab-devname b/tests/ts-fstab-devname index 6ebd9cb7..b7eabd7f 100755 --- a/tests/ts-fstab-devname +++ b/tests/ts-fstab-devname @@ -29,11 +29,9 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "TYPE" "ext3" $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found ext3 on $DEVICE" $DEVICE +ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT @@ -41,17 +39,15 @@ ts_fstab_add $DEVICE # variant A) $TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-devname2label b/tests/ts-fstab-devname2label index 307c9242..dda38a1d 100755 --- a/tests/ts-fstab-devname2label +++ b/tests/ts-fstab-devname2label @@ -31,21 +31,18 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 -L $LABEL $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_fstab_add "LABEL=$LABEL" $TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-devname2uuid b/tests/ts-fstab-devname2uuid index 96bb7d86..f9f62c89 100755 --- a/tests/ts-fstab-devname2uuid +++ b/tests/ts-fstab-devname2uuid @@ -29,11 +29,9 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) @@ -42,10 +40,8 @@ UUID=$(ts_uuid_by_devname $DEVICE) ts_fstab_add "UUID=$UUID" $TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-label b/tests/ts-fstab-label index bd1eb867..ac5ad130 100755 --- a/tests/ts-fstab-label +++ b/tests/ts-fstab-label @@ -31,14 +31,12 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 -L $LABEL $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE -ts_udev_dev_support "by-label" $LABEL -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT @@ -46,24 +44,20 @@ ts_fstab_add "LABEL=$LABEL" # variant A) $TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE # variant C) $TS_CMD_MOUNT LABEL=$LABEL 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "C) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-label2devname b/tests/ts-fstab-label2devname index 13f7a2cd..eb58c25c 100755 --- a/tests/ts-fstab-label2devname +++ b/tests/ts-fstab-label2devname @@ -31,14 +31,12 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 -L $LABEL $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE -ts_udev_dev_support "by-label" $LABEL -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT @@ -46,17 +44,15 @@ ts_fstab_add "$DEVICE" # variant A) $TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-label2uuid b/tests/ts-fstab-label2uuid index a6270de5..7eaed4e3 100755 --- a/tests/ts-fstab-label2uuid +++ b/tests/ts-fstab-label2uuid @@ -31,17 +31,14 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 -L $LABEL $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE -ts_udev_dev_support "by-label" $LABEL -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) @@ -51,17 +48,15 @@ ts_fstab_add "UUID=$UUID" # variant A) $TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-symlink b/tests/ts-fstab-symlink index a07681f9..5722d2c3 100755 --- a/tests/ts-fstab-symlink +++ b/tests/ts-fstab-symlink @@ -31,11 +31,9 @@ LINKNAME="$(pwd)/$TS_OUTDIR/${TS_NAME}_lnk" DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "TYPE" "ext3" $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found ext3 on $DEVICE" $DEVICE +ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT @@ -45,20 +43,19 @@ ts_fstab_add $LINKNAME $TS_MOUNTPOINT "auto" "defaults,user" # variant A) -- UID=0 $TS_CMD_MOUNT $LINKNAME 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $LINKNAME -[ "$?" == "0" ] || ts_die "A) Cannot umount $LINKNAME" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME" $DEVICE # varian B) ts_init_suid $TS_CMD_MOUNT ts_init_suid $TS_CMD_UMOUNT su $TS_TESTUSER -c "$TS_CMD_MOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -su $TS_TESTUSER -c "$TS_CMD_UMOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT -[ "$?" == "0" ] || ts_die "B) Cannot umount $LINKNAME" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +su $TS_TESTUSER -c "$TS_CMD_UMOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT \ + || ts_die "B) Cannot umount $LINKNAME" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-uuid b/tests/ts-fstab-uuid index 98e35e21..ff39a5f8 100755 --- a/tests/ts-fstab-uuid +++ b/tests/ts-fstab-uuid @@ -29,16 +29,13 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) -ts_udev_dev_support "by-uuid" $UUID -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT @@ -46,24 +43,18 @@ ts_fstab_add "UUID=$UUID" # varian A) $TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # varian B) $TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE # varian C) $TS_CMD_MOUNT UUID=$UUID 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "C) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "C) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-uuid2devname b/tests/ts-fstab-uuid2devname index 91495f95..0c3e605f 100755 --- a/tests/ts-fstab-uuid2devname +++ b/tests/ts-fstab-uuid2devname @@ -29,16 +29,13 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) -ts_udev_dev_support "by-uuid" $UUID -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT @@ -46,17 +43,15 @@ ts_fstab_add "$DEVICE" # variant A) $TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-fstab-uuid2label b/tests/ts-fstab-uuid2label index 216a4a96..b99323cc 100755 --- a/tests/ts-fstab-uuid2label +++ b/tests/ts-fstab-uuid2label @@ -31,17 +31,14 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 -L $LABEL $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE -ts_udev_dev_support "by-label" $LABEL -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) @@ -51,17 +48,14 @@ ts_fstab_add "LABEL=$LABEL" # variant A) $TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE ts_fstab_clean diff --git a/tests/ts-mount-devname b/tests/ts-mount-devname index e2c06ba4..eceb5e91 100755 --- a/tests/ts-mount-devname +++ b/tests/ts-mount-devname @@ -29,21 +29,17 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "TYPE" "ext3" $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found ext3 on $DEVICE" $DEVICE +ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot found ext3 on $DEVICE" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "Cannot umount $DEVICE" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE diff --git a/tests/ts-mount-label b/tests/ts-mount-label index 2d33a898..eb640042 100755 --- a/tests/ts-mount-label +++ b/tests/ts-mount-label @@ -31,30 +31,27 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 -L $LABEL $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE -ts_udev_dev_support "by-label" $LABEL -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-label" $LABEL \ + || ts_skip "udev ignores /dev/loop*" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT # variant A) $TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT LABEL=$LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts \ + || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE diff --git a/tests/ts-mount-remount b/tests/ts-mount-remount index 348351fd..96d9b9b4 100755 --- a/tests/ts-mount-remount +++ b/tests/ts-mount-remount @@ -30,24 +30,22 @@ ts_skip_nonroot DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext2 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext2 on $DEVICE" $DEVICE +mkfs.ext2 $DEVICE &> /dev/null || ts_die "Cannot make ext2 on $DEVICE" $DEVICE # mount read-write -$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT -[ "$?" == "0" ] || ts_die "Cannot mount $TS_MOUNTPOINT" $DEVICE +$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT || ts_die "Cannot mount $TS_MOUNTPOINT" $DEVICE # check the mount -egrep -q "^$DEVICE $TS_MOUNTPOINT" /etc/mtab -[ "$?" == "0" ] || ts_die "Cannot found $TS_MOUNTPOINT in /etc/mtab" $DEVICE +egrep -q "^$DEVICE $TS_MOUNTPOINT" /etc/mtab \ + || ts_die "Cannot found $TS_MOUNTPOINT in /etc/mtab" $DEVICE # remount -$TS_CMD_MOUNT -o remount,ro $TS_MOUNTPOINT -[ "$?" == "0" ] || ts_die "Cannot remount $TS_MOUNTPOINT" $DEVICE +$TS_CMD_MOUNT -o remount,ro $TS_MOUNTPOINT \ + || ts_die "Cannot remount $TS_MOUNTPOINT" $DEVICE # check the remount -egrep -q "^$DEVICE $TS_MOUNTPOINT ext2 ro 0 0" /etc/mtab -[ "$?" == "0" ] || ts_die "Cannot found remounted $TS_MOUNTPOINT in /etc/mtab" $DEVICE +egrep -q "^$DEVICE $TS_MOUNTPOINT ext2 ro 0 0" /etc/mtab \ + || ts_die "Cannot found remounted $TS_MOUNTPOINT in /etc/mtab" $DEVICE ts_device_deinit $DEVICE diff --git a/tests/ts-mount-uuid b/tests/ts-mount-uuid index b96b0ddb..f8bd9a91 100755 --- a/tests/ts-mount-uuid +++ b/tests/ts-mount-uuid @@ -29,32 +29,26 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -mkfs.ext3 $DEVICE &> /dev/null -[ "$?" == "0" ] || ts_die "Cannot make ext3 on $DEVICE" $DEVICE +mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) -ts_udev_dev_support "by-uuid" $UUID -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-uuid" $UUID \ + || ts_skip "udev ignores /dev/loop*" $DEVICE [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT # variant A) $TS_CMD_MOUNT -U $UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "A) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "A) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE # variant B) $TS_CMD_MOUNT UUID=$UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/mounts -[ "$?" == "0" ] || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE -$TS_CMD_UMOUNT $DEVICE -[ "$?" == "0" ] || ts_die "B) Cannot umount $DEVICE" $DEVICE +grep -q $DEVICE /proc/mounts || ts_die "B) Cannot found $DEVICE in /proc/mounts" $DEVICE +$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE ts_device_deinit $DEVICE diff --git a/tests/ts-swapon-devname b/tests/ts-swapon-devname index 8d3bac6e..954af861 100755 --- a/tests/ts-swapon-devname +++ b/tests/ts-swapon-devname @@ -29,16 +29,14 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT -[ "$?" == "0" ] || ts_die "Cannot make swap $DEVICE" $DEVICE +$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \ + || ts_die "Cannot make swap $DEVICE" $DEVICE -ts_device_has "TYPE" "swap" $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found swap on $DEVICE" $DEVICE +ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot found swap on $DEVICE" $DEVICE $TS_CMD_SWAPON $DEVICE 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/swaps -[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE +grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE ts_swapoff $DEVICE ts_device_deinit $DEVICE diff --git a/tests/ts-swapon-label b/tests/ts-swapon-label index 511d4f1a..3ea30a96 100755 --- a/tests/ts-swapon-label +++ b/tests/ts-swapon-label @@ -31,19 +31,17 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -$TS_CMD_MKSWAP -L $LABEL $DEVICE > /dev/null 2>> $TS_OUTPUT -[ "$?" == "0" ] || ts_die "Cannot make swap on $DEVICE" $DEVICE +$TS_CMD_MKSWAP -L $LABEL $DEVICE > /dev/null 2>> $TS_OUTPUT \ + || ts_die "Cannot make swap on $DEVICE" $DEVICE -ts_device_has "LABEL" $LABEL $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE +ts_device_has "LABEL" $LABEL $DEVICE \ + || ts_die "Cannot found LABEL '$LABEL' on $DEVICE" $DEVICE -ts_udev_dev_support "by-label" $LABEL -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-label" $LABEL || ts_skip "udev ignores /dev/loop*" $DEVICE $TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/swaps -[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE +grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE ts_swapoff $DEVICE ts_device_deinit $DEVICE diff --git a/tests/ts-swapon-uuid b/tests/ts-swapon-uuid index a6428a63..3b181fa0 100755 --- a/tests/ts-swapon-uuid +++ b/tests/ts-swapon-uuid @@ -29,21 +29,18 @@ set -o pipefail DEVICE=$(ts_device_init) [ "$?" == 0 ] || ts_die "Cannot init device" -$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT -[ "$?" == "0" ] || ts_die "Cannot make swap $DEVICE" $DEVICE +$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \ + || ts_die "Cannot make swap $DEVICE" $DEVICE -ts_device_has_uuid $DEVICE -[ "$?" == "0" ] || ts_die "Cannot found UUID on $DEVICE" $DEVICE +ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE UUID=$(ts_uuid_by_devname $DEVICE) -ts_udev_dev_support "by-uuid" $UUID -[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE +ts_udev_dev_support "by-uuid" $UUID || ts_skip "udev ignores /dev/loop*" $DEVICE $TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT -grep -q $DEVICE /proc/swaps -[ "$?" == "0" ] || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE +grep -q $DEVICE /proc/swaps || ts_die "Cannot found $DEVICE in /proc/swaps" $DEVICE ts_swapoff $DEVICE ts_device_deinit $DEVICE -- 2.39.5