aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/functions.sh42
-rwxr-xr-xtests/ts/blkdiscard/offsets4
-rwxr-xr-xtests/ts/blkid/md-raid0-whole12
-rwxr-xr-xtests/ts/blkid/md-raid1-whole12
-rwxr-xr-xtests/ts/cal/1m1
-rwxr-xr-xtests/ts/cal/1mw1
-rwxr-xr-xtests/ts/cal/3m1
-rwxr-xr-xtests/ts/cal/3mw2
-rwxr-xr-xtests/ts/cal/bigyear1
-rwxr-xr-xtests/ts/cal/bigyearw1
-rwxr-xr-xtests/ts/cal/color2
-rwxr-xr-xtests/ts/cal/colorw2
-rwxr-xr-xtests/ts/cal/sep17521
-rwxr-xr-xtests/ts/cal/sep1752w1
-rwxr-xr-xtests/ts/cal/weekarg1
-rwxr-xr-xtests/ts/cal/weeknum1
-rwxr-xr-xtests/ts/cal/year1
-rwxr-xr-xtests/ts/cal/yearw1
-rwxr-xr-xtests/ts/cramfs/doubles2
-rwxr-xr-xtests/ts/cramfs/fsck-endianness2
-rwxr-xr-xtests/ts/cramfs/mkfs9
-rwxr-xr-xtests/ts/cramfs/mkfs-endianness2
-rwxr-xr-xtests/ts/fdisk/align-512-5125
-rwxr-xr-xtests/ts/fsck/ismounted13
-rwxr-xr-xtests/ts/libmount/context2
-rwxr-xr-xtests/ts/libmount/context-py2
-rwxr-xr-xtests/ts/libmount/tabfiles-tags4
-rwxr-xr-xtests/ts/libmount/tabfiles-tags-py4
-rwxr-xr-xtests/ts/minix/fsck6
-rwxr-xr-xtests/ts/minix/mkfs8
-rwxr-xr-xtests/ts/mount/devname16
-rwxr-xr-xtests/ts/mount/fslists23
-rwxr-xr-xtests/ts/mount/fstab-broken2
-rwxr-xr-xtests/ts/mount/fstab-devname19
-rwxr-xr-xtests/ts/mount/fstab-devname2label15
-rwxr-xr-xtests/ts/mount/fstab-devname2uuid15
-rwxr-xr-xtests/ts/mount/fstab-label23
-rwxr-xr-xtests/ts/mount/fstab-label2devname19
-rwxr-xr-xtests/ts/mount/fstab-label2uuid21
-rwxr-xr-xtests/ts/mount/fstab-none2
-rwxr-xr-xtests/ts/mount/fstab-symlink19
-rwxr-xr-xtests/ts/mount/fstab-uuid23
-rwxr-xr-xtests/ts/mount/fstab-uuid2devname19
-rwxr-xr-xtests/ts/mount/fstab-uuid2label21
-rwxr-xr-xtests/ts/mount/label20
-rwxr-xr-xtests/ts/mount/regfile2
-rwxr-xr-xtests/ts/mount/remount14
-rwxr-xr-xtests/ts/mount/rlimit10
-rwxr-xr-xtests/ts/mount/shared-subtree9
-rwxr-xr-xtests/ts/mount/uuid20
-rwxr-xr-xtests/ts/script/race2
-rwxr-xr-xtests/ts/swapon/devname13
-rwxr-xr-xtests/ts/swapon/fixpgsz12
-rwxr-xr-xtests/ts/swapon/fixsig15
-rwxr-xr-xtests/ts/swapon/label13
-rwxr-xr-xtests/ts/swapon/uuid13
56 files changed, 211 insertions, 315 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 6f786e7971..a624c3e2c3 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -86,9 +86,8 @@ function ts_skip_subtest {
function ts_skip {
ts_skip_subtest "$1"
- if [ -n "$2" -a -b "$2" ]; then
- ts_device_deinit "$2"
- fi
+
+ ts_cleanup_on_exit
exit 0
}
@@ -253,6 +252,7 @@ function ts_init_env {
declare -a TS_SUID_PROGS
declare -a TS_SUID_USER
declare -a TS_SUID_GROUP
+ declare -a TS_LOOP_DEVS
if [ -f $TS_TOPDIR/commands.sh ]; then
. $TS_TOPDIR/commands.sh
@@ -411,11 +411,7 @@ function ts_finalize_subtest {
}
function ts_finalize {
- for idx in $(seq 0 $((${#TS_SUID_PROGS[*]} - 1))); do
- PROG=${TS_SUID_PROGS[$idx]}
- chmod a-s $PROG &> /dev/null
- chown ${TS_SUID_USER[$idx]}.${TS_SUID_GROUP[$idx]} $PROG &> /dev/null
- done
+ ts_cleanup_on_exit
if [ $TS_NSUBTESTS -ne 0 ]; then
printf "%11s..."
@@ -439,13 +435,23 @@ function ts_finalize {
function ts_die {
ts_log "$1"
- if [ -n "$2" ] && [ -b "$2" ]; then
- ts_device_deinit "$2"
- ts_fstab_clean # for sure...
- fi
ts_finalize
}
+function ts_cleanup_on_exit {
+
+ for idx in $(seq 0 $((${#TS_SUID_PROGS[*]} - 1))); do
+ PROG=${TS_SUID_PROGS[$idx]}
+ chmod a-s $PROG &> /dev/null
+ chown ${TS_SUID_USER[$idx]}.${TS_SUID_GROUP[$idx]} $PROG &> /dev/null
+ done
+
+ for dev in "${TS_LOOP_DEVS[@]}"; do
+ ts_device_deinit "$dev"
+ done
+ unset TS_LOOP_DEVS
+}
+
function ts_image_md5sum {
local img=${1:-"$TS_OUTDIR/${TS_TESTNAME}.img"}
echo $(md5sum "$img" | awk '{printf $1}') $(basename "$img")
@@ -460,16 +466,26 @@ function ts_image_init {
return 0
}
+function ts_register_loop_device {
+ local ct=${#TS_LOOP_DEVS[*]}
+ TS_LOOP_DEVS[$ct]=$1
+}
+
function ts_device_init {
local img
local dev
img=$(ts_image_init $1 $2)
dev=$($TS_CMD_LOSETUP --show -f "$img")
+ if [ "$?" != "0" -o "$dev" = "" ]; then
+ ts_die "Cannot init device"
+ fi
- echo $dev
+ ts_register_loop_device "$dev"
+ TS_LODEV=$dev
}
+# call from ts_cleanup_on_exit() only because of TS_LOOP_DEVS maintenance
function ts_device_deinit {
local DEV="$1"
diff --git a/tests/ts/blkdiscard/offsets b/tests/ts/blkdiscard/offsets
index 8776c67709..eb0097ec8f 100755
--- a/tests/ts/blkdiscard/offsets
+++ b/tests/ts/blkdiscard/offsets
@@ -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"
@@ -36,6 +34,7 @@ truncate -s 10M $IMAGE_PATH
ts_log "create loop device from image"
DEVICE=$($TS_CMD_LOSETUP --show -f $IMAGE_PATH)
+ts_register_loop_device "$DEVICE"
CMD_SED_DEVICE="sed s#$DEVICE:\s##"
ts_log "testing offsets with full block size"
@@ -82,7 +81,6 @@ $TS_CMD_BLKDISCARD -v -p 511 -o 1 -l 10240 $DEVICE 2>&1 | $CMD_SED_DEVICE >> $TS
$TS_CMD_BLKDISCARD -v -p 511 -o 511 -l 10240 $DEVICE 2>&1 | $CMD_SED_DEVICE >> $TS_OUTPUT
ts_log "detach loop device from image"
-$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
ts_cd "$ORIGPWD"
diff --git a/tests/ts/blkid/md-raid0-whole b/tests/ts/blkid/md-raid0-whole
index e2359619b2..cbfb1eb7cc 100755
--- a/tests/ts/blkid/md-raid0-whole
+++ b/tests/ts/blkid/md-raid0-whole
@@ -29,16 +29,14 @@ ts_skip_nonroot
ts_check_losetup
ts_check_prog "mdadm"
-set -o pipefail
-
ts_log "Initialize devices"
IMGNAME="${TS_OUTDIR}/${TS_TESTNAME}"
-DEVICE1=$(ts_device_init 50 ${IMGNAME}1.img)
-[ "$?" == 0 ] || ts_die "Cannot init device1"
+ts_device_init 50 ${IMGNAME}1.img
+DEVICE1=$TS_LODEV
-DEVICE2=$(ts_device_init 50 ${IMGNAME}2.img)
-[ "$?" == 0 ] || ts_die "Cannot init device2" $DEVICE1
+ts_device_init 50 ${IMGNAME}2.img
+DEVICE2=$TS_LODEV
MD_DEVNAME=md8
MD_DEVICE=/dev/${MD_DEVNAME}
@@ -80,8 +78,6 @@ mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
udevadm settle
ts_log "Deinitialize devices"
-ts_device_deinit $DEVICE1
-ts_device_deinit $DEVICE2
ts_fdisk_clean $MD_DEVICE
diff --git a/tests/ts/blkid/md-raid1-whole b/tests/ts/blkid/md-raid1-whole
index 611ead3b74..76ff8f8389 100755
--- a/tests/ts/blkid/md-raid1-whole
+++ b/tests/ts/blkid/md-raid1-whole
@@ -29,16 +29,14 @@ ts_skip_nonroot
ts_check_losetup
ts_check_prog "mdadm"
-set -o pipefail
-
ts_log "Initialize devices"
IMGNAME="${TS_OUTDIR}/${TS_TESTNAME}"
-DEVICE1=$(ts_device_init 50 ${IMGNAME}1.img)
-[ "$?" == 0 ] || ts_die "Cannot init device1"
+ts_device_init 50 ${IMGNAME}1.img
+DEVICE1=$TS_LODEV
-DEVICE2=$(ts_device_init 50 ${IMGNAME}2.img)
-[ "$?" == 0 ] || ts_die "Cannot init device2" $DEVICE1
+ts_device_init 50 ${IMGNAME}2.img
+DEVICE2=$TS_LODEV
MD_DEVNAME=md8
MD_DEVICE=/dev/${MD_DEVNAME}
@@ -80,8 +78,6 @@ mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
udevadm settle
ts_log "Deinitialize devices"
-ts_device_deinit $DEVICE1
-ts_device_deinit $DEVICE2
ts_fdisk_clean
# remove generated UUIDs
diff --git a/tests/ts/cal/1m b/tests/ts/cal/1m
index 295758aadf..9f691e1370 100755
--- a/tests/ts/cal/1m
+++ b/tests/ts/cal/1m
@@ -24,7 +24,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/1mw b/tests/ts/cal/1mw
index 66649487a1..3234a6adb9 100755
--- a/tests/ts/cal/1mw
+++ b/tests/ts/cal/1mw
@@ -24,7 +24,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/3m b/tests/ts/cal/3m
index 50f284ec24..baa9ba314c 100755
--- a/tests/ts/cal/3m
+++ b/tests/ts/cal/3m
@@ -23,7 +23,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/3mw b/tests/ts/cal/3mw
index 5ea951e494..cb3905b189 100755
--- a/tests/ts/cal/3mw
+++ b/tests/ts/cal/3mw
@@ -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"
diff --git a/tests/ts/cal/bigyear b/tests/ts/cal/bigyear
index b5e415ca16..5dced2a0fb 100755
--- a/tests/ts/cal/bigyear
+++ b/tests/ts/cal/bigyear
@@ -20,7 +20,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/bigyearw b/tests/ts/cal/bigyearw
index 75a18ddee2..2ce9fc73d4 100755
--- a/tests/ts/cal/bigyearw
+++ b/tests/ts/cal/bigyearw
@@ -20,7 +20,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/color b/tests/ts/cal/color
index 44e9381e29..00e9c188a9 100755
--- a/tests/ts/cal/color
+++ b/tests/ts/cal/color
@@ -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"
diff --git a/tests/ts/cal/colorw b/tests/ts/cal/colorw
index 0092e133e0..8e8ba0139e 100755
--- a/tests/ts/cal/colorw
+++ b/tests/ts/cal/colorw
@@ -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"
diff --git a/tests/ts/cal/sep1752 b/tests/ts/cal/sep1752
index fa57b9b8ba..8db7e3cac2 100755
--- a/tests/ts/cal/sep1752
+++ b/tests/ts/cal/sep1752
@@ -20,7 +20,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/sep1752w b/tests/ts/cal/sep1752w
index b229e8369b..d2d0d31664 100755
--- a/tests/ts/cal/sep1752w
+++ b/tests/ts/cal/sep1752w
@@ -20,7 +20,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/weekarg b/tests/ts/cal/weekarg
index a7987051c8..55dc327e2f 100755
--- a/tests/ts/cal/weekarg
+++ b/tests/ts/cal/weekarg
@@ -23,7 +23,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/weeknum b/tests/ts/cal/weeknum
index 0bea00de13..3a8f376e69 100755
--- a/tests/ts/cal/weeknum
+++ b/tests/ts/cal/weeknum
@@ -23,7 +23,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/year b/tests/ts/cal/year
index 1204b5ffbc..77e847e28d 100755
--- a/tests/ts/cal/year
+++ b/tests/ts/cal/year
@@ -23,7 +23,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cal/yearw b/tests/ts/cal/yearw
index c05b1c2b7a..2f5d2c40c2 100755
--- a/tests/ts/cal/yearw
+++ b/tests/ts/cal/yearw
@@ -23,7 +23,6 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_CAL"
-set -o pipefail
export TERM=linux
USETERM=$( ts_has_option "useterm" "$*" )
diff --git a/tests/ts/cramfs/doubles b/tests/ts/cramfs/doubles
index 43fc60330e..c815b27506 100755
--- a/tests/ts/cramfs/doubles
+++ b/tests/ts/cramfs/doubles
@@ -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"
diff --git a/tests/ts/cramfs/fsck-endianness b/tests/ts/cramfs/fsck-endianness
index 87addef765..1ea8f51238 100755
--- a/tests/ts/cramfs/fsck-endianness
+++ b/tests/ts/cramfs/fsck-endianness
@@ -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
diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs
index 7c7d690efa..c4abb7977c 100755
--- a/tests/ts/cramfs/mkfs
+++ b/tests/ts/cramfs/mkfs
@@ -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"
@@ -86,16 +84,17 @@ echo >> $TS_OUTPUT
ts_log "create loop device from image"
DEVICE=$($TS_CMD_LOSETUP --show -f $IMAGE_PATH)
+ts_register_loop_device "$DEVICE"
ts_log "check the image"
ts_device_has "TYPE" "cramfs" $DEVICE
-[ "$?" == "0" ] || ts_die "Cannot find cramfs on $DEVICE" $DEVICE
+[ "$?" == "0" ] || ts_die "Cannot find cramfs on $DEVICE"
ts_log "mount the image"
ts_mount "cramfs" -r -L $LABEL $TS_MOUNTPOINT
# check it
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
ts_cd "$TS_MOUNTPOINT"
@@ -111,7 +110,5 @@ echo >> $TS_OUTPUT
ts_cd "$ORIGPWD"
ts_log "umount the image"
-$TS_CMD_UMOUNT $DEVICE
-$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
ts_finalize
diff --git a/tests/ts/cramfs/mkfs-endianness b/tests/ts/cramfs/mkfs-endianness
index 34d6bbfccc..e6707ca66e 100755
--- a/tests/ts/cramfs/mkfs-endianness
+++ b/tests/ts/cramfs/mkfs-endianness
@@ -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.
diff --git a/tests/ts/fdisk/align-512-512 b/tests/ts/fdisk/align-512-512
index 21037170e9..19506ea885 100755
--- a/tests/ts/fdisk/align-512-512
+++ b/tests/ts/fdisk/align-512-512
@@ -30,8 +30,8 @@ ts_check_test_command "$TS_CMD_FDISK"
ts_skip_nonroot
ts_check_losetup
-DEVICE=$(ts_device_init 50)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init 50
+DEVICE=$TS_LODEV
ts_log "Create partitions"
$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <<EOF
@@ -67,7 +67,6 @@ p
q
EOF
-ts_device_deinit $DEVICE
ts_fdisk_clean $DEVICE
ts_finalize
diff --git a/tests/ts/fsck/ismounted b/tests/ts/fsck/ismounted
index bff0b81146..8edda4b6e4 100755
--- a/tests/ts/fsck/ismounted
+++ b/tests/ts/fsck/ismounted
@@ -27,16 +27,14 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
> $TS_OUTPUT
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
@@ -45,7 +43,6 @@ $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1
# test by ismounted.c
$TS_HELPER_ISMOUNTED $DEVICE | awk '{print $1}' >> $TS_OUTPUT 2>&1
-$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_finalize
diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context
index 15693d1c6c..9424fef90b 100755
--- a/tests/ts/libmount/context
+++ b/tests/ts/libmount/context
@@ -81,7 +81,7 @@ function is_mounted {
udevadm settle
-ts_device_has "TYPE" "ext4" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext4" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
ts_init_subtest "mount-by-devname"
diff --git a/tests/ts/libmount/context-py b/tests/ts/libmount/context-py
index f2190ce8a7..0f8398f6ef 100755
--- a/tests/ts/libmount/context-py
+++ b/tests/ts/libmount/context-py
@@ -83,7 +83,7 @@ function is_mounted {
udevadm settle
-ts_device_has "TYPE" "ext4" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext4" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
ts_init_subtest "mount-by-devname"
diff --git a/tests/ts/libmount/tabfiles-tags b/tests/ts/libmount/tabfiles-tags
index 15696b0765..662d38b6c6 100755
--- a/tests/ts/libmount/tabfiles-tags
+++ b/tests/ts/libmount/tabfiles-tags
@@ -24,10 +24,10 @@ UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"
#
# Create filesystem
#
-mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE" $TS_DEVICE
+mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE"
udevadm settle
-ts_device_has_uuid $TS_DEVICE || ts_die "Cannot find UUID on $TS_DEVICE" $TS_DEVICE
+ts_device_has_uuid $TS_DEVICE || ts_die "Cannot find UUID on $TS_DEVICE"
FSTAB="$TS_OUTDIR/fstab"
diff --git a/tests/ts/libmount/tabfiles-tags-py b/tests/ts/libmount/tabfiles-tags-py
index d6ca470fb4..47efa70e1d 100755
--- a/tests/ts/libmount/tabfiles-tags-py
+++ b/tests/ts/libmount/tabfiles-tags-py
@@ -27,10 +27,10 @@ UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"
#
# Create filesystem
#
-mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE" $TS_DEVICE
+mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE"
udevadm settle
-ts_device_has_uuid $TS_DEVICE || ts_die "Cannot find UUID on $TS_DEVICE" $TS_DEVICE
+ts_device_has_uuid $TS_DEVICE || ts_die "Cannot find UUID on $TS_DEVICE"
FSTAB="$TS_OUTDIR/fstab"
diff --git a/tests/ts/minix/fsck b/tests/ts/minix/fsck
index cba7c311b6..7a0bb84170 100755
--- a/tests/ts/minix/fsck
+++ b/tests/ts/minix/fsck
@@ -25,10 +25,9 @@ ts_check_test_command "$TS_CMD_MKMINIX"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
-DEVICE=$(ts_device_init)
+ts_device_init
+DEVICE=$TS_LODEV
ts_log "create minix fs"
$TS_CMD_MKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
@@ -36,6 +35,5 @@ $TS_CMD_MKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
ts_log "fsck minix fs"
$TS_CMD_FSCKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
-ts_device_deinit $DEVICE
ts_finalize
diff --git a/tests/ts/minix/mkfs b/tests/ts/minix/mkfs
index 86230f77ce..bbb38e459e 100755
--- a/tests/ts/minix/mkfs
+++ b/tests/ts/minix/mkfs
@@ -25,10 +25,9 @@ ts_check_test_command "$TS_CMD_MKMINIX"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
IMAGE="$TS_OUTDIR/${TS_TESTNAME}-loop.img"
-DEVICE=$(ts_device_init)
+ts_device_init
+DEVICE=$TS_LODEV
ts_log "create minix fs"
$TS_CMD_MKMINIX $DEVICE 2>&1 >> $TS_OUTPUT
@@ -40,10 +39,9 @@ ts_log "mount the filesystem"
ts_mount "minix" $DEVICE $TS_MOUNTPOINT
# check it
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
ts_log "umount the image"
$TS_CMD_UMOUNT $DEVICE
-ts_device_deinit $DEVICE
ts_finalize
diff --git a/tests/ts/mount/devname b/tests/ts/mount/devname
index ee6b671abb..2ba5effb6b 100755
--- a/tests/ts/mount/devname
+++ b/tests/ts/mount/devname
@@ -29,31 +29,27 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
grep -q $DEVICE /etc/mtab ||
echo "mount failed: cannot find $DEVICE in mtab" >> $TS_OUTPUT 2>&1
-$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
grep -q $DEVICE /etc/mtab &&
echo "umount failed: found $DEVICE in mtab" >> $TS_OUTPUT 2>&1
-ts_device_deinit $DEVICE
-
ts_log "Success"
ts_finalize
diff --git a/tests/ts/mount/fslists b/tests/ts/mount/fslists
index 944e8af553..599173002f 100755
--- a/tests/ts/mount/fslists
+++ b/tests/ts/mount/fslists
@@ -29,14 +29,12 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
# Don't forget that $TS_MOUNTPOINT is subtest specific, don't create it
# globally!
@@ -45,7 +43,7 @@ ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEV
ts_init_subtest "one-type"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -t ext3 $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
$TS_CMD_UMOUNT $TS_MOUNTPOINT
ts_log "Success"
ts_finalize_subtest
@@ -54,7 +52,7 @@ ts_finalize_subtest
ts_init_subtest "more-types"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -t foo,bar,ext3 $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
$TS_CMD_UMOUNT $TS_MOUNTPOINT
ts_log "Success"
ts_finalize_subtest
@@ -65,7 +63,7 @@ ts_init_subtest "more-types-fstab"
ts_fstab_add $DEVICE $TS_MOUNTPOINT "foo,bar,ext3"
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
ts_fstab_clean
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
$TS_CMD_UMOUNT $TS_MOUNTPOINT
ts_log "Success"
ts_finalize_subtest
@@ -74,7 +72,7 @@ ts_finalize_subtest
ts_init_subtest "type-pattern"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -t nofoo,bar $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
$TS_CMD_UMOUNT $TS_MOUNTPOINT
ts_log "Success"
ts_finalize_subtest
@@ -83,13 +81,10 @@ ts_finalize_subtest
ts_init_subtest "type-pattern-neg"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -t nofoo,bar,ext3,ext2,ext4 $DEVICE $TS_MOUNTPOINT &> /dev/null
-ts_is_mounted $DEVICE && ts_die "$DEVICE unexpectedly mounted" $DEVICE
+ts_is_mounted $DEVICE && ts_die "$DEVICE unexpectedly mounted"
ts_log "Success"
ts_finalize_subtest
-
-ts_device_deinit $DEVICE
-
ts_log "Success"
ts_finalize
diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken
index 57d5d2d4f5..f67d35cb14 100755
--- a/tests/ts/mount/fstab-broken
+++ b/tests/ts/mount/fstab-broken
@@ -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
diff --git a/tests/ts/mount/fstab-devname b/tests/ts/mount/fstab-devname
index 4efd7fe062..05704969b9 100755
--- a/tests/ts/mount/fstab-devname
+++ b/tests/ts/mount/fstab-devname
@@ -28,14 +28,12 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
@@ -43,15 +41,14 @@ ts_fstab_add $DEVICE
# variant A)
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-devname2label b/tests/ts/mount/fstab-devname2label
index 2751cd97a0..f55d2056b5 100755
--- a/tests/ts/mount/fstab-devname2label
+++ b/tests/ts/mount/fstab-devname2label
@@ -29,25 +29,22 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
-
-mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
ts_fstab_add "LABEL=$LABEL"
$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-devname2uuid b/tests/ts/mount/fstab-devname2uuid
index 773cb30c84..66d9046dce 100755
--- a/tests/ts/mount/fstab-devname2uuid
+++ b/tests/ts/mount/fstab-devname2uuid
@@ -28,14 +28,12 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
@@ -44,10 +42,9 @@ UUID=$(ts_uuid_by_devname $DEVICE)
ts_fstab_add "UUID=$UUID"
$TS_CMD_MOUNT $DEVICE 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-label b/tests/ts/mount/fstab-label
index 272b66ec68..e0d819b9a4 100755
--- a/tests/ts/mount/fstab-label
+++ b/tests/ts/mount/fstab-label
@@ -29,15 +29,13 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
-
-mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
@@ -45,20 +43,19 @@ ts_fstab_add "LABEL=$LABEL"
# variant A)
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
# variant C)
$TS_CMD_MOUNT LABEL=$LABEL 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "C) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "C) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-label2devname b/tests/ts/mount/fstab-label2devname
index 3f29a89151..6bb23a5f95 100755
--- a/tests/ts/mount/fstab-label2devname
+++ b/tests/ts/mount/fstab-label2devname
@@ -29,15 +29,13 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
-
-mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
@@ -45,15 +43,14 @@ ts_fstab_add "$DEVICE"
# variant A)
$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-label2uuid b/tests/ts/mount/fstab-label2uuid
index 23cdb8fdaa..08a2927bf8 100755
--- a/tests/ts/mount/fstab-label2uuid
+++ b/tests/ts/mount/fstab-label2uuid
@@ -30,17 +30,15 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
-
-mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
@@ -50,15 +48,14 @@ ts_fstab_add "UUID=$UUID"
# variant A)
$TS_CMD_MOUNT -L $LABEL 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT "LABEL=$LABEL" 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-none b/tests/ts/mount/fstab-none
index 082afe9059..b90008f005 100755
--- a/tests/ts/mount/fstab-none
+++ b/tests/ts/mount/fstab-none
@@ -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
diff --git a/tests/ts/mount/fstab-symlink b/tests/ts/mount/fstab-symlink
index dfb97d15df..bf00e13556 100755
--- a/tests/ts/mount/fstab-symlink
+++ b/tests/ts/mount/fstab-symlink
@@ -29,16 +29,14 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
LINKNAME="$TS_OUTDIR/${TS_TESTNAME}_lnk"
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
@@ -49,8 +47,8 @@ ts_fstab_add $LINKNAME $TS_MOUNTPOINT "auto" "defaults,user"
# variant A) -- UID=0
$TS_CMD_MOUNT $LINKNAME 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME"
# varian B) -- disabled, the $TS_CMD_MOUNT is usually not a real program, but
# libtool wrapper and the real mount is exec()ed with
@@ -61,11 +59,10 @@ $TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME" $DEVICE
#
#su $TS_TESTUSER -c "$TS_CMD_MOUNT -v -v -v $LINKNAME" 2>&1 >> $TS_OUTPUT
#ts_is_mounted $DEVICE
-# || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
+# || ts_die "B) Cannot find $DEVICE in /proc/mounts"
#su $TS_TESTUSER -c "$TS_CMD_UMOUNT $LINKNAME" 2>&1 >> $TS_OUTPUT \
-# || ts_die "B) Cannot umount $LINKNAME" $DEVICE
+# || ts_die "B) Cannot umount $LINKNAME"
-ts_device_deinit $DEVICE
ts_fstab_clean
rm -f $LINKNAME
diff --git a/tests/ts/mount/fstab-uuid b/tests/ts/mount/fstab-uuid
index 789eda4a07..6d7c5bf3cd 100755
--- a/tests/ts/mount/fstab-uuid
+++ b/tests/ts/mount/fstab-uuid
@@ -28,14 +28,12 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
@@ -45,20 +43,19 @@ ts_fstab_add "UUID=$UUID"
# varian A)
$TS_CMD_MOUNT $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# varian B)
$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
# varian C)
$TS_CMD_MOUNT UUID=$UUID 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "C) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "C) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "C) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-uuid2devname b/tests/ts/mount/fstab-uuid2devname
index 3b2c4792b9..6c90097205 100755
--- a/tests/ts/mount/fstab-uuid2devname
+++ b/tests/ts/mount/fstab-uuid2devname
@@ -28,14 +28,12 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
@@ -45,15 +43,14 @@ ts_fstab_add "$DEVICE"
# variant A)
$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/fstab-uuid2label b/tests/ts/mount/fstab-uuid2label
index d275f41494..77895e31c2 100755
--- a/tests/ts/mount/fstab-uuid2label
+++ b/tests/ts/mount/fstab-uuid2label
@@ -29,17 +29,15 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
-
-mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
@@ -49,15 +47,14 @@ ts_fstab_add "LABEL=$LABEL"
# variant A)
$TS_CMD_MOUNT -U $UUID 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT "UUID=$UUID" 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
-ts_device_deinit $DEVICE
ts_fstab_clean
ts_log "Success"
diff --git a/tests/ts/mount/label b/tests/ts/mount/label
index 79c2c8754e..5e935c032c 100755
--- a/tests/ts/mount/label
+++ b/tests/ts/mount/label
@@ -30,29 +30,25 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
-
-mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 -L $LABEL $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
# variant A)
$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT LABEL=$LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
-
-ts_device_deinit $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
ts_log "Success"
ts_finalize
diff --git a/tests/ts/mount/regfile b/tests/ts/mount/regfile
index fd908356da..8278e84b1e 100755
--- a/tests/ts/mount/regfile
+++ b/tests/ts/mount/regfile
@@ -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"
diff --git a/tests/ts/mount/remount b/tests/ts/mount/remount
index 6814e313ee..9fa14b6b8c 100755
--- a/tests/ts/mount/remount
+++ b/tests/ts/mount/remount
@@ -31,28 +31,26 @@ ts_check_losetup
# mountpoint
[ -d $TS_MOUNTPOINT ] || mkdir -p $TS_MOUNTPOINT
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
-mkfs.ext2 $DEVICE &> /dev/null || ts_die "Cannot make ext2 on $DEVICE" $DEVICE
+mkfs.ext2 $DEVICE &> /dev/null || ts_die "Cannot make ext2 on $DEVICE"
# mount read-write
-$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT || ts_die "Cannot mount $TS_MOUNTPOINT" $DEVICE
+$TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT || ts_die "Cannot mount $TS_MOUNTPOINT"
# check the mount
egrep -q "^$DEVICE $TS_MOUNTPOINT" /etc/mtab \
- || ts_die "Cannot find $TS_MOUNTPOINT in /etc/mtab" $DEVICE
+ || ts_die "Cannot find $TS_MOUNTPOINT in /etc/mtab"
# remount
$TS_CMD_MOUNT -o remount,ro $TS_MOUNTPOINT \
- || ts_die "Cannot remount $TS_MOUNTPOINT" $DEVICE
+ || ts_die "Cannot remount $TS_MOUNTPOINT"
# check the remount
$TS_CMD_FINDMNT --kernel --mountpoint "$TS_MOUNTPOINT" --options "ro" &> /dev/null
[ "$?" == "0" ] || ts_die "Cannot find read-only in $TS_MOUNTPOINT in /proc/self/mountinfo"
-ts_device_deinit $DEVICE
-
ts_log "Success"
ts_finalize
diff --git a/tests/ts/mount/rlimit b/tests/ts/mount/rlimit
index 2eaeb501be..5e6880c4fe 100755
--- a/tests/ts/mount/rlimit
+++ b/tests/ts/mount/rlimit
@@ -39,17 +39,15 @@ 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}'
}
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_init_subtest "mount"
@@ -87,7 +85,5 @@ else
fi
ts_finalize_subtest
-
-ts_device_deinit $DEVICE
ts_log "Success"
ts_finalize
diff --git a/tests/ts/mount/shared-subtree b/tests/ts/mount/shared-subtree
index efce11a102..b68a1aa99f 100755
--- a/tests/ts/mount/shared-subtree
+++ b/tests/ts/mount/shared-subtree
@@ -59,11 +59,11 @@ ts_finalize_subtest
#
# block dev based mounts
#
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
+ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
ts_init_subtest "mount-private"
@@ -80,7 +80,6 @@ $TS_CMD_FINDMNT -nr --mountpoint $MOUNTPOINT -o VFS-OPTIONS >> $TS_OUTPUT
$TS_CMD_UMOUNT $MOUNTPOINT
ts_finalize_subtest
-ts_device_deinit $DEVICE
rmdir $MOUNTPOINT
ts_log "Success"
diff --git a/tests/ts/mount/uuid b/tests/ts/mount/uuid
index df1597d530..6af358c7db 100755
--- a/tests/ts/mount/uuid
+++ b/tests/ts/mount/uuid
@@ -28,14 +28,12 @@ ts_check_prog "mkfs.ext3"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
+ts_device_init
+DEVICE=$TS_LODEV
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
-mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
-
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
@@ -43,15 +41,13 @@ UUID=$(ts_uuid_by_devname $DEVICE)
# variant A)
$TS_CMD_MOUNT -U $UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE" $DEVICE
+ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "A) Cannot umount $DEVICE"
# variant B)
$TS_CMD_MOUNT UUID=$UUID $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
-ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts" $DEVICE
-$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE" $DEVICE
-
-ts_device_deinit $DEVICE
+ts_is_mounted $DEVICE || ts_die "B) Cannot find $DEVICE in /proc/mounts"
+$TS_CMD_UMOUNT $DEVICE || ts_die "B) Cannot umount $DEVICE"
ts_log "Success"
ts_finalize
diff --git a/tests/ts/script/race b/tests/ts/script/race
index a1e35b8f25..02c8187d6a 100755
--- a/tests/ts/script/race
+++ b/tests/ts/script/race
@@ -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
diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname
index 934455df35..a4cf99f419 100755
--- a/tests/ts/swapon/devname
+++ b/tests/ts/swapon/devname
@@ -28,22 +28,19 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
- || ts_die "Cannot make swap $DEVICE" $DEVICE
+ || ts_die "Cannot make swap $DEVICE"
-ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE
+ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
$TS_CMD_SWAPON $DEVICE 2>&1 >> $TS_OUTPUT
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
-ts_device_deinit $DEVICE
ts_log "Success"
ts_finalize
diff --git a/tests/ts/swapon/fixpgsz b/tests/ts/swapon/fixpgsz
index 8296951ec7..2e1aa57d31 100755
--- a/tests/ts/swapon/fixpgsz
+++ b/tests/ts/swapon/fixpgsz
@@ -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)
#
@@ -28,22 +26,22 @@ else
BADSIZE=4096
fi
-DEVICE=$(ts_device_init)
+ts_device_init
+DEVICE=$TS_LODEV
$TS_CMD_MKSWAP -L MyFooBarLabel --pagesize $BADSIZE $DEVICE > /dev/null &> /dev/null \
- || ts_die "Cannot make swap $DEVICE" $DEVICE
+ || ts_die "Cannot make swap $DEVICE"
-ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE
+ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
#
# Swapon
#
$TS_CMD_SWAPON --fixpgsz $DEVICE &> /dev/null
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
-ts_device_deinit $DEVICE
ts_log "Success"
ts_finalize
diff --git a/tests/ts/swapon/fixsig b/tests/ts/swapon/fixsig
index c1b4cb6c22..6fceb79f80 100755
--- a/tests/ts/swapon/fixsig
+++ b/tests/ts/swapon/fixsig
@@ -13,20 +13,18 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
PAGESIZE=$($TS_HELPER_SYSINFO pagesize)
#
# Create a swap-area
#
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
- || ts_die "Cannot make swap $DEVICE" $DEVICE
+ || ts_die "Cannot make swap $DEVICE"
-ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" $DEVICE
+ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
#
# Rewrite signature to swsuspend
@@ -35,17 +33,16 @@ echo "S2SUSPEND " > $TS_OUTPUT.signature
dd if=$TS_OUTPUT.signature of=$DEVICE \
seek=$(( $PAGESIZE - 10 )) count=10 bs=1 conv=notrunc &> /dev/null
-ts_device_has "TYPE" "swsuspend" $DEVICE || ts_die "Cannot find swsuspend on $DEVICE" $DEVICE
+ts_device_has "TYPE" "swsuspend" $DEVICE || ts_die "Cannot find swsuspend on $DEVICE"
#
# Swapon
#
$TS_CMD_SWAPON $DEVICE &> /dev/null
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
-ts_device_deinit $DEVICE
ts_log "Success"
ts_finalize
diff --git a/tests/ts/swapon/label b/tests/ts/swapon/label
index 329b1af080..187ccf9c6c 100755
--- a/tests/ts/swapon/label
+++ b/tests/ts/swapon/label
@@ -29,23 +29,20 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
$TS_CMD_MKSWAP -L $LABEL $DEVICE > /dev/null 2>> $TS_OUTPUT \
- || ts_die "Cannot make swap on $DEVICE" $DEVICE
+ || ts_die "Cannot make swap on $DEVICE"
ts_device_has "LABEL" $LABEL $DEVICE \
- || ts_die "Cannot find LABEL '$LABEL' on $DEVICE" $DEVICE
+ || ts_die "Cannot find LABEL '$LABEL' on $DEVICE"
$TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
-ts_device_deinit $DEVICE
ts_log "Success"
ts_finalize
diff --git a/tests/ts/swapon/uuid b/tests/ts/swapon/uuid
index 2ea4931841..2a8d78f30a 100755
--- a/tests/ts/swapon/uuid
+++ b/tests/ts/swapon/uuid
@@ -28,24 +28,21 @@ ts_check_test_command "$TS_CMD_SWAPOFF"
ts_skip_nonroot
ts_check_losetup
-set -o pipefail
-
-DEVICE=$(ts_device_init)
-[ "$?" == 0 ] || ts_die "Cannot init device"
+ts_device_init
+DEVICE=$TS_LODEV
$TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
- || ts_die "Cannot make swap $DEVICE" $DEVICE
+ || ts_die "Cannot make swap $DEVICE"
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
+ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE"
UUID=$(ts_uuid_by_devname $DEVICE)
$TS_CMD_SWAPON -U $UUID 2>&1 >> $TS_OUTPUT
-grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" $DEVICE
+grep -q $DEVICE /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
$TS_CMD_SWAPOFF $DEVICE
-ts_device_deinit $DEVICE
ts_log "Success"
ts_finalize