summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/functions.sh24
-rwxr-xr-xtests/ts/cramfs/doubles2
-rwxr-xr-xtests/ts/cramfs/mkfs2
-rwxr-xr-xtests/ts/minix/mkfs3
4 files changed, 27 insertions, 4 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 66dcb0d70..7232adf46 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -496,6 +496,30 @@ function ts_device_has_uuid {
return $?
}
+function ts_mount {
+ local out
+ local result
+ local msg
+ local fs
+ local fs_exp=$1
+ shift
+
+ out=$($TS_CMD_MOUNT "$@" 2>&1)
+ result=$?
+ echo -n "$out" >> $TS_OUTPUT
+
+ if [ $result != 0 ] \
+ && msg=$(echo "$out" | grep -m1 "unknown filesystem type")
+ then
+ # skip only if reported fs correctly and if it's not available
+ fs=$(echo "$msg" | sed -n "s/.*type '\(.*\)'$/\1/p")
+ [ "$fs" = "fs_exp" ] \
+ && grep -qe "[[:space:]]${fs}$" /proc/filesystems &>/dev/null \
+ || ts_skip "$msg"
+ fi
+ return $result
+}
+
function ts_is_mounted {
local DEV=$(ts_canonicalize "$1")
diff --git a/tests/ts/cramfs/doubles b/tests/ts/cramfs/doubles
index 7393fc7dc..43fc60330 100755
--- a/tests/ts/cramfs/doubles
+++ b/tests/ts/cramfs/doubles
@@ -46,7 +46,7 @@ ts_log "create cramfs image"
$TS_CMD_MKCRAMFS $IMAGE_SRC $IMAGE_PATH 2>&1 >> $TS_OUTPUT
[ -s "$IMAGE_PATH" ] || ts_die "Cannot create $IMAGE_PATH"
-$TS_CMD_MOUNT -r $IMAGE_PATH $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_mount "cramfs" -r $IMAGE_PATH $TS_MOUNTPOINT
# check it
ts_is_mounted $TS_MOUNTPOINT || ts_die "Cannot find $TS_MOUNTPOINT in /proc/mounts"
diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs
index 70c827591..06cdfbd32 100755
--- a/tests/ts/cramfs/mkfs
+++ b/tests/ts/cramfs/mkfs
@@ -77,7 +77,7 @@ ts_device_has "TYPE" "cramfs" $DEVICE
[ "$?" == "0" ] || ts_die "Cannot find cramfs on $DEVICE" $DEVICE
ts_log "mount the image"
-$TS_CMD_MOUNT -r -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT
+ts_mount "cramfs" -r -L $LABEL $TS_MOUNTPOINT
# check it
ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE
diff --git a/tests/ts/minix/mkfs b/tests/ts/minix/mkfs
index f94cb0a4d..86230f77c 100755
--- a/tests/ts/minix/mkfs
+++ b/tests/ts/minix/mkfs
@@ -37,8 +37,7 @@ ts_log "create mountpoint dir"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
ts_log "mount the filesystem"
-($TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT || true) \
- | grep -q "unknown filesystem type" && ts_skip "mkfs: minix fs not supported by kernel"
+ts_mount "minix" $DEVICE $TS_MOUNTPOINT
# check it
ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE