From 27c45108721b90ca89a4724294bf76855cad16cf Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Thu, 23 Oct 2014 18:42:45 -0600 Subject: [PATCH] LU-5499 tests: use grep -w to search /proc/mounts When searching for /sbin/mount.lustre in /proc/mounts, use "grep -qw" instead of using a trailing space, because if the mount.lustre binary is deleted while it is mounted (e.g. by "make clean") it may have a non-printable character following it and not be found and unmounted. Signed-off-by: Andreas Dilger Change-Id: Ia33c4d4b7efa73f543999f73da198fa0698cab07 Reviewed-on: http://review.whamcloud.com/12409 Tested-by: Jenkins Reviewed-by: Dmitry Eremin Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 96d86bc..d9af277 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -543,10 +543,10 @@ load_modules_local() { local mount_lustre=$LUSTRE/utils/mount.lustre if [ -f $mount_lustre ]; then local sbin_mount=/sbin/mount.lustre - if grep -qe "$sbin_mount " /proc/mounts; then - cmp $mount_lustre $sbin_mount || umount $sbin_mount + if grep -qw "$sbin_mount" /proc/mounts; then + cmp -s $mount_lustre $sbin_mount || umount $sbin_mount fi - if ! grep -qe "$sbin_mount " /proc/mounts; then + if ! grep -qw "$sbin_mount" /proc/mounts; then [ ! -f "$sbin_mount" ] && touch "$sbin_mount" if [ ! -s "$sbin_mount" -a -w "$sbin_mount" ]; then cat <<- EOF > "$sbin_mount" -- 1.8.3.1