dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
304038
From 9e643d190c1c3b39423c4d00f1ddc89e2b4cc09e Mon Sep 17 00:00:00 2001
304038
From: Ruediger Meier <ruediger.meier@ga-group.nl>
304038
Date: Sun, 11 May 2014 08:50:28 +0200
304038
Subject: [PATCH 139/141] tests: ts_scsi_debug_init must not run in a subshell
304038
304038
ts_skip and ts_die won't work from subshell. Now we simply use
304038
TS_DEVICE which is globally set in that function.
304038
304038
I've made sure that we never change TS_DEVICE variable after
304038
we've got it. So we could use it again for cleanup on exit in
304038
ts_{finalize,die,skip} functions.
304038
304038
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1454652
304038
Upstream: http://github.com/karelzak/util-linux/commit/f45df374ffc311220bd395da985b121eccfb4045
304038
Signed-off-by: Karel Zak <kzak@redhat.com>
304038
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
304038
---
304038
 tests/ts/blkid/md-raid1-part          | 25 +++++++++++++++-------
304038
 tests/ts/eject/umount                 | 39 ++++++++++++++++++-----------------
304038
 tests/ts/fdisk/align-512-4K           |  9 ++++----
304038
 tests/ts/fdisk/align-512-4K-63        |  9 ++++----
304038
 tests/ts/fdisk/align-512-4K-md        | 12 ++++++-----
304038
 tests/ts/fdisk/align-512-512-topology | 10 ++++-----
304038
 tests/ts/libmount/context             |  9 ++++----
304038
 tests/ts/libmount/context-utab        |  9 ++++----
304038
 tests/ts/libmount/tabfiles-tags       | 15 +++++++-------
304038
 tests/ts/mount/umount-alltargets      | 29 +++++++++++++-------------
304038
 tests/ts/mount/umount-recursive       | 21 ++++++++++---------
304038
 11 files changed, 104 insertions(+), 83 deletions(-)
304038
304038
diff --git a/tests/ts/blkid/md-raid1-part b/tests/ts/blkid/md-raid1-part
304038
index 46bde0ec8..20612ec21 100755
304038
--- a/tests/ts/blkid/md-raid1-part
304038
+++ b/tests/ts/blkid/md-raid1-part
304038
@@ -23,10 +23,11 @@ TS_DESC="MD raid1 (last partition)"
304038
 ts_init "$*"
304038
 ts_skip_nonroot
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=51 sector_size=512)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=51 sector_size=512
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <
304038
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <
304038
 n
304038
 p
304038
 1
304038
@@ -42,6 +43,16 @@ w
304038
 q
304038
 EOF
304038
 
304038
+# replace generated ID with something stable
304038
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <
304038
+x
304038
+i
304038
+0x1
304038
+r
304038
+w
304038
+q
304038
+EOF
304038
+
304038
 udevadm settle
304038
 MD_DEVNAME=md8
304038
 MD_DEVICE=/dev/${MD_DEVNAME}
304038
@@ -49,24 +60,24 @@ MD_DEVICE=/dev/${MD_DEVNAME}
304038
 ts_log "Create RAID1 device"
304038
 /sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
304038
 /sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 --level=1 \
304038
-	    --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1
304038
+	    --raid-devices=2 ${TS_DEVICE}1 ${TS_DEVICE}2 >> $TS_OUTPUT 2>&1
304038
 udevadm settle
304038
 
304038
 ts_log "Probe whole-disk"
304038
-$TS_CMD_BLKID -p -o udev ${DEVICE} 2>&1 | sort >> $TS_OUTPUT
304038
+$TS_CMD_BLKID -p -o udev ${TS_DEVICE} 2>&1 | sort >> $TS_OUTPUT
304038
 
304038
 ts_log "Probe first RAID member"
304038
-$TS_CMD_BLKID -p -o udev ${DEVICE}1 2>&1 | sort >> $TS_OUTPUT
304038
+$TS_CMD_BLKID -p -o udev ${TS_DEVICE}1 2>&1 | sort >> $TS_OUTPUT
304038
 
304038
 ts_log "Probe second RAID member"
304038
-$TS_CMD_BLKID -p -o udev ${DEVICE}2 2>&1 | sort >> $TS_OUTPUT
304038
+$TS_CMD_BLKID -p -o udev ${TS_DEVICE}2 2>&1 | sort >> $TS_OUTPUT
304038
 
304038
 /sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
304038
 
304038
 udevadm settle
304038
 rmmod scsi_debug
304038
 
304038
-ts_fdisk_clean $DEVICE
304038
+ts_fdisk_clean $TS_DEVICE
304038
 # substitue UUIDs and major/minor number before comparison
304038
 sed -i \
304038
   -e         's/^\(ID_FS_UUID\)=.*/\1=__ts_uuid__/' \
304038
diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount
304038
index 3c1f84edf..994ddb483 100755
304038
--- a/tests/ts/eject/umount
304038
+++ b/tests/ts/eject/umount
304038
@@ -12,6 +12,7 @@ ts_skip_nonroot
304038
 # not removable device.
304038
 #
304038
 
304038
+# set global variable TS_DEVICE
304038
 function init_device {
304038
 	ts_scsi_debug_init dev_size_mb=100
304038
 }
304038
@@ -47,50 +48,50 @@ function deinit_device {
304038
 
304038
 
304038
 ts_init_subtest "by-disk"
304038
-DEVICE=$(init_device)
304038
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
304038
+init_device
304038
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
304038
 deinit_device
304038
 ts_finalize_subtest
304038
 
304038
 ts_init_subtest "by-disk-mounted"
304038
-DEVICE=$(init_device)
304038
-mkfs.ext2 -q -F $DEVICE
304038
+init_device
304038
+mkfs.ext2 -q -F $TS_DEVICE
304038
 udevadm settle
304038
 mkdir -p $TS_MOUNTPOINT
304038
-mount $DEVICE $TS_MOUNTPOINT
304038
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
304038
+mount $TS_DEVICE $TS_MOUNTPOINT
304038
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
304038
 deinit_device
304038
 ts_finalize_subtest
304038
 
304038
 
304038
 ts_init_subtest "by-disk-mounted-partition"
304038
-DEVICE=$(init_device)
304038
-init_partitions $DEVICE
304038
+init_device
304038
+init_partitions $TS_DEVICE
304038
 mkdir -p ${TS_MOUNTPOINT}1
304038
 mkdir -p ${TS_MOUNTPOINT}2
304038
-mount ${DEVICE}1 ${TS_MOUNTPOINT}1
304038
-mount ${DEVICE}2 ${TS_MOUNTPOINT}2
304038
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
304038
+mount ${TS_DEVICE}1 ${TS_MOUNTPOINT}1
304038
+mount ${TS_DEVICE}2 ${TS_MOUNTPOINT}2
304038
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
304038
 deinit_device
304038
 ts_finalize_subtest
304038
 
304038
 
304038
 ts_init_subtest "by-partition"
304038
-DEVICE=$(init_device)
304038
-init_partitions $DEVICE
304038
-$TS_CMD_EJECT --force ${DEVICE}1 && ts_log "Success"
304038
+init_device
304038
+init_partitions $TS_DEVICE
304038
+$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success"
304038
 deinit_device
304038
 ts_finalize_subtest
304038
 
304038
 
304038
 ts_init_subtest "by-partition-mounted"
304038
-DEVICE=$(init_device)
304038
-init_partitions $DEVICE
304038
+init_device
304038
+init_partitions $TS_DEVICE
304038
 mkdir -p ${TS_MOUNTPOINT}1
304038
 mkdir -p ${TS_MOUNTPOINT}2
304038
-mount ${DEVICE}1 ${TS_MOUNTPOINT}1
304038
-mount ${DEVICE}2 ${TS_MOUNTPOINT}2
304038
-$TS_CMD_EJECT --force ${DEVICE}1 && ts_log "Success"
304038
+mount ${TS_DEVICE}1 ${TS_MOUNTPOINT}1
304038
+mount ${TS_DEVICE}2 ${TS_MOUNTPOINT}2
304038
+$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success"
304038
 deinit_device
304038
 ts_finalize_subtest
304038
 
304038
diff --git a/tests/ts/fdisk/align-512-4K b/tests/ts/fdisk/align-512-4K
304038
index c5ea72e7a..5608b1b65 100755
304038
--- a/tests/ts/fdisk/align-512-4K
304038
+++ b/tests/ts/fdisk/align-512-4K
304038
@@ -27,11 +27,12 @@ TS_DESC="align 512/4K"
304038
 ts_init "$*"
304038
 ts_skip_nonroot
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3)
304038
-DEVNAME=$(basename $DEVICE)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3
304038
+DEVNAME=$(basename $TS_DEVICE)
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <
304038
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <
304038
 n
304038
 p
304038
 1
304038
@@ -71,6 +72,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP
304038
 
304038
 rmmod scsi_debug
304038
 
304038
-ts_fdisk_clean $DEVICE
304038
+ts_fdisk_clean $TS_DEVICE
304038
 
304038
 ts_finalize
304038
diff --git a/tests/ts/fdisk/align-512-4K-63 b/tests/ts/fdisk/align-512-4K-63
304038
index 4ec81982f..8199cf7b3 100755
304038
--- a/tests/ts/fdisk/align-512-4K-63
304038
+++ b/tests/ts/fdisk/align-512-4K-63
304038
@@ -27,11 +27,12 @@ TS_DESC="align 512/4K +alignment_offset"
304038
 ts_init "$*"
304038
 ts_skip_nonroot
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7)
304038
-DEVNAME=$(basename $DEVICE)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3 lowest_aligned=7
304038
+DEVNAME=$(basename $TS_DEVICE)
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <
304038
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <
304038
 n
304038
 p
304038
 1
304038
@@ -71,6 +72,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP
304038
 
304038
 rmmod scsi_debug
304038
 
304038
-ts_fdisk_clean $DEVICE
304038
+ts_fdisk_clean $TS_DEVICE
304038
 
304038
 ts_finalize
304038
diff --git a/tests/ts/fdisk/align-512-4K-md b/tests/ts/fdisk/align-512-4K-md
304038
index 09947ff9e..ad662e0e8 100755
304038
--- a/tests/ts/fdisk/align-512-4K-md
304038
+++ b/tests/ts/fdisk/align-512-4K-md
304038
@@ -27,11 +27,12 @@ TS_DESC="align 512/4K +MD"
304038
 ts_init "$*"
304038
 ts_skip_nonroot
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3)
304038
-DEVNAME=$(basename $DEVICE)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50 sector_size=512 physblk_exp=3
304038
+DEVNAME=$(basename $TS_DEVICE)
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <
304038
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <
304038
 n
304038
 p
304038
 1
304038
@@ -56,7 +57,7 @@ MD_DEVICE=/dev/${MD_DEVNAME}
304038
 
304038
 /sbin/mdadm -q -S ${MD_DEVICE} &> /dev/null
304038
 /sbin/mdadm -q --create ${MD_DEVICE} --metadata=0.90 --chunk=64 \
304038
-	    --level=0 --raid-devices=2 ${DEVICE}1 ${DEVICE}2 >> $TS_OUTPUT 2>&1
304038
+	    --level=0 --raid-devices=2 ${TS_DEVICE}1 ${TS_DEVICE}2 >> $TS_OUTPUT 2>&1
304038
 
304038
 udevadm settle
304038
 ts_log "Create partitions (MD)"
304038
@@ -85,6 +86,7 @@ cat /sys/block/${MD_DEVNAME}/${MD_DEVNAME}p{1,2}/alignment_offset >> $TS_OUTPUT
304038
 udevadm settle
304038
 rmmod scsi_debug
304038
 
304038
-ts_fdisk_clean $DEVICE
304038
+ts_fdisk_clean $TS_DEVICE
304038
+ts_fdisk_clean $MD_DEVICE
304038
 
304038
 ts_finalize
304038
diff --git a/tests/ts/fdisk/align-512-512-topology b/tests/ts/fdisk/align-512-512-topology
304038
index 9354e45c7..65cb03f1d 100755
304038
--- a/tests/ts/fdisk/align-512-512-topology
304038
+++ b/tests/ts/fdisk/align-512-512-topology
304038
@@ -27,12 +27,12 @@ TS_DESC="align 512/512 +topology"
304038
 ts_init "$*"
304038
 ts_skip_nonroot
304038
 
304038
-
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512)
304038
-DEVNAME=$(basename $DEVICE)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50 sector_size=512
304038
+DEVNAME=$(basename $TS_DEVICE)
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} >> $TS_OUTPUT 2>&1 <
304038
+$TS_CMD_FDISK ${TS_DEVICE} >> $TS_OUTPUT 2>&1 <
304038
 n
304038
 p
304038
 1
304038
@@ -72,6 +72,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP
304038
 
304038
 rmmod scsi_debug
304038
 
304038
-ts_fdisk_clean $DEVICE
304038
+ts_fdisk_clean $TS_DEVICE
304038
 
304038
 ts_finalize
304038
diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context
304038
index 0c3bce986..873890378 100755
304038
--- a/tests/ts/libmount/context
304038
+++ b/tests/ts/libmount/context
304038
@@ -21,11 +21,12 @@ TS_NOEXIST="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-noex"
304038
 ts_log "Init device"
304038
 umount $MOUNTPOINT &> /dev/null
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=100)
304038
-DEVNAME=$(basename $DEVICE)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=100
304038
+DEVNAME=$(basename $TS_DEVICE)
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <
304038
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <
304038
 n
304038
 p
304038
 1
304038
@@ -35,7 +36,7 @@ w
304038
 q
304038
 EOF
304038
 
304038
-DEVICE="${DEVICE}1"
304038
+DEVICE="${TS_DEVICE}1"
304038
 
304038
 sleep 1
304038
 udevadm settle
304038
diff --git a/tests/ts/libmount/context-utab b/tests/ts/libmount/context-utab
304038
index b2bfefc69..d57a64e6d 100755
304038
--- a/tests/ts/libmount/context-utab
304038
+++ b/tests/ts/libmount/context-utab
304038
@@ -16,11 +16,12 @@ MOUNTPOINT="$TS_MOUNTPOINT"
304038
 
304038
 [ -x $TESTPROG ] || ts_skip "test not compiled"
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=100)
304038
-DEVNAME=$(basename $DEVICE)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=100
304038
+DEVNAME=$(basename $TS_DEVICE)
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <
304038
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <
304038
 n
304038
 p
304038
 1
304038
@@ -30,7 +31,7 @@ w
304038
 q
304038
 EOF
304038
 
304038
-DEVICE="${DEVICE}1"
304038
+DEVICE="${TS_DEVICE}1"
304038
 
304038
 sleep 1
304038
 udevadm settle
304038
diff --git a/tests/ts/libmount/tabfiles-tags b/tests/ts/libmount/tabfiles-tags
304038
index f52c4047c..fbd7daf47 100755
304038
--- a/tests/ts/libmount/tabfiles-tags
304038
+++ b/tests/ts/libmount/tabfiles-tags
304038
@@ -11,17 +11,18 @@ TESTPROG="$TS_HELPER_LIBMOUNT_TAB"
304038
 
304038
 [ -x $TESTPROG ] || ts_skip "test not compiled"
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50 sector_size=512
304038
 LABEL="testLibmount"
304038
 UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"
304038
 
304038
 #
304038
 # Create filesystem
304038
 #
304038
-mkfs.ext3 -F -L $LABEL $DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
304038
+mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE" $TS_DEVICE
304038
 udevadm settle
304038
 
304038
-ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE
304038
+ts_device_has_uuid $TS_DEVICE || ts_die "Cannot find UUID on $TS_DEVICE" $TS_DEVICE
304038
 
304038
 FSTAB="$TS_OUTDIR/fstab"
304038
 
304038
@@ -36,7 +37,7 @@ sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
304038
 ts_finalize_subtest
304038
 
304038
 ts_init_subtest "fstab-label2dev"
304038
-ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
304038
+ts_valgrind $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
304038
 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
304038
 ts_finalize_subtest
304038
 
304038
@@ -60,18 +61,18 @@ ts_finalize_subtest
304038
 
304038
 ts_init_subtest "fstab-dev2label"
304038
 # has to return /mnt/mountpoint
304038
-ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
304038
+ts_valgrind $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
304038
 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
304038
 ts_finalize_subtest
304038
 
304038
 #
304038
 # Add devname
304038
 #
304038
-echo "$DEVICE  /mnt/mountpoint3 auto defaults" >> $FSTAB
304038
+echo "$TS_DEVICE  /mnt/mountpoint3 auto defaults" >> $FSTAB
304038
 
304038
 ts_init_subtest "fstab-dev"
304038
 # has to return /mnt/mountpoint3
304038
-ts_valgrind $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
304038
+ts_valgrind $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
304038
 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
304038
 sed -i -e 's/source: .*//g' $TS_OUTPUT		# devname is generated, remove it
304038
 ts_finalize_subtest
304038
diff --git a/tests/ts/mount/umount-alltargets b/tests/ts/mount/umount-alltargets
304038
index 434ecab2d..ae35e320a 100755
304038
--- a/tests/ts/mount/umount-alltargets
304038
+++ b/tests/ts/mount/umount-alltargets
304038
@@ -12,10 +12,11 @@ ts_skip_nonroot
304038
 $TS_CMD_UMOUNT --help | grep -q all-targets
304038
 [ $? -eq 1 ] && ts_skip "all-targets unsupported"
304038
 
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <
304038
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <
304038
 n
304038
 p
304038
 1
304038
@@ -42,13 +43,13 @@ EOF
304038
 udevadm settle
304038
 
304038
 ts_log "Create filesystem A"
304038
-mkfs.ext2 ${DEVICE}1 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}1 &> /dev/null
304038
 ts_log "Create filesystem B"
304038
-mkfs.ext2 ${DEVICE}2 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}2 &> /dev/null
304038
 ts_log "Create filesystem C"
304038
-mkfs.ext2 ${DEVICE}3 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}3 &> /dev/null
304038
 ts_log "Create filesystem D"
304038
-mkfs.ext2 ${DEVICE}4 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}4 &> /dev/null
304038
 
304038
 udevadm settle
304038
 
304038
@@ -76,7 +77,7 @@ MOUNTPOINT=$TS_MOUNTPOINT
304038
 # The same device mounted on more places, umount all by mountpoint name
304038
 #
304038
 ts_init_subtest "all-targets-mnt"
304038
-multi_mount ${DEVICE}1 $MOUNTPOINT
304038
+multi_mount ${TS_DEVICE}1 $MOUNTPOINT
304038
 $TS_CMD_UMOUNT --all-targets ${MOUNTPOINT}1 >> $TS_OUTPUT 2>&1
304038
 [ $? == 0 ] || ts_log "umount failed"
304038
 ts_finalize_subtest
304038
@@ -85,8 +86,8 @@ ts_finalize_subtest
304038
 # The same device mounted on more places, umount all by device name
304038
 #
304038
 ts_init_subtest "all-targets-dev"
304038
-multi_mount ${DEVICE}1 $MOUNTPOINT
304038
-$TS_CMD_UMOUNT --all-targets ${DEVICE}1 >> $TS_OUTPUT 2>&1
304038
+multi_mount ${TS_DEVICE}1 $MOUNTPOINT
304038
+$TS_CMD_UMOUNT --all-targets ${TS_DEVICE}1 >> $TS_OUTPUT 2>&1
304038
 [ $? == 0 ] || ts_log "umount failed"
304038
 ts_finalize_subtest
304038
 
304038
@@ -95,14 +96,14 @@ ts_finalize_subtest
304038
 # sub-mounts. Umount all by one umount all by top-level device name.
304038
 #
304038
 ts_init_subtest "all-targets-recursive"
304038
-multi_mount ${DEVICE}1 $MOUNTPOINT
304038
+multi_mount ${TS_DEVICE}1 $MOUNTPOINT
304038
 [ -d "${MOUNTPOINT}1/subA" ] || mkdir -p ${MOUNTPOINT}1/subA
304038
-$TS_CMD_MOUNT ${DEVICE}2 ${MOUNTPOINT}1/subA
304038
+$TS_CMD_MOUNT ${TS_DEVICE}2 ${MOUNTPOINT}1/subA
304038
 [ -d "${MOUNTPOINT}1/subA/subAB" ] || mkdir -p ${MOUNTPOINT}1/subA/subAB
304038
-$TS_CMD_MOUNT ${DEVICE}3 ${MOUNTPOINT}1/subA/subAB
304038
+$TS_CMD_MOUNT ${TS_DEVICE}3 ${MOUNTPOINT}1/subA/subAB
304038
 [ -d "${MOUNTPOINT}1/subB" ] || mkdir -p ${MOUNTPOINT}1/subB
304038
-$TS_CMD_MOUNT ${DEVICE}4 ${MOUNTPOINT}1/subB
304038
-$TS_CMD_UMOUNT --recursive --all-targets ${DEVICE}1 >> $TS_OUTPUT 2>&1
304038
+$TS_CMD_MOUNT ${TS_DEVICE}4 ${MOUNTPOINT}1/subB
304038
+$TS_CMD_UMOUNT --recursive --all-targets ${TS_DEVICE}1 >> $TS_OUTPUT 2>&1
304038
 [ $? == 0 ] || ts_log "umount failed"
304038
 ts_finalize_subtest
304038
 
304038
diff --git a/tests/ts/mount/umount-recursive b/tests/ts/mount/umount-recursive
304038
index 85e54df7a..9b9a7a1f1 100755
304038
--- a/tests/ts/mount/umount-recursive
304038
+++ b/tests/ts/mount/umount-recursive
304038
@@ -13,10 +13,11 @@ $TS_CMD_UMOUNT --help | grep -q recursive
304038
 [ $? -eq 1 ] && ts_skip "recursive unsupported"
304038
 
304038
 ts_log "Init device"
304038
-DEVICE=$(ts_scsi_debug_init dev_size_mb=50)
304038
+# set global variable TS_DEVICE
304038
+ts_scsi_debug_init dev_size_mb=50
304038
 
304038
 ts_log "Create partitions"
304038
-$TS_CMD_FDISK ${DEVICE} &> /dev/null <
304038
+$TS_CMD_FDISK ${TS_DEVICE} &> /dev/null <
304038
 n
304038
 p
304038
 1
304038
@@ -43,13 +44,13 @@ EOF
304038
 udevadm settle
304038
 
304038
 ts_log "Create filesystem A"
304038
-mkfs.ext2 ${DEVICE}1 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}1 &> /dev/null
304038
 ts_log "Create filesystem B"
304038
-mkfs.ext2 ${DEVICE}2 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}2 &> /dev/null
304038
 ts_log "Create filesystem C"
304038
-mkfs.ext2 ${DEVICE}3 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}3 &> /dev/null
304038
 ts_log "Create filesystem D"
304038
-mkfs.ext2 ${DEVICE}4 &> /dev/null
304038
+mkfs.ext2 ${TS_DEVICE}4 &> /dev/null
304038
 
304038
 udevadm settle
304038
 
304038
@@ -58,12 +59,12 @@ ts_log "Do tests..."
304038
 [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
304038
 
304038
 ts_log "A) Mount root"
304038
-$TS_CMD_MOUNT ${DEVICE}1 $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1
304038
+$TS_CMD_MOUNT ${TS_DEVICE}1 $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1
304038
 $TS_CMD_MOUNT --make-shared $TS_MOUNTPOINT
304038
 
304038
 ts_log "B) Mount child"
304038
 mkdir -p $TS_MOUNTPOINT/mntB
304038
-$TS_CMD_MOUNT ${DEVICE}2 $TS_MOUNTPOINT/mntB >> $TS_OUTPUT 2>&1
304038
+$TS_CMD_MOUNT ${TS_DEVICE}2 $TS_MOUNTPOINT/mntB >> $TS_OUTPUT 2>&1
304038
 
304038
 ts_log "B2) Mount child-bind"
304038
 mkdir -p $TS_MOUNTPOINT/bindB
304038
@@ -71,10 +72,10 @@ $TS_CMD_MOUNT --bind $TS_MOUNTPOINT/mntB $TS_MOUNTPOINT/bindB >> $TS_OUTPUT 2>&1
304038
 
304038
 ts_log "C) Mount child/child"
304038
 mkdir -p $TS_MOUNTPOINT/mntB/mnt{C,D}
304038
-$TS_CMD_MOUNT ${DEVICE}3 $TS_MOUNTPOINT/mntB/mntC >> $TS_OUTPUT 2>&1
304038
+$TS_CMD_MOUNT ${TS_DEVICE}3 $TS_MOUNTPOINT/mntB/mntC >> $TS_OUTPUT 2>&1
304038
 
304038
 ts_log "D) Mount child/child"
304038
-$TS_CMD_MOUNT ${DEVICE}4 $TS_MOUNTPOINT/mntB/mntD >> $TS_OUTPUT 2>&1
304038
+$TS_CMD_MOUNT ${TS_DEVICE}4 $TS_MOUNTPOINT/mntB/mntD >> $TS_OUTPUT 2>&1
304038
 
304038
 ts_log "E) Mount child-bind"
304038
 mkdir -p $TS_MOUNTPOINT/bindC
304038
-- 
304038
2.13.6
304038