summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-04-12 09:05:34 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-04-12 01:53:37 +0200
commitbb15aa58bc862fbd33b67d5570f68e4232db1a88 (patch)
treebe0891d6a24f98763737612db674ffe52293a09e /selftest/target
parente3c3b4daa425fede17203b474fa35493afbda2a9 (diff)
downloadsamba-bb15aa58bc862fbd33b67d5570f68e4232db1a88.tar.gz
samba-bb15aa58bc862fbd33b67d5570f68e4232db1a88.tar.bz2
samba-bb15aa58bc862fbd33b67d5570f68e4232db1a88.zip
s3/selftest Tear down the environment if we fail to connect
This removes the exit(1) that previously didn't tear down the environment correctly, and instead just fails to set it up, allowing the rest of the script handle that with more grace. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Apr 12 01:53:37 CEST 2011 on sn-devel-104
Diffstat (limited to 'selftest/target')
-rw-r--r--selftest/target/Samba3.pm48
1 files changed, 36 insertions, 12 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 9a3be7d72f..d2082f5b91 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -106,12 +106,16 @@ sub setup_env($$$)
return $self->setup_ktest("$path/ktest");
} elsif ($envname eq "secserver") {
if (not defined($self->{vars}->{dc})) {
- $self->setup_dc("$path/dc");
+ if (not defined($self->setup_dc("$path/dc"))) {
+ return undef;
+ }
}
return $self->setup_secserver("$path/secserver", $self->{vars}->{dc});
} elsif ($envname eq "member") {
if (not defined($self->{vars}->{dc})) {
- $self->setup_dc("$path/dc");
+ if (not defined($self->setup_dc("$path/dc"))) {
+ return undef;
+ }
}
return $self->setup_member("$path/member", $self->{vars}->{dc});
} else {
@@ -137,11 +141,15 @@ sub setup_dc($$)
"localdc2pass",
$dc_options);
+ $vars or return undef;
+
$self->check_or_start($vars,
($ENV{SMBD_MAXTIME} or 2700),
"yes", "yes", "yes");
- $self->wait_for_start($vars);
+ if (not $self->wait_for_start($vars)) {
+ return undef;
+ }
$vars->{DC_SERVER} = $vars->{SERVER};
$vars->{DC_SERVER_IP} = $vars->{SERVER_IP};
@@ -170,7 +178,7 @@ sub setup_member($$$)
"localmember3pass",
$member_options);
- $ret or die("Unable to provision");
+ $ret or return undef;
my $net = $self->binpath("net");
my $cmd = "";
@@ -184,7 +192,9 @@ sub setup_member($$$)
($ENV{SMBD_MAXTIME} or 2700),
"yes", "yes", "yes");
- $self->wait_for_start($ret);
+ if (not $self->wait_for_start($ret)) {
+ return undef;
+ }
$ret->{DC_SERVER} = $dcvars->{SERVER};
$ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
@@ -212,11 +222,15 @@ sub setup_secshare($$)
"local4pass",
$secshare_options);
+ $vars or return undef;
+
$self->check_or_start($vars,
($ENV{SMBD_MAXTIME} or 2700),
"yes", "no", "yes");
- $self->wait_for_start($vars);
+ if (not $self->wait_for_start($vars)) {
+ return undef;
+ }
$self->{vars}->{secshare} = $vars;
@@ -240,13 +254,15 @@ sub setup_secserver($$$)
"localserver5pass",
$secserver_options);
- $ret or die("Unable to provision");
+ $ret or return undef;
$self->check_or_start($ret,
($ENV{SMBD_MAXTIME} or 2700),
"yes", "no", "yes");
- $self->wait_for_start($ret);
+ if (not $self->wait_for_start($ret)) {
+ return undef;
+ }
$ret->{DC_SERVER} = $dcvars->{SERVER};
$ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP};
@@ -276,7 +292,7 @@ sub setup_ktest($$$)
"localktest6pass",
$ktest_options);
- $ret or die("Unable to provision");
+ $ret or return undef;
open(USERMAP, ">$prefix/lib/username.map") or die("Unable to open $prefix/lib/username.map");
print USERMAP "
@@ -326,7 +342,9 @@ $ret->{USERNAME} = KTEST\\Administrator
($ENV{SMBD_MAXTIME} or 2700),
"yes", "no", "yes");
- $self->wait_for_start($ret);
+ if (not $self->wait_for_start($ret)) {
+ return undef;
+ }
return $ret;
}
@@ -873,12 +891,18 @@ sub wait_for_start($$)
} while ($ret != 0 && $count < 10);
if ($count == 10) {
print "SMBD failed to start up in a reasonable time (20sec)\n";
- exit 1;
+ teardown_env($self, $envvars);
+ return 0;
}
# Ensure we have domain users mapped.
- system($self->binpath("net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain");
+ $ret = system($self->binpath("net") ." $envvars->{CONFIGURATION} groupmap add rid=513 unixgroup=domusers type=domain");
+ if ($ret != 0) {
+ return 1;
+ }
print $self->getlog_env($envvars);
+
+ return 1;
}
1;