diff options
author | Karel Zak | 2014-05-16 14:30:05 +0200 |
---|---|---|
committer | Karel Zak | 2014-05-16 14:30:05 +0200 |
commit | 1efded63dfe85d62bcd8f0ff29ea6b62aa5cac74 (patch) | |
tree | edd7ba4ca0fd2ace5752e384dd0005ea64a69ca7 /tests/functions.sh | |
parent | Merge branch 'tests-check-prog' of https://github.com/rudimeier/util-linux (diff) | |
parent | tests: use ts_mount for cramfs (diff) | |
download | kernel-qcow2-util-linux-1efded63dfe85d62bcd8f0ff29ea6b62aa5cac74.tar.gz kernel-qcow2-util-linux-1efded63dfe85d62bcd8f0ff29ea6b62aa5cac74.tar.xz kernel-qcow2-util-linux-1efded63dfe85d62bcd8f0ff29ea6b62aa5cac74.zip |
Merge branch 'tests-mount' of https://github.com/rudimeier/util-linux
* 'tests-mount' of https://github.com/rudimeier/util-linux:
tests: use ts_mount for cramfs
tests: ts_mount knows which fs is expected
tests: ts_mount validates error message
tests, add function ts_mount
Diffstat (limited to 'tests/functions.sh')
-rw-r--r-- | tests/functions.sh | 24 |
1 files changed, 24 insertions, 0 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") |