lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 2 Feb 2024 10:25:45 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Kui-Feng Lee <sinquersw@...il.com>
Cc: thinker.li@...il.com, netdev@...r.kernel.org, ast@...nel.org,
	martin.lau@...ux.dev, kernel-team@...a.com, davem@...emloft.net,
	dsahern@...nel.org, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, kuifeng@...a.com
Subject: Re: [PATCH net-next 5/5] selftests/net: Adding test cases of
 replacing routes and route advertisements.

On Thu, Feb 01, 2024 at 09:14:17AM -0800, Kui-Feng Lee wrote:
> > > +	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"
> 
> If I read it correctly, the point here is too many boilerplate checks,
> and you prefer to reduce them. Right?
> No problem! I will do it.

Yes, thanks!

Hangbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ