summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorRuediger Meier2018-03-09 18:27:44 +0100
committerKarel Zak2018-03-19 11:46:11 +0100
commitec182d8b9da7596809aab9aab4fc931e9ccb7494 (patch)
tree5b5127ff66d0d027da6238e105eb3dfa5bbfc3b3 /tests/functions.sh
parenttests: handle xargs errors and invalid args (diff)
downloadkernel-qcow2-util-linux-ec182d8b9da7596809aab9aab4fc931e9ccb7494.tar.gz
kernel-qcow2-util-linux-ec182d8b9da7596809aab9aab4fc931e9ccb7494.tar.xz
kernel-qcow2-util-linux-ec182d8b9da7596809aab9aab4fc931e9ccb7494.zip
tests: fix grep expressions for devices
ts_is_mounted "/dev/loop1" returned true if /dev/loop17 was mounted. A very annoying source of sporadic failures since many years. This issue became more visible since running the checks in parallel, which increases the probability to get bigger loop device numbers. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index fc8f86377..66eaa9d6e 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -618,10 +618,10 @@ function ts_mount {
function ts_is_mounted {
local DEV=$(ts_canonicalize "$1")
- grep -q $DEV /proc/mounts && return 0
+ grep -q "\(^\| \)$DEV " /proc/mounts && return 0
if [ "${DEV#/dev/loop/}" != "$DEV" ]; then
- grep -q "/dev/loop${DEV#/dev/loop/}" /proc/mounts && return 0
+ grep -q "^/dev/loop${DEV#/dev/loop/} " /proc/mounts && return 0
fi
return 1
}