summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorRuediger Meier2014-05-15 13:20:31 +0200
committerRuediger Meier2014-05-16 12:06:00 +0200
commit2f9549470754a958a8151e000ee881f84015634c (patch)
tree7e74b46c0c687d0d519a327fe74fd1c90bc08794 /tests/functions.sh
parentMerge branch 'travis-root-checks-v2' of https://github.com/rudimeier/util-linux (diff)
downloadkernel-qcow2-util-linux-2f9549470754a958a8151e000ee881f84015634c.tar.gz
kernel-qcow2-util-linux-2f9549470754a958a8151e000ee881f84015634c.tar.xz
kernel-qcow2-util-linux-2f9549470754a958a8151e000ee881f84015634c.zip
tests, add function ts_mount
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>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 3888f0dcd..a1ed3ad22 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -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")