lib/tst_test.sh: Make tst_umount work with argument that
PATCH v2 1/2 lib/tst_test.sh: Make tst_umount work with argument that
/proc/mounts shows the mount point without terminating slashes, e.g. ~ $ cat /proc/mounts
xxx /root/cgroup cgroup rw,relatime,cpu 0 0
So current tst_umount would not work with argument that has terminating slash, e.g. tst_umount cgroup/ would give "The device is not mounted".
Fix this by using mountpoint command instead of grepping /proc/mounts.
--- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/tst_test.sh +1 -1
@@ -282,7 +282,7 @@ tst_umount() [ -z "$device" ] && return - if ! grep -q "$device" /proc/mounts; then + if ! mountpoint -q "$device"; then tst_res TINFO "The $device is not mounted, skipping umount" return fi
Signature · 1 line
2.17.0
PATCH v2 1/2 lib/tst_test.sh: Make tst_umount work with argument that
Hi Leo
Quoted 19 lines
/proc/mountsshows the mount point without terminating slashes, e.g. ~ $ cat/proc/mounts
xxx/root/cgroupcgroup rw,relatime,cpu 0 0So current
tst_umountwould not work with argument that has terminating slash, e.g.tst_umountcgroup/ would give "The device is not mounted".Fix this by using mountpoint command instead of grepping
/proc/mounts.Signed-off-by Leo Yu-Chi Liang<[email protected]>--- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/lib/tst_test.sh +0
-0
testcases/lib/tst_test.sh tst_umount() · line 285
Quoted 5 lines
testcases/lib/tst_test.sh +1
-1@@ -282,7 +282,7 @@ tst_umount() [ -z "$device" ]&& return - if ! grep -q "$device" /proc/mounts; then + if ! mountpoint -q "$device"; then
Honestly speaking, I don't want to introduce mountpoint command. we can just filter the last "/" string for $device.
Best Regards
Yang Xu
Quoted 3 lines
testcases/lib/tst_test.sh +0
-0tst_res TINFO "The $device is not mounted, skipping umount" return fi
PATCH v2 1/2 lib/tst_test.sh: Make tst_umount work with argument that
Hi Yang,
Quoted 23 lines · On Fri, Jul 16, 2021 at 09:23:01AM +0800, [email protected] wrote:
Hi Leo
Quoted 22 lines
/proc/mountsshows the mount point without terminating slashes, e.g. ~ $ cat/proc/mounts
xxx/root/cgroupcgroup rw,relatime,cpu 0 0So current
tst_umountwould not work with argument that has terminating slash, e.g.tst_umountcgroup/ would give "The device is not mounted".Fix this by using mountpoint command instead of grepping
/proc/mounts.Signed-off-by Leo Yu-Chi Liang<[email protected]>--- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/lib/tst_test.sh +0
-0@@ -282,7 +282,7 @@ tst_umount() [ -z "$device" ]&& return
Quoted 7 lines
testcases/lib/tst_test.sh tst_umount() · line 285
Quoted 2 lines
testcases/lib/tst_test.sh +1
-1- if ! grep -q "$device" /proc/mounts; then + if ! mountpoint -q "$device"; thenHonestly speaking, I don't want to introduce mountpoint command. we can just filter the last "/" string for $device.
Best Regards
Yang Xu
Got it!
I'll send a v3 patch with this approach:
Filtering out the '/' when determining whether a $device is mounted. Thanks!
Best regards,
Leo
Quoted 3 lines
Quoted 3 lines
testcases/lib/tst_test.sh +0
-0tst_res TINFO "The $device is not mounted, skipping umount" return fi
PATCH v2 1/2 lib/tst_test.sh: Make tst_umount work with argument that
In reply to [email protected]Hi all,
Quoted 21 lines
Hi Leo
Quoted 19 lines
/proc/mountsshows the mount point without terminating slashes, e.g. ~ $ cat/proc/mounts
xxx/root/cgroupcgroup rw,relatime,cpu 0 0So current
tst_umountwould not work with argument that has terminating slash, e.g.tst_umountcgroup/ would give "The device is not mounted".Fix this by using mountpoint command instead of grepping
/proc/mounts.Signed-off-by Leo Yu-Chi Liang<[email protected]>--- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/lib/tst_test.sh +0
-0@@ -282,7 +282,7 @@ tst_umount()
Quoted 6 lines
testcases/lib/tst_test.sh tst_umount() · line 285
Quoted 4 lines
testcases/lib/tst_test.sh +1
-1[ -z "$device" ]&& return - if ! grep -q "$device" /proc/mounts; then + if ! mountpoint -q "$device"; thenHonestly speaking, I don't want to introduce mountpoint command. we can just filter the last "/" string for $device.
+1, please no any unnecessary dependency.
Kind regards,
Petr
Quoted 2 lines
Best Regards
Yang Xu