]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests, add function ts_mount
authorRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 15 May 2014 11:20:31 +0000 (13:20 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Fri, 16 May 2014 10:06:00 +0000 (12:06 +0200)
We want to generalize mounts similar to how we do it already in
minix/mkfs. Currently most of our other checks just fail if
"fs not supported".

Note that the new function checks a bit stronger than before in
minix/mkfs. It respects mount's return value and stderr goes
to $TS_OUTPUT too.

It's a bit ugly that we write to $TS_OUTPUT from inside of the
function. But if the caller would do it then we couldn't
ts_skip and the whole function would be pointless.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests/functions.sh
tests/ts/minix/mkfs

index 3888f0dcd0715dd71dc0a716982e21fba01f429b..a1ed3ad221f7fdc968ed8dd95e03f507871f849a 100644 (file)
@@ -491,6 +491,22 @@ function ts_device_has_uuid {
        return $?
 }
 
+function ts_mount {
+       local out
+       local result
+       local msg
+
+       out=$($TS_CMD_MOUNT "$@" 2>&1)
+       result=$?
+       echo -n "$out" >> $TS_OUTPUT
+
+       if [ $result != 0 ]; then
+               msg=$(echo "$out" | grep -m1 "unknown filesystem type") \
+                       && ts_skip "$msg"
+       fi
+       return $result
+}
+
 function ts_is_mounted {
        local DEV=$(ts_canonicalize "$1")
 
index f94cb0a4d29ab582b3c05cacdcb21c42e6b4ba4d..f664e3525914b2df9cd2c4b1e43963a8e25c5768 100755 (executable)
@@ -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 $DEVICE $TS_MOUNTPOINT
 
 # check it
 ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $DEVICE