From: Hangbin Liu <liuhangbin@gmail.com>
To: thinker.li@gmail.com
Cc: netdev@vger.kernel.org, ast@kernel.org, martin.lau@linux.dev,
kernel-team@meta.com, davem@davemloft.net, dsahern@kernel.org,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
sinquersw@gmail.com, kuifeng@meta.com
Subject: Re: [PATCH net-next 5/5] selftests/net: Adding test cases of replacing routes and route advertisements.
Date: Thu, 1 Feb 2024 16:46:38 +0800 [thread overview]
Message-ID: <ZbtabpEr7I6Gy5vE@Laptop-X1> (raw)
In-Reply-To: <20240131064041.3445212-6-thinker.li@gmail.com>
Hi,
On Tue, Jan 30, 2024 at 10:40:41PM -0800, thinker.li@gmail.com wrote:
> +# Create a new dummy_10 to remove all associated routes.
> +reset_dummy_10()
> +{
> + $IP link del dev dummy_10
> +
> + $IP link add dummy_10 type dummy
> + $IP link set dev dummy_10 up
> + $IP -6 address add 2001:10::1/64 dev dummy_10
> +}
> +
> fib6_gc_test()
> {
> setup
> @@ -768,15 +778,19 @@ fib6_gc_test()
> $IP -6 route add 2001:20::$i \
> via 2001:10::2 dev dummy_10 expires $EXPIRE
> done
> - sleep $(($EXPIRE * 2))
> - N_EXP_SLEEP=$($IP -6 route list |grep expires|wc -l)
> - if [ $N_EXP_SLEEP -ne 0 ]; then
> - echo "FAIL: expected 0 routes with expires, got $N_EXP_SLEEP"
> + sleep $(($EXPIRE * 2 + 1))
> + N_EXP=$($IP -6 route list |grep expires|wc -l)
> + if [ $N_EXP -ne 0 ]; then
> + echo "FAIL: expected 0 routes with expires, got $N_EXP"
> ret=1
> else
> ret=0
> fi
>
> + log_test $ret 0 "ipv6 route garbage collection"
> +
> + reset_dummy_10
Since you reset the dummy device and will not affect the later tests. Maybe
you can log the test directly, e.g.
if [ "$($IP -6 route list |grep expires|wc -l)" -ne 0 ]; then
log_test $ret 0 "ipv6 route garbage collection"
fi
Or, if you want to keep ret and also report passed log, you can wrapper the
number checking like
check_exp_number()
{
local exp=$1
local n_exp=$($IP -6 route list |grep expires|wc -l)
if [ "$n_exp" -ne "$exp" ]; then
echo "FAIL: expected $exp routes with expires, got $n_exp"
ret=1
else
ret=0
fi
}
Then we can call it without repeating the if/else lines
check_exp_number 0
log_test $ret 0 "ipv6 route garbage collection"
Thanks
Hangbin
next prev parent reply other threads:[~2024-02-01 8:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 6:40 [PATCH net-next 0/5] Remove expired routes with a separated list of routes thinker.li
2024-01-31 6:40 ` [PATCH net-next 1/5] net/ipv6: set expires in rt6_add_dflt_router() thinker.li
2024-01-31 6:40 ` [PATCH net-next 2/5] net/ipv6: Remove unnecessary clean thinker.li
2024-01-31 8:29 ` Hangbin Liu
2024-01-31 6:40 ` [PATCH net-next 3/5] net/ipv6: Remove expired routes with a separated list of routes thinker.li
2024-01-31 6:40 ` [PATCH net-next 4/5] net/ipv6: set expires in modify_prefix_route() if RTF_EXPIRES is set thinker.li
2024-01-31 6:40 ` [PATCH net-next 5/5] selftests/net: Adding test cases of replacing routes and route advertisements thinker.li
2024-01-31 19:20 ` Jakub Kicinski
2024-01-31 21:14 ` Kui-Feng Lee
2024-02-01 8:46 ` Hangbin Liu [this message]
2024-02-01 17:14 ` Kui-Feng Lee
2024-02-02 2:25 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZbtabpEr7I6Gy5vE@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=ast@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=kuifeng@meta.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sinquersw@gmail.com \
--cc=thinker.li@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.