[PATCH] selftest: Reduce waiting time for nmbd!

Michael Adam obnox at samba.org
Wed Jul 23 07:09:20 MDT 2014


Hi!

two comments:

1. nmblookup3 is binary-mapped to nmblookup,
   so these commands are executed and can fail.
   I guess we can remove the old name and use
   nmblookup, but that should be a separate patch,
   imho.

2. Other than that it is a good thing to reduce
   the startup time for the environment.
   I just want to point out that the current checks
   don't only check whether nmblookup is running
   but that it answeres a couple of requests.
   And it may take nmbd a certain startup time
   to be able to answer these.

   So the patch does make a difference, but it may
   well be enought to test only one request successfully.
   But imho this change should be made more explicit in the
   commit message.

Cheers - Michael


On 2014-07-22 at 15:35 +0200, Andreas Schneider wrote:
> This did not work cause there is no nmblookup3 and we really don't need
> to wait for 10 seconds. This should reduce running tests.
> 
> Signed-off-by: Andreas Schneider <asn at samba.org>
> ---
>  selftest/target/Samba3.pm | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
> index a6d85cc..d54b347 100755
> --- a/selftest/target/Samba3.pm
> +++ b/selftest/target/Samba3.pm
> @@ -1286,16 +1286,25 @@ sub wait_for_start($$$$$)
>  	my $ret;
>  
>  	if ($nmbd eq "yes") {
> +	    my $count = 0;
> +
>  	    # give time for nbt server to register its names
>  	    print "delaying for nbt name registration\n";
> -	    sleep(10);
> +
>  	    # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init 
> -	    my $nmblookup = Samba::bindir_path($self, "nmblookup3");
> -	    system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__");
> -	    system("$nmblookup $envvars->{CONFIGURATION} __SAMBA__");
> -	    system("$nmblookup $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__");
> -	    system("$nmblookup $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}");
> -	    system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}");
> +	    my $nmblookup = Samba::bindir_path($self, "nmblookup");
> +	    do {
> +			$ret = system("$nmblookup $envvars->{CONFIGURATION} $envvars->{SERVER}");
> +			if ($ret != 0) {
> +				sleep(2);
> +			}
> +			$count++;
> +	    } while ($ret != 0 && $count < 10);
> +	    if ($count == 10) {
> +			print "NMBD not reachable after 10 retries\n";
> +			teardown_env($self, $envvars);
> +			return 0;
> +	    }
>  	}
>  
>  	if ($winbindd eq "yes") {
> -- 
> 2.0.1
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140723/72c1a375/attachment.pgp>


More information about the samba-technical mailing list