netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: thinker.li@gmail.com
Cc: netdev@vger.kernel.org, martin.lau@linux.dev,
	kernel-team@meta.com, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, dsahern@kernel.org, edumazet@google.com,
	sinquersw@gmail.com, kuifeng@meta.com
Subject: Re: [PATCH net-next v2 2/2] selftests: fib_tests: Add tests for toggling between w/ and w/o expires.
Date: Tue, 12 Dec 2023 10:20:39 +0800	[thread overview]
Message-ID: <ZXfDd_tzAwDbi66Q@Laptop-X1> (raw)
In-Reply-To: <20231208194523.312416-3-thinker.li@gmail.com>

On Fri, Dec 08, 2023 at 11:45:23AM -0800, thinker.li@gmail.com wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
> 
> Make sure that toggling routes between w/ expires and w/o expires works
> properly with GC list.
> 
> When a route with expires is replaced by a permanent route, the entry
> should be removed from the gc list. When a permanent routes is replaced by
> a temporary route, the new entry should be added to the gc list. The new
> tests check if these basic operators work properly.
> 
> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
> ---
>  tools/testing/selftests/net/fib_tests.sh | 69 +++++++++++++++++++++++-
>  1 file changed, 67 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
> index 66d0db7a2614..a8b4628fd7d2 100755
> --- a/tools/testing/selftests/net/fib_tests.sh
> +++ b/tools/testing/selftests/net/fib_tests.sh
> @@ -806,10 +806,75 @@ fib6_gc_test()
>  	    ret=0
>  	fi
>  
> -	set +e
> -
>  	log_test $ret 0 "ipv6 route garbage collection"
>  
> +	# Delete permanent routes
> +	for i in $(seq 1 5000); do
> +	    $IP -6 route del 2001:30::$i \
> +		via 2001:10::2 dev dummy_10
> +	done
> +
> +	# Permanent routes
> +	for i in $(seq 1 100); do
> +	    # Expire route after $EXPIRE seconds
> +	    $IP -6 route add 2001:20::$i \
> +		via 2001:10::2 dev dummy_10
> +	done
> +	# Replace with temporary routes
> +	for i in $(seq 1 100); do
> +	    # Expire route after $EXPIRE seconds
> +	    $IP -6 route replace 2001:20::$i \
> +		via 2001:10::2 dev dummy_10 expires $EXPIRE
> +	done
> +	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.

> +	else
> +	    ret=0
> +	fi
> +
> +	log_test $ret 0 "ipv6 route garbage collection (replace with expires)"
> +
> +	PERM_BASE=$($IP -6 route list |grep -v expires|wc -l)
> +	# Temporary routes
> +	for i in $(seq 1 100); do
> +	    # Expire route after $EXPIRE seconds
> +	    $IP -6 route add 2001:20::$i \
> +		via 2001:10::2 dev dummy_10 expires $EXPIRE
> +	done
> +	# Replace with permanent routes
> +	for i in $(seq 1 100); do
> +	    # Expire route after $EXPIRE seconds
> +	    $IP -6 route replace 2001:20::$i \
> +		via 2001:10::2 dev dummy_10
> +	done
> +	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"

Same here.

Thanks
Hangbin
> +	fi
> +	sleep $(($EXPIRE * 2 + 1))
> +	N_EXP_PERM=$($IP -6 route list |grep -v expires|wc -l)
> +	N_EXP_PERM=$(($N_EXP_PERM - $PERM_BASE))
> +	if [ $N_EXP_PERM -ne 100 ]; then
> +	    echo "FAIL: expected 100 permanent routes," \
> +		 "got $N_EXP_PERM"
> +	    ret=1
> +	else
> +	    ret=0
> +	fi
> +
> +	log_test $ret 0 "ipv6 route garbage collection (replace with permanent)"
> +
> +	set +e
> +
>  	cleanup &> /dev/null
>  }
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-12-12  2:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 19:45 [PATCH net-next v2 0/2] Fix dangling pointer at f6i->gc_link thinker.li
2023-12-08 19:45 ` [PATCH net-next v2 1/2] net/ipv6: insert a f6i to a GC list only if the f6i is in a fib6_table tree thinker.li
2023-12-08 22:43   ` David Ahern
2023-12-08 23:19     ` Kui-Feng Lee
2023-12-08 23:38       ` Kui-Feng Lee
2023-12-08 19:45 ` [PATCH net-next v2 2/2] selftests: fib_tests: Add tests for toggling between w/ and w/o expires thinker.li
2023-12-12  2:20   ` Hangbin Liu [this message]
2023-12-12  2:40     ` Kui-Feng Lee
2023-12-12  5:35       ` Hangbin Liu
2023-12-12 16:24         ` Kui-Feng Lee
2023-12-13 17:22 ` [PATCH net-next v2 0/2] Fix dangling pointer at f6i->gc_link David Ahern
2023-12-13 17:32   ` Eric Dumazet
2023-12-13 19:37     ` David Ahern

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=ZXfDd_tzAwDbi66Q@Laptop-X1 \
    --to=liuhangbin@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).