[LTP] [PATCH 1/2] ip_tests.sh: Iprove grep count
Wei Gao
wegao@suse.com
Thu Dec 19 02:49:27 CET 2024
On Wed, Dec 18, 2024 at 06:37:26PM +0100, Avinesh Kumar wrote:
> Hi Petr,
>
> On Tuesday, December 17, 2024 3:50:40 PM CET Petr Vorel wrote:
> > Some systems have already defined another route with src 127.0.0.1,
> > therefore more exact pattern is needed.
> >
> > Also 1) escape '.' (dot) in regex 2) use '-q' instead of redirecting
> > stdout to /dev/null.
> >
> > Reported-by: Petr Cervinka <pcervinka@suse.com>
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
>
> Reviewed-by: Avinesh Kumar <akumar@suse.de>
> for both the patches.
>
> > ---
> > testcases/network/iproute/ip_tests.sh | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/testcases/network/iproute/ip_tests.sh b/testcases/network/iproute/ip_tests.sh
> > index ee9768073f..0b1d5a85e6 100755
> > --- a/testcases/network/iproute/ip_tests.sh
> > +++ b/testcases/network/iproute/ip_tests.sh
> > @@ -179,7 +179,7 @@ test5()
> > $ip4_addr via 127.0.0.1 dev lo
> > EOF
> >
> > - ip route show | grep "$ip4_addr via 127.0.0.1 dev lo" > tst_ip.out 2>&1
> > + ip route show | grep "$ip4_addr via 127\.0\.0\.1 dev lo" > tst_ip\.out 2>&1
> > if [ $? -ne 0 ]; then
> > tst_res TFAIL "'ip route show' command failed"
> > return
> > @@ -195,7 +195,7 @@ $ip4_addr via 127.0.0.1 dev lo
> >
> > ROD ip route del $ip4_addr via 127.0.0.1
> >
> > - ip route show | grep 127.0.0.1 > /dev/null
> > + ip route show | grep -q "$ip4_addr via 127\.0\.0\.1 dev lo"
> > if [ $? -eq 0 ]; then
> > tst_res TFAIL "route not deleted"
> > return
> >
Reviewed-by: Wei Gao <wegao@suse.com>
for both the patches.
Thanks
>
> Regards,
> Avinesh
>
>
More information about the ltp
mailing list