* [LTP] [PATCH v2, 1/2] lib/tst_test.sh: Make tst_umount work with argument that
@ 2021-07-15 14:24 Leo Liang
2021-07-16 1:23 ` xuyang2018.jy
0 siblings, 1 reply; 4+ messages in thread
From: Leo Liang @ 2021-07-15 14:24 UTC (permalink / raw)
To: ltp
/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.
Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
---
testcases/lib/tst_test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index c6aa2c487..7e77711f1 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -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
--
2.17.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2, 1/2] lib/tst_test.sh: Make tst_umount work with argument that
2021-07-15 14:24 [LTP] [PATCH v2, 1/2] lib/tst_test.sh: Make tst_umount work with argument that Leo Liang
@ 2021-07-16 1:23 ` xuyang2018.jy
2021-07-16 6:43 ` Leo Liang
2021-07-16 8:12 ` Petr Vorel
0 siblings, 2 replies; 4+ messages in thread
From: xuyang2018.jy @ 2021-07-16 1:23 UTC (permalink / raw)
To: ltp
Hi Leo
> /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.
>
> Signed-off-by: Leo Yu-Chi Liang<ycliang@andestech.com>
> ---
> testcases/lib/tst_test.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index c6aa2c487..7e77711f1 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -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
> tst_res TINFO "The $device is not mounted, skipping umount"
> return
> fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2, 1/2] lib/tst_test.sh: Make tst_umount work with argument that
2021-07-16 1:23 ` xuyang2018.jy
@ 2021-07-16 6:43 ` Leo Liang
2021-07-16 8:12 ` Petr Vorel
1 sibling, 0 replies; 4+ messages in thread
From: Leo Liang @ 2021-07-16 6:43 UTC (permalink / raw)
To: ltp
Hi Yang,
On Fri, Jul 16, 2021 at 09:23:01AM +0800, xuyang2018.jy@fujitsu.com wrote:
> Hi Leo
> > /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.
> >
> > Signed-off-by: Leo Yu-Chi Liang<ycliang@andestech.com>
> > ---
> > testcases/lib/tst_test.sh | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> > index c6aa2c487..7e77711f1 100644
> > --- a/testcases/lib/tst_test.sh
> > +++ b/testcases/lib/tst_test.sh
> > @@ -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
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
> > tst_res TINFO "The $device is not mounted, skipping umount"
> > return
> > fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2, 1/2] lib/tst_test.sh: Make tst_umount work with argument that
2021-07-16 1:23 ` xuyang2018.jy
2021-07-16 6:43 ` Leo Liang
@ 2021-07-16 8:12 ` Petr Vorel
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2021-07-16 8:12 UTC (permalink / raw)
To: ltp
Hi all,
> Hi Leo
> > /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.
> > Signed-off-by: Leo Yu-Chi Liang<ycliang@andestech.com>
> > ---
> > testcases/lib/tst_test.sh | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> > index c6aa2c487..7e77711f1 100644
> > --- a/testcases/lib/tst_test.sh
> > +++ b/testcases/lib/tst_test.sh
> > @@ -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.
+1, please no any unnecessary dependency.
Kind regards,
Petr
> Best Regards
> Yang Xu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-16 8:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 14:24 [LTP] [PATCH v2, 1/2] lib/tst_test.sh: Make tst_umount work with argument that Leo Liang
2021-07-16 1:23 ` xuyang2018.jy
2021-07-16 6:43 ` Leo Liang
2021-07-16 8:12 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.