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