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