[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2023 08:24:38 -0800
From: Kui-Feng Lee <sinquersw@...il.com>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: thinker.li@...il.com, netdev@...r.kernel.org, martin.lau@...ux.dev,
kernel-team@...a.com, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, dsahern@...nel.org, edumazet@...gle.com, kuifeng@...a.com
Subject: Re: [PATCH net-next v2 2/2] selftests: fib_tests: Add tests for
toggling between w/ and w/o expires.
On 12/11/23 21:35, Hangbin Liu wrote:
> On Mon, Dec 11, 2023 at 06:40:43PM -0800, Kui-Feng Lee wrote:
>>>> + N_EXP_SLEEP=$($IP -6 route list |grep expires|wc -l)
>>>> + if [ $N_EXP_SLEEP -ne 100 ]; then
>>>> + echo "FAIL: expected 100 routes with expires, got $N_EXP_SLEEP"
>>>
>>> Hi,
>>>
>>> Here the test failed, but ret is not updated.
>>>
>>>> + fi
>>>> + sleep $(($EXPIRE * 2 + 1))
>>>> + 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"
>>>> + ret=1
>>>
>>> Here the ret is updated.
>
> BTW, the current fib6_gc_test() use $ret to store the result. But the latter
> check would cover the previous one. e.g.
>
> if [ $N_EXP_SLEEP -ne 0 ]; then
> ret=1
> else
> ret=0
> fi
>
> do_some_other_tests
> if [ $N_EXP_SLEEP -ne 0 ]; then
> ret=1
> else
> ret=0
> fi
>
> If the previous one failed, but later one pass, the ret would be re-write to 0.
> So I think we can use log_test for each checking.
>
> Thanks
> Hangbin
Some of these tests has dependencies. So, what I did is to perform the
following commands only if ret = 0.
if [ $N_EXP_SLEEP -ne 0 ]; then
ret=1
else
ret=0
fi
if [ $ret -eq 0 ]; then
.....
if [ ...]; then
ret=1
else
ret=0
fi
fi
if [ $ret -eq 0]; then
....
fi
Powered by blists - more mailing lists