From b988695ed7a229f7fe5472bd3ebf257f05524270 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 30 Jan 2019 13:44:04 +0100 Subject: [PATCH] selftest:Samba4: report when samba is started and ready Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- selftest/target/Samba4.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 647e1f14467..05c89345661 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -217,9 +217,9 @@ sub wait_for_start($$) $count++; } while ($ret != 0 && $count < 20); if ($count == 20) { - warn("nbt not reachable after 20 retries\n"); teardown_env($self, $testenv_vars); - return 0; + warn("nbt not reachable after 20 retries\n"); + return -1; } # Ensure we have the first RID Set before we start tests. This makes the tests more reliable. @@ -254,10 +254,11 @@ sub wait_for_start($$) while (system("$cmd >/dev/null") != 0) { $count++; if ($count > $max_wait) { + teardown_env($self, $testenv_vars); warn("Timed out ($max_wait sec) waiting for working LDAP and a RID Set to be allocated by $testenv_vars->{NETBIOSNAME} PID $testenv_vars->{SAMBA_PID}"); - $ret = -1; - last; + return -1; } + print "Waiting for working LDAP...\n"; sleep(1); } } @@ -278,14 +279,16 @@ sub wait_for_start($$) $count++; } while ($ret != 0 && $count < 20); if ($count == 20) { - warn("winbind not reachable after 20 retries\n"); teardown_env($self, $testenv_vars); - return 0; + warn("winbind not reachable after 20 retries\n"); + return -1; } print $self->getlog_env($testenv_vars); - return $ret + print "READY ($testenv_vars->{SAMBA_PID})\n"; + + return 0 } sub write_ldb_file($$$) -- 2.34.1