selftests: fib_nexthop_multiprefix: fix cleanup() netns deletion
authorPaolo Pisati <paolo.pisati@canonical.com>
Tue, 14 Jul 2020 15:40:55 +0000 (17:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2020 07:58:48 +0000 (09:58 +0200)
commitf1ba55a5f2ff43ef966d5bbf3813b728a563b347
treeda46cb4194a0ea1fd57d8766fff614112c9fc08f
parentf9286c0aa4e2f8315a1957a5420aa4b0fcb1b7bd
selftests: fib_nexthop_multiprefix: fix cleanup() netns deletion

[ Upstream commit 651149f60376758a4759f761767965040f9e4464 ]

During setup():
...
        for ns in h0 r1 h1 h2 h3
        do
                create_ns ${ns}
        done
...

while in cleanup():
...
        for n in h1 r1 h2 h3 h4
        do
                ip netns del ${n} 2>/dev/null
        done
...

and after removing the stderr redirection in cleanup():

$ sudo ./fib_nexthop_multiprefix.sh
...
TEST: IPv4: host 0 to host 3, mtu 1400                              [ OK ]
TEST: IPv6: host 0 to host 3, mtu 1400                              [ OK ]
Cannot remove namespace file "/run/netns/h4": No such file or directory
$ echo $?
1

and a non-zero return code, make kselftests fail (even if the test
itself is fine):

...
not ok 34 selftests: net: fib_nexthop_multiprefix.sh # exit=1
...

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/net/fib_nexthop_multiprefix.sh