summaryrefslogtreecommitdiffstats
path: root/tests/ts/losetup/losetup
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ts/losetup/losetup')
-rwxr-xr-xtests/ts/losetup/losetup14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/ts/losetup/losetup b/tests/ts/losetup/losetup
index 234c58f6f..804518998 100755
--- a/tests/ts/losetup/losetup
+++ b/tests/ts/losetup/losetup
@@ -24,9 +24,19 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_LOSETUP"
+# Before checking for loop support we would need to test if losetup -f works at
+# all. At least we do a simple executable test for now.
+$TS_CMD_LOSETUP --version >/dev/null 2>$TS_OUTPUT || ts_failed
+$TS_CMD_LOSETUP --unknownopt >>$TS_OUTPUT 2>/dev/null && ts_failed
+test -s $TS_OUTPUT && ts_failed
+rm -f $TS_OUTPUT
+
ts_skip_nonroot
+ts_check_losetup
+
-DEVICE=$(ts_scsi_debug_init dev_size_mb=11)
+# set global variable TS_DEVICE
+ts_scsi_debug_init dev_size_mb=11
REFILE=$(ts_image_init 10)
function lo_print {
@@ -84,7 +94,7 @@ rm -rf $BACKFILE
#
# Backing file is a block device
#
-BACKFILE="$DEVICE"
+BACKFILE="$TS_DEVICE"
ts_init_subtest "blkdev"
LODEV=$( $TS_CMD_LOSETUP --find --show $BACKFILE )